version 1.73.14.3, 2017/08/28 17:53:07 |
version 1.74, 2015/08/08 07:53:51 |
Line 36 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 36 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/proc.h> |
#include <sys/proc.h> |
#include <sys/ucred.h> |
#include <sys/ucred.h> |
#include <sys/pool.h> |
#include <sys/pool.h> |
#define __KAUTH_PRIVATE |
|
#include <sys/kauth.h> |
#include <sys/kauth.h> |
#include <sys/kmem.h> |
#include <sys/kmem.h> |
#include <sys/rwlock.h> |
#include <sys/rwlock.h> |
Line 55 struct kauth_key { |
|
Line 54 struct kauth_key { |
|
specificdata_key_t ks_key; /* key */ |
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. |
* Listener. |
Line 754 kauth_register_scope(const char *id, kau |
|
Line 782 kauth_register_scope(const char *id, kau |
|
|
|
/* Allocate space for a new scope and listener. */ |
/* Allocate space for a new scope and listener. */ |
scope = kmem_alloc(sizeof(*scope), KM_SLEEP); |
scope = kmem_alloc(sizeof(*scope), KM_SLEEP); |
if (callback != NULL) |
if (scope == NULL) |
|
return NULL; |
|
if (callback != NULL) { |
listener = kmem_alloc(sizeof(*listener), KM_SLEEP); |
listener = kmem_alloc(sizeof(*listener), KM_SLEEP); |
|
if (listener == NULL) { |
|
kmem_free(scope, sizeof(*scope)); |
|
return (NULL); |
|
} |
|
} |
|
|
/* |
/* |
* Acquire scope list lock. |
* Acquire scope list lock. |
Line 880 kauth_listen_scope(const char *id, kauth |
|
Line 915 kauth_listen_scope(const char *id, kauth |
|
kauth_listener_t listener; |
kauth_listener_t listener; |
|
|
listener = kmem_alloc(sizeof(*listener), KM_SLEEP); |
listener = kmem_alloc(sizeof(*listener), KM_SLEEP); |
|
if (listener == NULL) |
|
return (NULL); |
|
|
rw_enter(&kauth_lock, RW_WRITER); |
rw_enter(&kauth_lock, RW_WRITER); |
|
|
/* |
/* |