Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Expose struct kauth_cred for the benefit of the debugger...
details: https://anonhg.NetBSD.org/src/rev/36c4ab166547
branches: trunk
changeset: 340861:36c4ab166547
user: christos <christos%NetBSD.org@localhost>
date: Tue Oct 06 22:13:39 2015 +0000
description:
Expose struct kauth_cred for the benefit of the debugger. I can't convince gcc
to produce debug info for the structure if it does not appear in more than
one source file.
diffstat:
sys/conf/debugsyms.c | 10 +++++++---
sys/kern/kern_auth.c | 34 +++-------------------------------
sys/sys/kauth.h | 34 +++++++++++++++++++++++++++++++++-
3 files changed, 43 insertions(+), 35 deletions(-)
diffs (148 lines):
diff -r 7aacad83362e -r 36c4ab166547 sys/conf/debugsyms.c
--- a/sys/conf/debugsyms.c Tue Oct 06 22:12:09 2015 +0000
+++ b/sys/conf/debugsyms.c Tue Oct 06 22:13:39 2015 +0000
@@ -1,13 +1,14 @@
-/* $NetBSD: debugsyms.c,v 1.3 2009/11/23 02:13:45 rmind Exp $ */
+/* $NetBSD: debugsyms.c,v 1.4 2015/10/06 22:13:39 christos Exp $ */
/*
* This file is in the public domain.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: debugsyms.c,v 1.3 2009/11/23 02:13:45 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: debugsyms.c,v 1.4 2015/10/06 22:13:39 christos Exp $");
#define _CALLOUT_PRIVATE
#define __MUTEX_PRIVATE
+#define __KAUTH_PRIVATE
#include <sys/param.h>
#include <sys/lwp.h>
@@ -22,6 +23,8 @@
#include <sys/un.h>
#include <sys/unpcb.h>
#include <sys/vnode.h>
+#include <sys/specificdata.h>
+#include <sys/kauth.h>
/*
* Without a dummy function referencing some of the types, gcc will
@@ -32,6 +35,7 @@
proc_t *
_debugsym_dummyfunc(vnode_t *vp)
{
+ struct kauth_cred *cr = (kauth_cred_t)vp;
- return ((lwp_t *)vp->v_mount)->l_proc;
+ return cr->cr_uid ? ((lwp_t *)vp->v_mount)->l_proc : NULL;
}
diff -r 7aacad83362e -r 36c4ab166547 sys/kern/kern_auth.c
--- a/sys/kern/kern_auth.c Tue Oct 06 22:12:09 2015 +0000
+++ b/sys/kern/kern_auth.c Tue Oct 06 22:13:39 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_auth.c,v 1.74 2015/08/08 07:53:51 mlelstv Exp $ */
+/* $NetBSD: kern_auth.c,v 1.75 2015/10/06 22:13:39 christos Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.74 2015/08/08 07:53:51 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.75 2015/10/06 22:13:39 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -36,6 +36,7 @@
#include <sys/proc.h>
#include <sys/ucred.h>
#include <sys/pool.h>
+#define __KAUTH_PRIVATE
#include <sys/kauth.h>
#include <sys/kmem.h>
#include <sys/rwlock.h>
@@ -54,35 +55,6 @@
specificdata_key_t ks_key; /* key */
};
-/*
- * Credentials.
- *
- * A subset of this structure is used in kvm(3) (src/lib/libkvm/kvm_proc.c)
- * and should be synchronized with this structure when the update is
- * relevant.
- */
-struct kauth_cred {
- /*
- * Ensure that the first part of the credential resides in its own
- * cache line. Due to sharing there aren't many kauth_creds in a
- * typical system, but the reference counts change very often.
- * Keeping it separate from the rest of the data prevents false
- * sharing between CPUs.
- */
- u_int cr_refcnt; /* reference count */
-#if COHERENCY_UNIT > 4
- uint8_t cr_pad[COHERENCY_UNIT - 4];
-#endif
- uid_t cr_uid; /* user id */
- uid_t cr_euid; /* effective user id */
- uid_t cr_svuid; /* saved effective user id */
- gid_t cr_gid; /* group id */
- gid_t cr_egid; /* effective group id */
- gid_t cr_svgid; /* saved effective group id */
- u_int cr_ngroups; /* number of groups */
- gid_t cr_groups[NGROUPS]; /* group memberships */
- specificdata_reference cr_sd; /* specific data */
-};
/*
* Listener.
diff -r 7aacad83362e -r 36c4ab166547 sys/sys/kauth.h
--- a/sys/sys/kauth.h Tue Oct 06 22:12:09 2015 +0000
+++ b/sys/sys/kauth.h Tue Oct 06 22:13:39 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kauth.h,v 1.72 2015/08/17 06:16:03 knakahara Exp $ */
+/* $NetBSD: kauth.h,v 1.73 2015/10/06 22:13:39 christos Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad%NetBSD.org@localhost>
@@ -54,6 +54,38 @@
void *, void *, void *, void *, void *);
typedef struct kauth_key *kauth_key_t;
+#ifdef __KAUTH_PRIVATE /* For the debugger */
+/*
+ * Credentials.
+ *
+ * A subset of this structure is used in kvm(3) (src/lib/libkvm/kvm_proc.c)
+ * and should be synchronized with this structure when the update is
+ * relevant.
+ */
+struct kauth_cred {
+ /*
+ * Ensure that the first part of the credential resides in its own
+ * cache line. Due to sharing there aren't many kauth_creds in a
+ * typical system, but the reference counts change very often.
+ * Keeping it separate from the rest of the data prevents false
+ * sharing between CPUs.
+ */
+ u_int cr_refcnt; /* reference count */
+#if COHERENCY_UNIT > 4
+ uint8_t cr_pad[COHERENCY_UNIT - 4];
+#endif
+ uid_t cr_uid; /* user id */
+ uid_t cr_euid; /* effective user id */
+ uid_t cr_svuid; /* saved effective user id */
+ gid_t cr_gid; /* group id */
+ gid_t cr_egid; /* effective group id */
+ gid_t cr_svgid; /* saved effective group id */
+ u_int cr_ngroups; /* number of groups */
+ gid_t cr_groups[NGROUPS]; /* group memberships */
+ specificdata_reference cr_sd; /* specific data */
+};
+#endif
+
/*
* Possible return values for a listener.
*/
Home |
Main Index |
Thread Index |
Old Index