Date: Tue, 5 Jul 2005 12:00:09 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 79600 for review Message-ID: <200507051200.j65C09TC076725@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79600 Change 79600 by rwatson@rwatson_paprika on 2005/07/05 11:59:37 Use CAP_SYS_ADMIN to authorize configuring swap (swapon(), swapoff()). Affected files ... .. //depot/projects/trustedbsd/sebsd/sys/vm/swap_pager.c#12 edit Differences ... ==== //depot/projects/trustedbsd/sebsd/sys/vm/swap_pager.c#12 (text+ko) ==== @@ -1965,11 +1965,11 @@ struct nameidata nd; int error; - mtx_lock(&Giant); - error = suser(td); + error = cap_check(td, CAP_SYS_ADMIN); if (error) - goto done2; + return (error); + mtx_lock(&Giant); while (swdev_syscall_active) tsleep(&swdev_syscall_active, PUSER - 1, "swpon", 0); swdev_syscall_active = 1; @@ -2008,7 +2008,6 @@ done: swdev_syscall_active = 0; wakeup_one(&swdev_syscall_active); -done2: mtx_unlock(&Giant); return (error); } @@ -2105,12 +2104,12 @@ u_long nblks, dvbase; int error; + error = cap_check(td, CAP_SYS_ADMIN); + if (error) + return (error); + mtx_lock(&Giant); - error = suser(td); - if (error) - goto done2; - while (swdev_syscall_active) tsleep(&swdev_syscall_active, PUSER - 1, "swpoff", 0); swdev_syscall_active = 1; @@ -2188,7 +2187,6 @@ done: swdev_syscall_active = 0; wakeup_one(&swdev_syscall_active); -done2: mtx_unlock(&Giant); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507051200.j65C09TC076725>