Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Use the process credentials instead of the lwp cred...
details: https://anonhg.NetBSD.org/src/rev/093b02cde3b5
branches: trunk
changeset: 791608:093b02cde3b5
user: christos <christos%NetBSD.org@localhost>
date: Mon Nov 25 16:29:25 2013 +0000
description:
Use the process credentials instead of the lwp credentials because if the
process just did a setuid() call, the lwp might not have had a chance to
refresh l->l_cred (still has LPR_CRMOD), and we don't want to bother spending
time syncing the creds of a dying lwp. Should fix the problem with hald
people have been observing.
diffstat:
sys/kern/kern_lwp.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r 485fd8c4f2e3 -r 093b02cde3b5 sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c Mon Nov 25 16:28:20 2013 +0000
+++ b/sys/kern/kern_lwp.c Mon Nov 25 16:29:25 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lwp.c,v 1.176 2013/11/22 21:04:11 christos Exp $ */
+/* $NetBSD: kern_lwp.c,v 1.177 2013/11/25 16:29:25 christos Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.176 2013/11/22 21:04:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.177 2013/11/25 16:29:25 christos Exp $");
#include "opt_ddb.h"
#include "opt_lockdebug.h"
@@ -1174,8 +1174,14 @@
KASSERT(l != curlwp);
KASSERT(last || mutex_owned(p->p_lock));
+ /*
+ * We use the process credentials instead of the lwp credentials here
+ * because the lwp credentials maybe cached (just after a setuid call)
+ * and we don't want pay for syncing, since the lwp is going away
+ * anyway
+ */
if (p != &proc0 && p->p_nlwps != 1)
- (void)chglwpcnt(kauth_cred_getuid(l->l_cred), -1);
+ (void)chglwpcnt(kauth_cred_getuid(p->p_cred), -1);
/*
* If this was not the last LWP in the process, then adjust
* counters and unlock.
Home |
Main Index |
Thread Index |
Old Index