From d9b4d146e8e597d70ec198bf8eb24892adf9962d Mon Sep 17 00:00:00 2001 From: rwatson Date: Mon, 1 Jun 2009 20:26:51 +0000 Subject: Add a flags field to struct ucred, and export that via kinfo_proc, consuming one of its spare fields. The cr_flags field is currently unused, but will be used for features, including capability mode and pay-as-you-go audit. Discussed with: jhb, sson --- sys/kern/kern_proc.c | 1 + sys/sys/ucred.h | 1 + sys/sys/user.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 61aa1df..0ee630f 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -736,6 +736,7 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) kp->ki_ngroups * sizeof(gid_t)); kp->ki_rgid = cred->cr_rgid; kp->ki_svgid = cred->cr_svgid; + kp->ki_cr_flags = cred->cr_flags; /* If jailed(cred), emulate the old P_JAILED flag. */ if (jailed(cred)) { kp->ki_flag |= P_JAILED; diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index bac4899..626b501 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -56,6 +56,7 @@ struct ucred { struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */ struct prison *cr_prison; /* jail(2) */ struct vimage *cr_vimage; /* vimage */ + u_int cr_flags; /* credential flags */ void *cr_pspare[2]; /* general use 2 */ #define cr_endcopy cr_label struct label *cr_label; /* MAC label */ diff --git a/sys/sys/user.h b/sys/sys/user.h index f111944..ba3dfb0 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -83,7 +83,7 @@ * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and * function kvm_proclist in lib/libkvm/kvm_proc.c . */ -#define KI_NSPARE_INT 10 +#define KI_NSPARE_INT 9 #define KI_NSPARE_LONG 12 #define KI_NSPARE_PTR 7 @@ -190,6 +190,7 @@ struct kinfo_proc { */ char ki_sparestrings[68]; /* spare string space */ int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ + u_int ki_cr_flags; /* Credential flags */ int ki_jid; /* Process jail ID */ int ki_numthreads; /* XXXKSE number of threads in total */ lwpid_t ki_tid; /* XXXKSE thread id */ -- cgit v1.1