Page MenuHomeFreeBSD

D46909.diff
No OneTemporary

D46909.diff

diff --git a/bin/ps/print.c b/bin/ps/print.c
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -265,7 +265,7 @@
*cp++ = 'V';
if ((flag & P_SYSTEM) || k->ki_p->ki_lock > 0)
*cp++ = 'L';
- if ((k->ki_p->ki_cr_flags & CRED_FLAG_CAPMODE) != 0)
+ if ((k->ki_p->ki_cr_flags & KI_CRF_CAPABILITY_MODE) != 0)
*cp++ = 'C';
if (k->ki_p->ki_kiflag & KI_SLEADER)
*cp++ = 's';
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -142,11 +142,14 @@
if (proc.p_state == PRS_NEW)
continue;
if (KREAD(kd, (u_long)proc.p_ucred, &ucred) == 0) {
+ kp->ki_uid = ucred.cr_uid;
kp->ki_ruid = ucred.cr_ruid;
kp->ki_svuid = ucred.cr_svuid;
kp->ki_rgid = ucred.cr_rgid;
kp->ki_svgid = ucred.cr_svgid;
- kp->ki_cr_flags = ucred.cr_flags;
+ kp->ki_cr_flags = 0;
+ if (ucred.cr_flags & CRED_FLAG_CAPMODE)
+ kp->ki_cr_flags |= KI_CRF_CAPABILITY_MODE;
if (ucred.cr_ngroups > KI_NGROUPS) {
kp->ki_ngroups = KI_NGROUPS;
kp->ki_cr_flags |= KI_CRF_GRP_OVERFLOW;
@@ -154,7 +157,6 @@
kp->ki_ngroups = ucred.cr_ngroups;
kvm_read(kd, (u_long)ucred.cr_groups, kp->ki_groups,
kp->ki_ngroups * sizeof(gid_t));
- kp->ki_uid = ucred.cr_uid;
if (ucred.cr_prison != NULL) {
if (KREAD(kd, (u_long)ucred.cr_prison, &pr)) {
_kvm_err(kd, kd->program,
diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -38,11 +38,14 @@
#endif
#include <bsm/audit.h>
+#if defined(_KERNEL) || defined(_WANT_UCRED)
struct loginclass;
-#define XU_NGROUPS 16
+/*
+ * Flags for cr_flags.
+ */
+#define CRED_FLAG_CAPMODE 0x00000001 /* In capability mode. */
-#if defined(_KERNEL) || defined(_WANT_UCRED)
/*
* Number of groups inlined in 'struct ucred'. It must stay reasonably low as
* it is also used by some functions to allocate an array of this size on the
@@ -96,10 +99,7 @@
#define FSCRED ((struct ucred *)-1) /* filesystem credential */
#endif /* _KERNEL || _WANT_UCRED */
-/*
- * Flags for cr_flags.
- */
-#define CRED_FLAG_CAPMODE 0x00000001 /* In capability mode. */
+#define XU_NGROUPS 16
/*
* This is the external representation of struct ucred.
diff --git a/usr.bin/procstat/procstat_cred.c b/usr.bin/procstat/procstat_cred.c
--- a/usr.bin/procstat/procstat_cred.c
+++ b/usr.bin/procstat/procstat_cred.c
@@ -62,7 +62,7 @@
xo_emit("{:rgid/%5d} ", kipp->ki_rgid);
xo_emit("{:svgid/%5d} ", kipp->ki_svgid);
xo_emit("{:umask/%5s} ", get_umask(procstat, kipp));
- xo_emit("{:cr_flags/%s}", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ?
+ xo_emit("{:cr_flags/%s}", kipp->ki_cr_flags & KI_CRF_CAPABILITY_MODE ?
"C" : "-");
xo_emit("{P: }");

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 12, 2:35 AM (18 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40643057
Default Alt Text
D46909.diff (2 KB)

Event Timeline