X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8f6c56a50524aa785f7e596d52dddfb331e18961..143464d58d2bd6378e74eec636961ceb0d32fb91:/bsd/kern/kern_xxx.c?ds=sidebyside diff --git a/bsd/kern/kern_xxx.c b/bsd/kern/kern_xxx.c index 8102d15ab..293808838 100644 --- a/bsd/kern/kern_xxx.c +++ b/bsd/kern/kern_xxx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2009 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -60,6 +60,12 @@ * * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 */ +/* + * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce + * support for mandatory and extensible security protections. This notice + * is included in support of clause 2.2 (b) of the Apple Public License, + * Version 2.0. + */ #include @@ -73,17 +79,23 @@ #include #include -#include +#include #include #include +#if CONFIG_MACF +#include +#endif int -reboot(struct proc *p, register struct reboot_args *uap, __unused register_t *retval) +reboot(struct proc *p, register struct reboot_args *uap, __unused int32_t *retval) { char command[64]; - int error; - int dummy=0; + int error=0; + size_t dummy=0; +#if CONFIG_MACF + kauth_cred_t my_cred; +#endif AUDIT_ARG(cmd, uap->opt); @@ -95,10 +107,16 @@ reboot(struct proc *p, register struct reboot_args *uap, __unused register_t *re if (uap->opt & RB_COMMAND) error = copyinstr(uap->command, (void *)command, sizeof(command), (size_t *)&dummy); +#if CONFIG_MACF + if (error) + return (error); + my_cred = kauth_cred_proc_ref(p); + error = mac_system_check_reboot(my_cred, uap->opt); + kauth_cred_unref(&my_cred); +#endif if (!error) { - SET(p->p_flag, P_REBOOT); /* No more signals for this proc */ - boot(RB_BOOT, uap->opt, command); + OSBitOrAtomic(P_REBOOT, &p->p_flag); /* No more signals for this proc */ + error = boot(RB_BOOT, uap->opt, command); } return(error); } -