summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-04-11 20:20:40 +0000
committerrwatson <rwatson@FreeBSD.org>2001-04-11 20:20:40 +0000
commitaf3eb0f5a23886d054afe80270022e3fb049da7d (patch)
tree4bc9fe4aa4d840673b2102f303706bc20cf15230 /sys/kern
parentc9a0bb442c87ee0a7cf937ed1c3e06d16b64c00c (diff)
downloadFreeBSD-src-af3eb0f5a23886d054afe80270022e3fb049da7d.zip
FreeBSD-src-af3eb0f5a23886d054afe80270022e3fb049da7d.tar.gz
o Introduce a new system call, __setsugid(), which allows a process to
toggle the P_SUGID bit explicitly, rather than relying on it being set implicitly by other protection and credential logic. This feature is introduced to support inter-process authorization regression testing by simplifying userland credential management allowing the easy isolation and reproduction of authorization events with specific security contexts. This feature is enabled only by "options REGRESSION" and is not intended to be used by applications. While the feature is not known to introduce security vulnerabilities, it does allow processes to enter previously inaccessible parts of the credential state machine, and is therefore disabled by default. It may not constitute a risk, and therefore in the future pending further analysis (and appropriate need) may become a published interface. Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_prot.c23
-rw-r--r--sys/kern/syscalls.master1
2 files changed, 24 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 8ced323..003ff3b 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -44,6 +44,7 @@
*/
#include "opt_compat.h"
+#include "opt_global.h"
#include <sys/param.h>
#include <sys/acct.h>
@@ -911,6 +912,28 @@ issetugid(p, uap)
return (0);
}
+int
+__setugid(p, uap)
+ struct proc *p;
+ struct __setugid_args *uap;
+{
+
+#ifdef REGRESSION
+ switch (uap->flag) {
+ case 0:
+ p->p_flag &= ~P_SUGID;
+ return (0);
+ case 1:
+ p->p_flag |= P_SUGID;
+ return (0);
+ default:
+ return (EINVAL);
+ }
+#else /* !REGRESSION */
+ return (ENOSYS);
+#endif /* !REGRESSION */
+}
+
/*
* Check if gid is a member of the group set.
*/
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index aec2ea6..ad24185 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -541,3 +541,4 @@
int iovcnt); }
373 STD BSD { int extattr_delete_fd(int fd, int attrnamespace, \
const char *attrname); }
+374 STD BSD { int __setugid(int flag); }
OpenPOWER on IntegriCloud