1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Privilege implementation.
*
* This file provides the infrastructure for privilege sets and limits
* the number of files that requires to include <sys/cred_impl.h> and/or
* <sys/priv_impl.h>.
*
* The Solaris privilege mechanism has been designed in a
* future proof manner. While the kernel may use fixed size arrays
* and fixed bitmasks and bit values, the representation of those
* is kernel private. All external interfaces as well as K-to-K interfaces
* have been constructed in a manner to provide the maximum flexibility.
*
* There can be X privilege sets each containing Y 32 bit words.
* <X, Y> are constant for a kernel invocation.
*
* As a consequence, all privilege set manipulation happens in functions
* below.
*
*/
#include <sys/systm.h>
#include <sys/ddi.h>
#include <sys/kmem.h>
#include <sys/sunddi.h>
#include <sys/errno.h>
#include <sys/debug.h>
#include <sys/priv_impl.h>
#include <sys/procfs.h>
#include <sys/policy.h>
#include <sys/cred_impl.h>
#include <sys/devpolicy.h>
#include <sys/atomic.h>
/*
* Privilege name to number mapping table consists in the generated
* priv_const.c file. This lock protects against updates of the privilege
* names and counts; all other priv_info fields are read-only.
* The actual protected values are:
* global variable nprivs
* the priv_max field
* the priv_names field
* the priv names info item (cnt/strings)
*/
krwlock_t privinfo_lock;
static boolean_t priv_valid(const cred_t *);
priv_set_t priv_fullset; /* set of all privileges */
priv_set_t priv_unsafe; /* unsafe to exec set-uid root if these are not in L */
/*
* Privilege initialization functions.
* Called from common/os/cred.c when cred_init is called.
*/
void
priv_init(void)
{
#ifdef DEBUG
int alloc_test_priv = 1;
#else
int alloc_test_priv = priv_debug;
#endif
rw_init(&privinfo_lock, NULL, RW_DRIVER, NULL);
PRIV_BASIC_ASSERT(priv_basic);
PRIV_UNSAFE_ASSERT(&priv_unsafe);
priv_fillset(&priv_fullset);
/*
* When booting with priv_debug set or in a DEBUG kernel, then we'll
* add an additional basic privilege and we verify that it is always
* present in E.
*/
if (alloc_test_priv != 0 &&
(priv_basic_test = priv_getbyname("basic_test", PRIV_ALLOC)) >= 0) {
priv_addset(priv_basic, priv_basic_test);
}
devpolicy_init();
}
/* Utility functions: privilege sets as opaque data types */
/*
* Guts of prgetprivsize.
*/
int
priv_prgetprivsize(prpriv_t *tmpl)
{
return (sizeof (prpriv_t) +
PRIV_SETBYTES - sizeof (priv_chunk_t) +
(tmpl ? tmpl->pr_infosize : priv_info->priv_infosize));
}
/*
* Guts of prgetpriv.
*/
void
cred2prpriv(const cred_t *cp, prpriv_t *pr)
{
priv_set_t *psa;
int i;
pr->pr_nsets = PRIV_NSET;
pr->pr_setsize = PRIV_SETSIZE;
pr->pr_infosize = priv_info->priv_infosize;
psa = (priv_set_t *)pr->pr_sets;
for (i = 0; i < PRIV_NSET; i++)
psa[i] = *priv_getset(cp, i);
priv_getinfo(cp, (char *)pr + PRIV_PRPRIV_INFO_OFFSET(pr));
}
/*
* Guts of pr_spriv:
*
* Set the privileges of a process.
*
* In order to set the privileges, the setting process will need to
* have those privileges in its effective set in order to prevent
* specially privileged processes to easily gain additional privileges.
* Pre-existing privileges can be retained. To change any privileges,
* PRIV_PROC_OWNER needs to be asserted.
*
* In formula:
*
* S' <= S || S' <= S + Ea
*
* the new set must either be subset of the old set or a subset of
* the oldset merged with the effective set of the acting process; or just:
*
* S' <= S + Ea
*
* It's not legal to grow the limit set this way.
*
*/
int
priv_pr_spriv(proc_t *p, prpriv_t *prpriv, const cred_t *cr)
{
cred_t *oldcred;
cred_t *newcred;
int i;
int err = EPERM;
cred_priv_t *cp, *ocp;
priv_set_t eset;
ASSERT(MUTEX_HELD(&p->p_lock));
/*
* Set must have proper dimension; infosize must be absent
* or properly sized.
*/
if (prpriv->pr_nsets != PRIV_NSET ||
prpriv->pr_setsize != PRIV_SETSIZE ||
(prpriv->pr_infosize & (sizeof (uint32_t) - 1)) != 0 ||
prpriv->pr_infosize > priv_info->priv_infosize ||
prpriv->pr_infosize < 0)
return (EINVAL);
mutex_exit(&p->p_lock);
if (priv_proc_cred_perm(cr, p, &oldcred, VWRITE) != 0) {
mutex_enter(&p->p_lock);
return (EPERM);
}
newcred = crdup(oldcred);
/* Copy the privilege sets from prpriv to newcred */
bcopy(prpriv->pr_sets, CR_PRIVSETS(newcred), PRIV_SETBYTES);
cp = &newcred->cr_priv;
ocp = &oldcred->cr_priv;
eset = CR_OEPRIV(cr);
priv_intersect(&CR_LPRIV(oldcred), &eset);
/*
* Verify the constraints laid out:
* for the limit set, we require that the new set is a subset
* of the old limit set.
* for all other sets, we require that the new set is either a
* subset of the old set or a subset of the intersection of
* the old limit set and the effective set of the acting process.
*/
for (i = 0; i < PRIV_NSET; i++)
if (!priv_issubset(&cp->crprivs[i], &ocp->crprivs[i]) &&
(i == PRIV_LIMIT || !priv_issubset(&cp->crprivs[i], &eset)))
break;
crfree(oldcred);
if (i < PRIV_NSET || !priv_valid(newcred))
goto err;
/* Load the settable privilege information */
if (prpriv->pr_infosize > 0) {
char *x = (char *)prpriv + PRIV_PRPRIV_INFO_OFFSET(prpriv);
char *lastx = x + prpriv->pr_infosize;
while (x < lastx) {
priv_info_t *pi = (priv_info_t *)x;
priv_info_uint_t *pii;
switch (pi->priv_info_type) {
case PRIV_INFO_FLAGS:
pii = (priv_info_uint_t *)x;
if (pii->info.priv_info_size != sizeof (*pii)) {
err = EINVAL;
goto err;
}
CR_FLAGS(newcred) &= ~PRIV_USER;
CR_FLAGS(newcred) |= (pii->val & PRIV_USER);
break;
default:
err = EINVAL;
goto err;
}
/* Guarantee alignment and forward progress */
if ((pi->priv_info_size & (sizeof (uint32_t) - 1)) ||
pi->priv_info_size < sizeof (*pi) ||
lastx - x > pi->priv_info_size) {
err = EINVAL;
goto err;
}
x += pi->priv_info_size;
}
}
/*
* We'll try to copy the privilege aware flag; but since the
* privileges sets are all individually set, they are set
* as if we're privilege aware. If PRIV_AWARE wasn't set
* or was explicitely unset, we need to set the flag and then
* try to get rid of it.
*/
if ((CR_FLAGS(newcred) & PRIV_AWARE) == 0) {
CR_FLAGS(newcred) |= PRIV_AWARE;
priv_adjust_PA(newcred);
}
mutex_enter(&p->p_crlock);
oldcred = p->p_cred;
p->p_cred = newcred;
mutex_exit(&p->p_crlock);
crfree(oldcred);
mutex_enter(&p->p_lock);
return (0);
err:
crfree(newcred);
mutex_enter(&p->p_lock);
return (err);
}
priv_impl_info_t
*priv_hold_implinfo(void)
{
rw_enter(&privinfo_lock, RW_READER);
return (priv_info);
}
void
priv_release_implinfo(void)
{
rw_exit(&privinfo_lock);
}
size_t
priv_get_implinfo_size(void)
{
return (privinfosize);
}
/*
* Return the nth privilege set
*/
const priv_set_t *
priv_getset(const cred_t *cr, int set)
{
ASSERT(PRIV_VALIDSET(set));
if ((CR_FLAGS(cr) & PRIV_AWARE) == 0)
switch (set) {
case PRIV_EFFECTIVE:
return (&CR_OEPRIV(cr));
case PRIV_PERMITTED:
return (&CR_OPPRIV(cr));
}
return (&CR_PRIVS(cr)->crprivs[set]);
}
/*
* Buf must be allocated by caller and contain sufficient space to
* contain all additional info structures using priv_info.priv_infosize.
* The buffer must be properly aligned.
*/
/*ARGSUSED*/
void
priv_getinfo(const cred_t *cr, void *buf)
{
struct priv_info_uint *ii;
ii = buf;
ii->val = CR_FLAGS(cr);
ii->info.priv_info_size = (uint32_t)sizeof (*ii);
ii->info.priv_info_type = PRIV_INFO_FLAGS;
}
int
priv_getbyname(const char *name, uint_t flag)
{
int i;
int wheld = 0;
int len;
char *p;
if (flag != 0 && flag != PRIV_ALLOC)
return (-EINVAL);
if (strncasecmp(name, "priv_", 5) == 0)
name += 5;
rw_enter(&privinfo_lock, RW_READER);
rescan:
for (i = 0; i < nprivs; i++)
if (strcasecmp(priv_names[i], name) == 0) {
rw_exit(&privinfo_lock);
return (i);
}
if (!wheld) {
if (!(flag & PRIV_ALLOC)) {
rw_exit(&privinfo_lock);
return (-EINVAL);
}
/* check length, validity and available space */
len = strlen(name) + 1;
if (len > PRIVNAME_MAX) {
rw_exit(&privinfo_lock);
return (-ENAMETOOLONG);
}
for (p = (char *)name; *p != '\0'; p++) {
char c = *p;
if (!((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_')) {
rw_exit(&privinfo_lock);
return (-EINVAL);
}
}
if (!rw_tryupgrade(&privinfo_lock)) {
rw_exit(&privinfo_lock);
rw_enter(&privinfo_lock, RW_WRITER);
wheld = 1;
/* Someone may have added our privilege */
goto rescan;
}
}
if (nprivs == MAX_PRIVILEGE || len + privbytes > maxprivbytes) {
rw_exit(&privinfo_lock);
return (-ENOMEM);
}
priv_names[i] = p = priv_str + privbytes;
bcopy(name, p, len);
/* make the priv_names[i] and privilege name globally visible */
membar_producer();
/* adjust priv count and bytes count */
priv_ninfo->cnt = priv_info->priv_max = ++nprivs;
privbytes += len;
rw_exit(&privinfo_lock);
return (i);
}
/*
* We can't afford locking the privileges here because of the locations
* we call this from; so we make sure that the privileges table
* is visible to us; it is made visible before the value of nprivs is
* updated.
*/
const char *
priv_getbynum(int priv)
{
int maxpriv = nprivs;
membar_consumer();
if (priv >= 0 && priv < maxpriv)
return (priv_names[priv]);
return (NULL);
}
const char *
priv_getsetbynum(int setno)
{
if (!PRIV_VALIDSET(setno))
return (NULL);
return (priv_setnames[setno]);
}
/*
* Privilege sanity checking when setting: E <= P.
*/
static boolean_t
priv_valid(const cred_t *cr)
{
return (priv_issubset(&CR_EPRIV(cr), &CR_PPRIV(cr)));
}
/*
* Privilege manipulation functions
*
* Without knowing the details of the privilege set implementation,
* opaque pointers can be used to manipulate sets at will.
*/
void
priv_emptyset(priv_set_t *set)
{
bzero(set, sizeof (*set));
}
void
priv_fillset(priv_set_t *set)
{
int i;
/* memset? */
for (i = 0; i < PRIV_SETSIZE; i++)
set->pbits[i] = ~(priv_chunk_t)0;
}
void
priv_addset(priv_set_t *set, int priv)
{
ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
__PRIV_ASSERT(set, priv);
}
void
priv_delset(priv_set_t *set, int priv)
{
ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
__PRIV_CLEAR(set, priv);
}
boolean_t
priv_ismember(const priv_set_t *set, int priv)
{
ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
return (__PRIV_ISASSERT(set, priv) ? B_TRUE : B_FALSE);
}
#define PRIV_TEST_BODY(test) \
int i; \
\
for (i = 0; i < PRIV_SETSIZE; i++) \
if (!(test)) \
return (B_FALSE); \
\
return (B_TRUE)
boolean_t
priv_isequalset(const priv_set_t *a, const priv_set_t *b)
{
return ((boolean_t)(bcmp(a, b, sizeof (*a)) == 0));
}
boolean_t
priv_isemptyset(const priv_set_t *set)
{
PRIV_TEST_BODY(set->pbits[i] == 0);
}
boolean_t
priv_isfullset(const priv_set_t *set)
{
PRIV_TEST_BODY(set->pbits[i] == ~(priv_chunk_t)0);
}
/*
* Return true if a is a subset of b
*/
boolean_t
priv_issubset(const priv_set_t *a, const priv_set_t *b)
{
PRIV_TEST_BODY((a->pbits[i] | b->pbits[i]) == b->pbits[i]);
}
#define PRIV_CHANGE_BODY(a, op, b) \
int i; \
\
for (i = 0; i < PRIV_SETSIZE; i++) \
a->pbits[i] op b->pbits[i]
/* B = A ^ B */
void
priv_intersect(const priv_set_t *a, priv_set_t *b)
{
/* CSTYLED */
PRIV_CHANGE_BODY(b, &=, a);
}
/* B = A v B */
void
priv_union(const priv_set_t *a, priv_set_t *b)
{
/* CSTYLED */
PRIV_CHANGE_BODY(b, |=, a);
}
/* A = ! A */
void
priv_inverse(priv_set_t *a)
{
PRIV_CHANGE_BODY(a, = ~, a);
}
/*
* Can the source cred act on the target credential?
*
* We will you allow to gain uids this way but not privileges.
*/
int
priv_proc_cred_perm(const cred_t *scr, proc_t *tp, cred_t **pcr, int mode)
{
const priv_set_t *eset;
int idsmatch;
cred_t *tcr;
int res = 0;
/* prevent the cred from going away */
mutex_enter(&tp->p_crlock);
crhold(tcr = tp->p_cred);
mutex_exit(&tp->p_crlock);
if (scr == tcr && !(tp->p_flag & SNOCD))
goto out;
idsmatch = (scr->cr_uid == tcr->cr_uid &&
scr->cr_uid == tcr->cr_ruid &&
scr->cr_uid == tcr->cr_suid &&
scr->cr_gid == tcr->cr_gid &&
scr->cr_gid == tcr->cr_rgid &&
scr->cr_gid == tcr->cr_sgid &&
!(tp->p_flag & SNOCD));
/*
* Source credential must have the proc_zone privilege if referencing
* a process in another zone.
*/
if (scr->cr_zone != tcr->cr_zone && secpolicy_proc_zone(scr) != 0) {
res = EACCES;
goto out;
}
if (!(mode & VWRITE)) {
if (!idsmatch && secpolicy_proc_owner(scr, tcr, 0) != 0)
res = EACCES;
goto out;
}
/*
* For writing, the effective set of scr must dominate all sets of tcr,
* We test Pt <= Es (Et <= Pt so no need to test) and It <= Es
* The Limit set of scr must be a superset of the limitset of
* tcr.
*/
eset = &CR_OEPRIV(scr);
if (!priv_issubset(&CR_IPRIV(tcr), eset) ||
!priv_issubset(&CR_OPPRIV(tcr), eset) ||
!priv_issubset(&CR_LPRIV(tcr), &CR_LPRIV(scr)) ||
!idsmatch && secpolicy_proc_owner(scr, tcr, mode) != 0)
res = EACCES;
out:
if (res == 0 && pcr != NULL)
*pcr = tcr;
else
crfree(tcr);
return (res);
}
/*
* Set the privilege aware bit, adding L to E/P if necessary.
* Each time we set it, we also clear PRIV_AWARE_RESET.
*/
void
priv_set_PA(cred_t *cr)
{
ASSERT(cr->cr_ref <= 2);
if ((CR_FLAGS(cr) & (PRIV_AWARE|PRIV_AWARE_RESET)) == PRIV_AWARE)
return;
CR_FLAGS(cr) |= PRIV_AWARE;
CR_FLAGS(cr) &= ~PRIV_AWARE_RESET;
if (cr->cr_uid == 0)
priv_union(&CR_LPRIV(cr), &CR_EPRIV(cr));
if (cr->cr_uid == 0 || cr->cr_suid == 0 || cr->cr_ruid == 0)
priv_union(&CR_LPRIV(cr), &CR_PPRIV(cr));
}
boolean_t
priv_can_clear_PA(const cred_t *cr)
{
/*
* We can clear PA in the following cases:
*
* None of the uids are 0.
* Any uid == 0 and P == L and (Euid != 0 or E == L)
*/
return ((cr->cr_suid != 0 && cr->cr_ruid != 0 && cr->cr_uid != 0) ||
priv_isequalset(&CR_PPRIV(cr), &CR_LPRIV(cr)) &&
(cr->cr_uid != 0 || priv_isequalset(&CR_EPRIV(cr), &CR_LPRIV(cr))));
}
/*
* Clear privilege aware bit if it is an idempotent operation and by
* clearing it the process cannot get to uid 0 and all privileges.
*
* This function should be called with caution as it may cause "E" to be
* lost once a processes assumes euid 0 again.
*/
void
priv_adjust_PA(cred_t *cr)
{
ASSERT(cr->cr_ref <= 2);
if (!(CR_FLAGS(cr) & PRIV_AWARE) ||
!priv_can_clear_PA(cr)) {
CR_FLAGS(cr) &= ~PRIV_AWARE_RESET;
return;
}
if (CR_FLAGS(cr) & PRIV_AWARE_INHERIT)
return;
/*
* We now need to adjust P/E in those cases when uids
* are zero; the rules are P' = I & L, E' = I & L;
* but since P = L and E = L, we can use P &= I, E &= I,
* depending on which uids are 0.
*/
if (cr->cr_suid == 0 || cr->cr_ruid == 0 || cr->cr_uid == 0) {
if (cr->cr_uid == 0)
priv_intersect(&CR_IPRIV(cr), &CR_EPRIV(cr));
priv_intersect(&CR_IPRIV(cr), &CR_PPRIV(cr));
}
CR_FLAGS(cr) &= ~(PRIV_AWARE|PRIV_AWARE_RESET);
}
/*
* Reset privilege aware bit if so requested by setting the PRIV_AWARE_RESET
* flag.
*/
void
priv_reset_PA(cred_t *cr, boolean_t finalize)
{
ASSERT(cr->cr_ref <= 2);
if ((CR_FLAGS(cr) & (PRIV_AWARE|PRIV_AWARE_RESET)) !=
(PRIV_AWARE|PRIV_AWARE_RESET)) {
CR_FLAGS(cr) &= ~PRIV_AWARE_RESET;
return;
}
/*
* When PRIV_AWARE_RESET is enabled, any change of uids causes
* a change to the P and E sets. Bracketing with
* seteuid(0) ... seteuid(uid)/setreuid(-1, 0) .. setreuid(-1, uid)
* will cause the privilege sets "do the right thing.".
* When the change of the uid is "final", e.g., by using setuid(uid),
* or setreuid(uid, uid) or when the last set*uid() call causes all
* uids to be the same, we set P and E to I & L, like when you exec.
* We make an exception when all the uids are 0; this is required
* when we login as root as in that particular case we cannot
* make a distinction between seteuid(0) and seteuid(uid).
* We rely on seteuid/setreuid/setuid to tell us with the
* "finalize" argument that we no longer expect new uid changes,
* cf. setreuid(uid, uid) and setuid(uid).
*/
if (cr->cr_suid == cr->cr_ruid && cr->cr_suid == cr->cr_uid) {
if (finalize || cr->cr_uid != 0) {
CR_EPRIV(cr) = CR_IPRIV(cr);
priv_intersect(&CR_LPRIV(cr), &CR_EPRIV(cr));
CR_PPRIV(cr) = CR_EPRIV(cr);
CR_FLAGS(cr) &= ~(PRIV_AWARE|PRIV_AWARE_RESET);
} else {
CR_EPRIV(cr) = CR_PPRIV(cr);
}
} else if (cr->cr_uid != 0 && (cr->cr_ruid == 0 || cr->cr_suid == 0)) {
CR_EPRIV(cr) = CR_IPRIV(cr);
priv_intersect(&CR_LPRIV(cr), &CR_EPRIV(cr));
}
}
|