xref: /titanic_41/usr/src/uts/common/syscall/ppriv.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
31*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
32*7c478bd9Sstevel@tonic-gate #include <sys/systm.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/cred_impl.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/errno.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/proc.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/debug.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/priv_impl.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/policy.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/thread.h>
41*7c478bd9Sstevel@tonic-gate #include <c2/audit.h>
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * System call support for manipulating privileges.
45*7c478bd9Sstevel@tonic-gate  *
46*7c478bd9Sstevel@tonic-gate  *
47*7c478bd9Sstevel@tonic-gate  * setppriv(2) - set process privilege set
48*7c478bd9Sstevel@tonic-gate  * getppriv(2) - get process privilege set
49*7c478bd9Sstevel@tonic-gate  * getprivimplinfo(2) - get process privilege implementation information
50*7c478bd9Sstevel@tonic-gate  * setpflags(2) - set process (privilege) flags
51*7c478bd9Sstevel@tonic-gate  * getpflags(2) - get process (privilege) flags
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate /*
55*7c478bd9Sstevel@tonic-gate  * setppriv (priv_op_t, priv_ptype_t, priv_set_t)
56*7c478bd9Sstevel@tonic-gate  */
57*7c478bd9Sstevel@tonic-gate static int
58*7c478bd9Sstevel@tonic-gate setppriv(priv_op_t op, priv_ptype_t type, priv_set_t *in_pset)
59*7c478bd9Sstevel@tonic-gate {
60*7c478bd9Sstevel@tonic-gate 	priv_set_t	pset, *target;
61*7c478bd9Sstevel@tonic-gate 	cred_t		*cr, *pcr;
62*7c478bd9Sstevel@tonic-gate 	proc_t		*p;
63*7c478bd9Sstevel@tonic-gate 	boolean_t	donocd;
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate 	if (!PRIV_VALIDSET(type) || !PRIV_VALIDOP(op))
66*7c478bd9Sstevel@tonic-gate 		return (set_errno(EINVAL));
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate 	if (copyin(in_pset, &pset, sizeof (priv_set_t)))
69*7c478bd9Sstevel@tonic-gate 		return (set_errno(EFAULT));
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate 	p = ttoproc(curthread);
72*7c478bd9Sstevel@tonic-gate 	cr = cralloc();
73*7c478bd9Sstevel@tonic-gate 	mutex_enter(&p->p_crlock);
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 	pcr = p->p_cred;
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #ifdef C2_AUDIT
78*7c478bd9Sstevel@tonic-gate 	if (audit_active)
79*7c478bd9Sstevel@tonic-gate 		audit_setppriv(op, type, &pset, pcr);
80*7c478bd9Sstevel@tonic-gate #endif
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate 	/*
83*7c478bd9Sstevel@tonic-gate 	 * Filter out unallowed request (bad op and bad type)
84*7c478bd9Sstevel@tonic-gate 	 */
85*7c478bd9Sstevel@tonic-gate 	switch (op) {
86*7c478bd9Sstevel@tonic-gate 	case PRIV_ON:
87*7c478bd9Sstevel@tonic-gate 	case PRIV_SET:
88*7c478bd9Sstevel@tonic-gate 		/*
89*7c478bd9Sstevel@tonic-gate 		 * Turning on privileges; the limit set cannot grow,
90*7c478bd9Sstevel@tonic-gate 		 * other sets can but only as long as they remain subsets
91*7c478bd9Sstevel@tonic-gate 		 * of P.  Only immediately after exec holds that P <= L.
92*7c478bd9Sstevel@tonic-gate 		 */
93*7c478bd9Sstevel@tonic-gate 		if (((type == PRIV_LIMIT &&
94*7c478bd9Sstevel@tonic-gate 			!priv_issubset(&pset, &CR_LPRIV(pcr))) ||
95*7c478bd9Sstevel@tonic-gate 		    !priv_issubset(&pset, &CR_OPPRIV(pcr))) &&
96*7c478bd9Sstevel@tonic-gate 		    !priv_issubset(&pset, priv_getset(pcr, type))) {
97*7c478bd9Sstevel@tonic-gate 			mutex_exit(&p->p_crlock);
98*7c478bd9Sstevel@tonic-gate 			crfree(cr);
99*7c478bd9Sstevel@tonic-gate 			return (set_errno(EPERM));
100*7c478bd9Sstevel@tonic-gate 		}
101*7c478bd9Sstevel@tonic-gate 		break;
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 	case PRIV_OFF:
104*7c478bd9Sstevel@tonic-gate 		/* PRIV_OFF is always allowed */
105*7c478bd9Sstevel@tonic-gate 		break;
106*7c478bd9Sstevel@tonic-gate 	}
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate 	/*
109*7c478bd9Sstevel@tonic-gate 	 * OK! everything is cool.
110*7c478bd9Sstevel@tonic-gate 	 * Do cred COW.
111*7c478bd9Sstevel@tonic-gate 	 */
112*7c478bd9Sstevel@tonic-gate 	crcopy_to(pcr, cr);
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate 	/*
115*7c478bd9Sstevel@tonic-gate 	 * If we change the effective, permitted or limit set, we attain
116*7c478bd9Sstevel@tonic-gate 	 * "privilege awareness".
117*7c478bd9Sstevel@tonic-gate 	 */
118*7c478bd9Sstevel@tonic-gate 	if (type != PRIV_INHERITABLE)
119*7c478bd9Sstevel@tonic-gate 		priv_set_PA(cr);
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate 	target = &(CR_PRIVS(cr)->crprivs[type]);
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate 	switch (op) {
124*7c478bd9Sstevel@tonic-gate 	case PRIV_ON:
125*7c478bd9Sstevel@tonic-gate 		priv_union(&pset, target);
126*7c478bd9Sstevel@tonic-gate 		break;
127*7c478bd9Sstevel@tonic-gate 	case PRIV_OFF:
128*7c478bd9Sstevel@tonic-gate 		priv_inverse(&pset);
129*7c478bd9Sstevel@tonic-gate 		priv_intersect(target, &pset);
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate 		/*
132*7c478bd9Sstevel@tonic-gate 		 * Fall-thru to set target and change other process
133*7c478bd9Sstevel@tonic-gate 		 * privilege sets.
134*7c478bd9Sstevel@tonic-gate 		 */
135*7c478bd9Sstevel@tonic-gate 		/*FALLTHRU*/
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate 	case PRIV_SET:
138*7c478bd9Sstevel@tonic-gate 		*target = pset;
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate 		/*
141*7c478bd9Sstevel@tonic-gate 		 * Take privileges no longer permitted out
142*7c478bd9Sstevel@tonic-gate 		 * of other effective sets as well.
143*7c478bd9Sstevel@tonic-gate 		 * Limit set is enforced at exec() time.
144*7c478bd9Sstevel@tonic-gate 		 */
145*7c478bd9Sstevel@tonic-gate 		if (type == PRIV_PERMITTED)
146*7c478bd9Sstevel@tonic-gate 			priv_intersect(&pset, &CR_EPRIV(cr));
147*7c478bd9Sstevel@tonic-gate 		break;
148*7c478bd9Sstevel@tonic-gate 	}
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate 	/*
151*7c478bd9Sstevel@tonic-gate 	 * When we give up privileges not in the inheritable set,
152*7c478bd9Sstevel@tonic-gate 	 * set SNOCD if not already set; first we compute the
153*7c478bd9Sstevel@tonic-gate 	 * privileges removed from P using Diff = (~P') & P
154*7c478bd9Sstevel@tonic-gate 	 * and then we check whether the removed privileges are
155*7c478bd9Sstevel@tonic-gate 	 * a subset of I.  If we retain uid 0, all privileges
156*7c478bd9Sstevel@tonic-gate 	 * are required anyway so don't set SNOCD.
157*7c478bd9Sstevel@tonic-gate 	 */
158*7c478bd9Sstevel@tonic-gate 	if (type == PRIV_PERMITTED && (p->p_flag & SNOCD) == 0 &&
159*7c478bd9Sstevel@tonic-gate 	    cr->cr_uid != 0 && cr->cr_ruid != 0 && cr->cr_suid != 0) {
160*7c478bd9Sstevel@tonic-gate 		priv_set_t diff = CR_OPPRIV(cr);
161*7c478bd9Sstevel@tonic-gate 		priv_inverse(&diff);
162*7c478bd9Sstevel@tonic-gate 		priv_intersect(&CR_OPPRIV(pcr), &diff);
163*7c478bd9Sstevel@tonic-gate 		donocd = !priv_issubset(&diff, &CR_IPRIV(cr));
164*7c478bd9Sstevel@tonic-gate 	} else {
165*7c478bd9Sstevel@tonic-gate 		donocd = B_FALSE;
166*7c478bd9Sstevel@tonic-gate 	}
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate 	p->p_cred = cr;
169*7c478bd9Sstevel@tonic-gate 	mutex_exit(&p->p_crlock);
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate 	if (donocd) {
172*7c478bd9Sstevel@tonic-gate 		mutex_enter(&p->p_lock);
173*7c478bd9Sstevel@tonic-gate 		p->p_flag |= SNOCD;
174*7c478bd9Sstevel@tonic-gate 		mutex_exit(&p->p_lock);
175*7c478bd9Sstevel@tonic-gate 	}
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	crset(p, cr);		/* broadcast to process threads */
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate 	return (0);
180*7c478bd9Sstevel@tonic-gate }
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate /*
183*7c478bd9Sstevel@tonic-gate  * getppriv (priv_ptype_t, priv_set_t *)
184*7c478bd9Sstevel@tonic-gate  */
185*7c478bd9Sstevel@tonic-gate static int
186*7c478bd9Sstevel@tonic-gate getppriv(priv_ptype_t type, priv_set_t *pset)
187*7c478bd9Sstevel@tonic-gate {
188*7c478bd9Sstevel@tonic-gate 	if (!PRIV_VALIDSET(type))
189*7c478bd9Sstevel@tonic-gate 		return (set_errno(EINVAL));
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate 	if (copyout(priv_getset(CRED(), type), pset, sizeof (priv_set_t)) != 0)
192*7c478bd9Sstevel@tonic-gate 		return (set_errno(EFAULT));
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate 	return (0);
195*7c478bd9Sstevel@tonic-gate }
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate static int
198*7c478bd9Sstevel@tonic-gate getprivimplinfo(void *buf, size_t bufsize)
199*7c478bd9Sstevel@tonic-gate {
200*7c478bd9Sstevel@tonic-gate 	int err;
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 	err = copyout(priv_hold_implinfo(), buf, min(bufsize, privinfosize));
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate 	priv_release_implinfo();
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate 	if (err)
207*7c478bd9Sstevel@tonic-gate 		return (set_errno(EFAULT));
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate 	return (0);
210*7c478bd9Sstevel@tonic-gate }
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate /*
213*7c478bd9Sstevel@tonic-gate  * Set privilege flags
214*7c478bd9Sstevel@tonic-gate  *
215*7c478bd9Sstevel@tonic-gate  * For now we cheat: the flags are actually bit masks so we can simplify
216*7c478bd9Sstevel@tonic-gate  * some; we do make sure that the arguments are valid, though.
217*7c478bd9Sstevel@tonic-gate  */
218*7c478bd9Sstevel@tonic-gate 
219*7c478bd9Sstevel@tonic-gate static int
220*7c478bd9Sstevel@tonic-gate setpflags(uint_t flag, uint_t val)
221*7c478bd9Sstevel@tonic-gate {
222*7c478bd9Sstevel@tonic-gate 	cred_t *cr, *pcr;
223*7c478bd9Sstevel@tonic-gate 	proc_t *p = curproc;
224*7c478bd9Sstevel@tonic-gate 	uint_t newflags;
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate 	if (val > 1 || (flag != PRIV_DEBUG && flag != PRIV_AWARE &&
227*7c478bd9Sstevel@tonic-gate 	    flag != __PROC_PROTECT)) {
228*7c478bd9Sstevel@tonic-gate 		return (set_errno(EINVAL));
229*7c478bd9Sstevel@tonic-gate 	}
230*7c478bd9Sstevel@tonic-gate 
231*7c478bd9Sstevel@tonic-gate 	if (flag == __PROC_PROTECT) {
232*7c478bd9Sstevel@tonic-gate 		mutex_enter(&p->p_lock);
233*7c478bd9Sstevel@tonic-gate 		if (val == 0)
234*7c478bd9Sstevel@tonic-gate 			p->p_flag &= ~SNOCD;
235*7c478bd9Sstevel@tonic-gate 		else
236*7c478bd9Sstevel@tonic-gate 			p->p_flag |= SNOCD;
237*7c478bd9Sstevel@tonic-gate 		mutex_exit(&p->p_lock);
238*7c478bd9Sstevel@tonic-gate 		return (0);
239*7c478bd9Sstevel@tonic-gate 	}
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate 	cr = cralloc();
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate 	mutex_enter(&p->p_crlock);
244*7c478bd9Sstevel@tonic-gate 
245*7c478bd9Sstevel@tonic-gate 	pcr = p->p_cred;
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate 	newflags = CR_FLAGS(pcr);
248*7c478bd9Sstevel@tonic-gate 
249*7c478bd9Sstevel@tonic-gate 	if (val != 0)
250*7c478bd9Sstevel@tonic-gate 		newflags |= flag;
251*7c478bd9Sstevel@tonic-gate 	else
252*7c478bd9Sstevel@tonic-gate 		newflags &= ~flag;
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate 	/* No change */
255*7c478bd9Sstevel@tonic-gate 	if (CR_FLAGS(pcr) == newflags) {
256*7c478bd9Sstevel@tonic-gate 		mutex_exit(&p->p_crlock);
257*7c478bd9Sstevel@tonic-gate 		crfree(cr);
258*7c478bd9Sstevel@tonic-gate 		return (0);
259*7c478bd9Sstevel@tonic-gate 	}
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate 	/* Trying to unset PA; if we can't, return an error */
262*7c478bd9Sstevel@tonic-gate 	if (flag == PRIV_AWARE && val == 0 && !priv_can_clear_PA(pcr)) {
263*7c478bd9Sstevel@tonic-gate 		mutex_exit(&p->p_crlock);
264*7c478bd9Sstevel@tonic-gate 		crfree(cr);
265*7c478bd9Sstevel@tonic-gate 		return (set_errno(EPERM));
266*7c478bd9Sstevel@tonic-gate 	}
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate 	/* Committed to changing the flag */
269*7c478bd9Sstevel@tonic-gate 	crcopy_to(pcr, cr);
270*7c478bd9Sstevel@tonic-gate 	if (flag == PRIV_AWARE) {
271*7c478bd9Sstevel@tonic-gate 		if (val != 0)
272*7c478bd9Sstevel@tonic-gate 			priv_set_PA(cr);
273*7c478bd9Sstevel@tonic-gate 		else
274*7c478bd9Sstevel@tonic-gate 			priv_adjust_PA(cr);
275*7c478bd9Sstevel@tonic-gate 	} else {
276*7c478bd9Sstevel@tonic-gate 		CR_FLAGS(cr) = newflags;
277*7c478bd9Sstevel@tonic-gate 	}
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate 	p->p_cred = cr;
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate 	mutex_exit(&p->p_crlock);
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate 	crset(p, cr);
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate 	return (0);
286*7c478bd9Sstevel@tonic-gate }
287*7c478bd9Sstevel@tonic-gate 
288*7c478bd9Sstevel@tonic-gate /*
289*7c478bd9Sstevel@tonic-gate  * Getpflags.  Currently only implements single bit flags.
290*7c478bd9Sstevel@tonic-gate  */
291*7c478bd9Sstevel@tonic-gate static uint_t
292*7c478bd9Sstevel@tonic-gate getpflags(uint_t flag)
293*7c478bd9Sstevel@tonic-gate {
294*7c478bd9Sstevel@tonic-gate 	if (flag != PRIV_DEBUG && flag != PRIV_AWARE)
295*7c478bd9Sstevel@tonic-gate 		return (set_errno(EINVAL));
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate 	return ((CR_FLAGS(CRED()) & flag) != 0);
298*7c478bd9Sstevel@tonic-gate }
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate /*
301*7c478bd9Sstevel@tonic-gate  * Privilege system call entry point
302*7c478bd9Sstevel@tonic-gate  */
303*7c478bd9Sstevel@tonic-gate int
304*7c478bd9Sstevel@tonic-gate privsys(int code, priv_op_t op, priv_ptype_t type, void *buf, size_t bufsize)
305*7c478bd9Sstevel@tonic-gate {
306*7c478bd9Sstevel@tonic-gate 	switch (code) {
307*7c478bd9Sstevel@tonic-gate 	case PRIVSYS_SETPPRIV:
308*7c478bd9Sstevel@tonic-gate 		if (bufsize < sizeof (priv_set_t))
309*7c478bd9Sstevel@tonic-gate 			return (set_errno(ENOMEM));
310*7c478bd9Sstevel@tonic-gate 		return (setppriv(op, type, buf));
311*7c478bd9Sstevel@tonic-gate 	case PRIVSYS_GETPPRIV:
312*7c478bd9Sstevel@tonic-gate 		if (bufsize < sizeof (priv_set_t))
313*7c478bd9Sstevel@tonic-gate 			return (set_errno(ENOMEM));
314*7c478bd9Sstevel@tonic-gate 		return (getppriv(type, buf));
315*7c478bd9Sstevel@tonic-gate 	case PRIVSYS_GETIMPLINFO:
316*7c478bd9Sstevel@tonic-gate 		return (getprivimplinfo(buf, bufsize));
317*7c478bd9Sstevel@tonic-gate 	case PRIVSYS_SETPFLAGS:
318*7c478bd9Sstevel@tonic-gate 		return (setpflags((uint_t)op, (uint_t)type));
319*7c478bd9Sstevel@tonic-gate 	case PRIVSYS_GETPFLAGS:
320*7c478bd9Sstevel@tonic-gate 		return ((int)getpflags((uint_t)op));
321*7c478bd9Sstevel@tonic-gate 
322*7c478bd9Sstevel@tonic-gate 	}
323*7c478bd9Sstevel@tonic-gate 	return (set_errno(EINVAL));
324*7c478bd9Sstevel@tonic-gate }
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL
327*7c478bd9Sstevel@tonic-gate int
328*7c478bd9Sstevel@tonic-gate privsys32(int code, priv_op_t op, priv_ptype_t type, caddr32_t *buf,
329*7c478bd9Sstevel@tonic-gate     size32_t bufsize)
330*7c478bd9Sstevel@tonic-gate {
331*7c478bd9Sstevel@tonic-gate 	return (privsys(code, op, type, (void *)buf, (size_t)bufsize));
332*7c478bd9Sstevel@tonic-gate }
333*7c478bd9Sstevel@tonic-gate #endif
334