linux/kernel/cred.c
<<
>>
Prefs
   1/* Task credentials management - see Documentation/security/credentials.txt
   2 *
   3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
   4 * Written by David Howells (dhowells@redhat.com)
   5 *
   6 * This program is free software; you can redistribute it and/or
   7 * modify it under the terms of the GNU General Public Licence
   8 * as published by the Free Software Foundation; either version
   9 * 2 of the Licence, or (at your option) any later version.
  10 */
  11#include <linux/export.h>
  12#include <linux/cred.h>
  13#include <linux/slab.h>
  14#include <linux/sched.h>
  15#include <linux/key.h>
  16#include <linux/keyctl.h>
  17#include <linux/init_task.h>
  18#include <linux/security.h>
  19#include <linux/binfmts.h>
  20#include <linux/cn_proc.h>
  21
  22#if 0
  23#define kdebug(FMT, ...) \
  24        printk("[%-5.5s%5u] "FMT"\n", current->comm, current->pid ,##__VA_ARGS__)
  25#else
  26#define kdebug(FMT, ...) \
  27        no_printk("[%-5.5s%5u] "FMT"\n", current->comm, current->pid ,##__VA_ARGS__)
  28#endif
  29
  30static struct kmem_cache *cred_jar;
  31
  32/*
  33 * The initial credentials for the initial task
  34 */
  35struct cred init_cred = {
  36        .usage                  = ATOMIC_INIT(4),
  37#ifdef CONFIG_DEBUG_CREDENTIALS
  38        .subscribers            = ATOMIC_INIT(2),
  39        .magic                  = CRED_MAGIC,
  40#endif
  41        .uid                    = GLOBAL_ROOT_UID,
  42        .gid                    = GLOBAL_ROOT_GID,
  43        .suid                   = GLOBAL_ROOT_UID,
  44        .sgid                   = GLOBAL_ROOT_GID,
  45        .euid                   = GLOBAL_ROOT_UID,
  46        .egid                   = GLOBAL_ROOT_GID,
  47        .fsuid                  = GLOBAL_ROOT_UID,
  48        .fsgid                  = GLOBAL_ROOT_GID,
  49        .securebits             = SECUREBITS_DEFAULT,
  50        .cap_inheritable        = CAP_EMPTY_SET,
  51        .cap_permitted          = CAP_FULL_SET,
  52        .cap_effective          = CAP_FULL_SET,
  53        .cap_bset               = CAP_FULL_SET,
  54        .user                   = INIT_USER,
  55        .user_ns                = &init_user_ns,
  56        .group_info             = &init_groups,
  57};
  58
  59static inline void set_cred_subscribers(struct cred *cred, int n)
  60{
  61#ifdef CONFIG_DEBUG_CREDENTIALS
  62        atomic_set(&cred->subscribers, n);
  63#endif
  64}
  65
  66static inline int read_cred_subscribers(const struct cred *cred)
  67{
  68#ifdef CONFIG_DEBUG_CREDENTIALS
  69        return atomic_read(&cred->subscribers);
  70#else
  71        return 0;
  72#endif
  73}
  74
  75static inline void alter_cred_subscribers(const struct cred *_cred, int n)
  76{
  77#ifdef CONFIG_DEBUG_CREDENTIALS
  78        struct cred *cred = (struct cred *) _cred;
  79
  80        atomic_add(n, &cred->subscribers);
  81#endif
  82}
  83
  84/*
  85 * The RCU callback to actually dispose of a set of credentials
  86 */
  87static void put_cred_rcu(struct rcu_head *rcu)
  88{
  89        struct cred *cred = container_of(rcu, struct cred, rcu);
  90
  91        kdebug("put_cred_rcu(%p)", cred);
  92
  93#ifdef CONFIG_DEBUG_CREDENTIALS
  94        if (cred->magic != CRED_MAGIC_DEAD ||
  95            atomic_read(&cred->usage) != 0 ||
  96            read_cred_subscribers(cred) != 0)
  97                panic("CRED: put_cred_rcu() sees %p with"
  98                      " mag %x, put %p, usage %d, subscr %d\n",
  99                      cred, cred->magic, cred->put_addr,
 100                      atomic_read(&cred->usage),
 101                      read_cred_subscribers(cred));
 102#else
 103        if (atomic_read(&cred->usage) != 0)
 104                panic("CRED: put_cred_rcu() sees %p with usage %d\n",
 105                      cred, atomic_read(&cred->usage));
 106#endif
 107
 108        security_cred_free(cred);
 109        key_put(cred->session_keyring);
 110        key_put(cred->process_keyring);
 111        key_put(cred->thread_keyring);
 112        key_put(cred->request_key_auth);
 113        if (cred->group_info)
 114                put_group_info(cred->group_info);
 115        free_uid(cred->user);
 116        put_user_ns(cred->user_ns);
 117        kmem_cache_free(cred_jar, cred);
 118}
 119
 120/**
 121 * __put_cred - Destroy a set of credentials
 122 * @cred: The record to release
 123 *
 124 * Destroy a set of credentials on which no references remain.
 125 */
 126void __put_cred(struct cred *cred)
 127{
 128        kdebug("__put_cred(%p{%d,%d})", cred,
 129               atomic_read(&cred->usage),
 130               read_cred_subscribers(cred));
 131
 132        BUG_ON(atomic_read(&cred->usage) != 0);
 133#ifdef CONFIG_DEBUG_CREDENTIALS
 134        BUG_ON(read_cred_subscribers(cred) != 0);
 135        cred->magic = CRED_MAGIC_DEAD;
 136        cred->put_addr = __builtin_return_address(0);
 137#endif
 138        BUG_ON(cred == current->cred);
 139        BUG_ON(cred == current->real_cred);
 140
 141        call_rcu(&cred->rcu, put_cred_rcu);
 142}
 143EXPORT_SYMBOL(__put_cred);
 144
 145/*
 146 * Clean up a task's credentials when it exits
 147 */
 148void exit_creds(struct task_struct *tsk)
 149{
 150        struct cred *cred;
 151
 152        kdebug("exit_creds(%u,%p,%p,{%d,%d})", tsk->pid, tsk->real_cred, tsk->cred,
 153               atomic_read(&tsk->cred->usage),
 154               read_cred_subscribers(tsk->cred));
 155
 156        cred = (struct cred *) tsk->real_cred;
 157        tsk->real_cred = NULL;
 158        validate_creds(cred);
 159        alter_cred_subscribers(cred, -1);
 160        put_cred(cred);
 161
 162        cred = (struct cred *) tsk->cred;
 163        tsk->cred = NULL;
 164        validate_creds(cred);
 165        alter_cred_subscribers(cred, -1);
 166        put_cred(cred);
 167}
 168
 169/**
 170 * get_task_cred - Get another task's objective credentials
 171 * @task: The task to query
 172 *
 173 * Get the objective credentials of a task, pinning them so that they can't go
 174 * away.  Accessing a task's credentials directly is not permitted.
 175 *
 176 * The caller must also make sure task doesn't get deleted, either by holding a
 177 * ref on task or by holding tasklist_lock to prevent it from being unlinked.
 178 */
 179const struct cred *get_task_cred(struct task_struct *task)
 180{
 181        const struct cred *cred;
 182
 183        rcu_read_lock();
 184
 185        do {
 186                cred = __task_cred((task));
 187                BUG_ON(!cred);
 188        } while (!atomic_inc_not_zero(&((struct cred *)cred)->usage));
 189
 190        rcu_read_unlock();
 191        return cred;
 192}
 193
 194/*
 195 * Allocate blank credentials, such that the credentials can be filled in at a
 196 * later date without risk of ENOMEM.
 197 */
 198struct cred *cred_alloc_blank(void)
 199{
 200        struct cred *new;
 201
 202        new = kmem_cache_zalloc(cred_jar, GFP_KERNEL);
 203        if (!new)
 204                return NULL;
 205
 206        atomic_set(&new->usage, 1);
 207#ifdef CONFIG_DEBUG_CREDENTIALS
 208        new->magic = CRED_MAGIC;
 209#endif
 210
 211        if (security_cred_alloc_blank(new, GFP_KERNEL) < 0)
 212                goto error;
 213
 214        return new;
 215
 216error:
 217        abort_creds(new);
 218        return NULL;
 219}
 220
 221/**
 222 * prepare_creds - Prepare a new set of credentials for modification
 223 *
 224 * Prepare a new set of task credentials for modification.  A task's creds
 225 * shouldn't generally be modified directly, therefore this function is used to
 226 * prepare a new copy, which the caller then modifies and then commits by
 227 * calling commit_creds().
 228 *
 229 * Preparation involves making a copy of the objective creds for modification.
 230 *
 231 * Returns a pointer to the new creds-to-be if successful, NULL otherwise.
 232 *
 233 * Call commit_creds() or abort_creds() to clean up.
 234 */
 235struct cred *prepare_creds(void)
 236{
 237        struct task_struct *task = current;
 238        const struct cred *old;
 239        struct cred *new;
 240
 241        validate_process_creds();
 242
 243        new = kmem_cache_alloc(cred_jar, GFP_KERNEL);
 244        if (!new)
 245                return NULL;
 246
 247        kdebug("prepare_creds() alloc %p", new);
 248
 249        old = task->cred;
 250        memcpy(new, old, sizeof(struct cred));
 251
 252        atomic_set(&new->usage, 1);
 253        set_cred_subscribers(new, 0);
 254        get_group_info(new->group_info);
 255        get_uid(new->user);
 256        get_user_ns(new->user_ns);
 257
 258#ifdef CONFIG_KEYS
 259        key_get(new->session_keyring);
 260        key_get(new->process_keyring);
 261        key_get(new->thread_keyring);
 262        key_get(new->request_key_auth);
 263#endif
 264
 265#ifdef CONFIG_SECURITY
 266        new->security = NULL;
 267#endif
 268
 269        if (security_prepare_creds(new, old, GFP_KERNEL) < 0)
 270                goto error;
 271        validate_creds(new);
 272        return new;
 273
 274error:
 275        abort_creds(new);
 276        return NULL;
 277}
 278EXPORT_SYMBOL(prepare_creds);
 279
 280/*
 281 * Prepare credentials for current to perform an execve()
 282 * - The caller must hold ->cred_guard_mutex
 283 */
 284struct cred *prepare_exec_creds(void)
 285{
 286        struct cred *new;
 287
 288        new = prepare_creds();
 289        if (!new)
 290                return new;
 291
 292#ifdef CONFIG_KEYS
 293        /* newly exec'd tasks don't get a thread keyring */
 294        key_put(new->thread_keyring);
 295        new->thread_keyring = NULL;
 296
 297        /* inherit the session keyring; new process keyring */
 298        key_put(new->process_keyring);
 299        new->process_keyring = NULL;
 300#endif
 301
 302        return new;
 303}
 304
 305/*
 306 * Copy credentials for the new process created by fork()
 307 *
 308 * We share if we can, but under some circumstances we have to generate a new
 309 * set.
 310 *
 311 * The new process gets the current process's subjective credentials as its
 312 * objective and subjective credentials
 313 */
 314int copy_creds(struct task_struct *p, unsigned long clone_flags)
 315{
 316        struct cred *new;
 317        int ret;
 318
 319        if (
 320#ifdef CONFIG_KEYS
 321                !p->cred->thread_keyring &&
 322#endif
 323                clone_flags & CLONE_THREAD
 324            ) {
 325                p->real_cred = get_cred(p->cred);
 326                get_cred(p->cred);
 327                alter_cred_subscribers(p->cred, 2);
 328                kdebug("share_creds(%p{%d,%d})",
 329                       p->cred, atomic_read(&p->cred->usage),
 330                       read_cred_subscribers(p->cred));
 331                atomic_inc(&p->cred->user->processes);
 332                return 0;
 333        }
 334
 335        new = prepare_creds();
 336        if (!new)
 337                return -ENOMEM;
 338
 339        if (clone_flags & CLONE_NEWUSER) {
 340                ret = create_user_ns(new);
 341                if (ret < 0)
 342                        goto error_put;
 343        }
 344
 345#ifdef CONFIG_KEYS
 346        /* new threads get their own thread keyrings if their parent already
 347         * had one */
 348        if (new->thread_keyring) {
 349                key_put(new->thread_keyring);
 350                new->thread_keyring = NULL;
 351                if (clone_flags & CLONE_THREAD)
 352                        install_thread_keyring_to_cred(new);
 353        }
 354
 355        /* The process keyring is only shared between the threads in a process;
 356         * anything outside of those threads doesn't inherit.
 357         */
 358        if (!(clone_flags & CLONE_THREAD)) {
 359                key_put(new->process_keyring);
 360                new->process_keyring = NULL;
 361        }
 362#endif
 363
 364        atomic_inc(&new->user->processes);
 365        p->cred = p->real_cred = get_cred(new);
 366        alter_cred_subscribers(new, 2);
 367        validate_creds(new);
 368        return 0;
 369
 370error_put:
 371        put_cred(new);
 372        return ret;
 373}
 374
 375static bool cred_cap_issubset(const struct cred *set, const struct cred *subset)
 376{
 377        const struct user_namespace *set_ns = set->user_ns;
 378        const struct user_namespace *subset_ns = subset->user_ns;
 379
 380        /* If the two credentials are in the same user namespace see if
 381         * the capabilities of subset are a subset of set.
 382         */
 383        if (set_ns == subset_ns)
 384                return cap_issubset(subset->cap_permitted, set->cap_permitted);
 385
 386        /* The credentials are in a different user namespaces
 387         * therefore one is a subset of the other only if a set is an
 388         * ancestor of subset and set->euid is owner of subset or one
 389         * of subsets ancestors.
 390         */
 391        for (;subset_ns != &init_user_ns; subset_ns = subset_ns->parent) {
 392                if ((set_ns == subset_ns->parent)  &&
 393                    uid_eq(subset_ns->owner, set->euid))
 394                        return true;
 395        }
 396
 397        return false;
 398}
 399
 400/**
 401 * commit_creds - Install new credentials upon the current task
 402 * @new: The credentials to be assigned
 403 *
 404 * Install a new set of credentials to the current task, using RCU to replace
 405 * the old set.  Both the objective and the subjective credentials pointers are
 406 * updated.  This function may not be called if the subjective credentials are
 407 * in an overridden state.
 408 *
 409 * This function eats the caller's reference to the new credentials.
 410 *
 411 * Always returns 0 thus allowing this function to be tail-called at the end
 412 * of, say, sys_setgid().
 413 */
 414int commit_creds(struct cred *new)
 415{
 416        struct task_struct *task = current;
 417        const struct cred *old = task->real_cred;
 418
 419        kdebug("commit_creds(%p{%d,%d})", new,
 420               atomic_read(&new->usage),
 421               read_cred_subscribers(new));
 422
 423        BUG_ON(task->cred != old);
 424#ifdef CONFIG_DEBUG_CREDENTIALS
 425        BUG_ON(read_cred_subscribers(old) < 2);
 426        validate_creds(old);
 427        validate_creds(new);
 428#endif
 429        BUG_ON(atomic_read(&new->usage) < 1);
 430
 431        get_cred(new); /* we will require a ref for the subj creds too */
 432
 433        /* dumpability changes */
 434        if (!uid_eq(old->euid, new->euid) ||
 435            uid,  426s="+code=new" classg"sref">old->euid, new->();
 434        if (!uid_eq(old->euid, new->new)
 435            uid,  426old->euid, new->ENOMEM;
bool "prepare_creds() alloc %p&-> 338
BUG_ON(cred *4LONE_NEWUSER) {
ui" namel+code=new" class">ui" namel+3        BUG_ON((new);
BUG_ON(ret < 0)
date_creds(error_put;
 343        }
 344
/s="comment">/* inherit the session keyring;4 class="s4ef">CONFIG_KEYS
 434        if (!euid, (euid, ref">cred *
 433"+code=new" clasa>  fsf="_"> 433"3        
 435            uid,ref="+code=euid" class="sref">euid, (euid, ref">cred *) {
 433"+code=new" clasa>  fsg="_"> 433"3        4hread_keyring);
NULL;
/* inherit the session keyring;4lass="sre4">CLONE_THREAD)
f">user * We thread bss="checkn class="comment"> * @new: The crede=new" cl4ss="sref">new);
 412 * name="L354"> 353        }
/* inherit the session keyring;4s="line" 4ame="L354"> 354
 366        alter_cred_subscribers(atomic_read(&->cred * 364        atomic_inc(&new->user->         */
BUG_ON        BUG_ON(task-&string">"prepare_creds() alloc %p&t;)) {
BUG_ON        BUG_ON("prepare_creds() alloc %p&t;p4ocess_keyring);
atomic_read(&->cred *NULL;
 364dee     new->user-> 361        }
 366        ( 362#endif
 363
        /*  class="s4ef">processes);
 434        if (!euid, ->new);
 434        if (!euid, new->new, 2);
 434        if (!euid, new->new);
 434        if (!euid, (euid, ref">cred * 368<4a>        return 0;
u_="_"onnecto"+code=new" clasf">u_="_"onnecto"3        clone_flaPROC_EVENT_UI"a>-> 369
error_put:
 435            uid,ref="+code=euid" class="sref">euid, ->new);
 435            uid,ref="+code=euid" class="sref">euid, s="+code=new" classg"sref">o429" id="L429" cf="+code=cred" class="sre_read(&new->ret;
 435            uid,ref="+code=euid" class="sref">euid, o429" id="L429" cf="+code=cred" class="sre_read(&new-> 373}
 435            uid,ref="+code=euid" class="sref">euid, (euid, ref">cred * 374
u_="_"onnecto"+code=new" clasf">u_="_"onnecto"3        clone_flaPROC_EVENT_GI"a>->subset)
 376{
ns b"L40a>        /* ns" class4"sref">user_ns;
 371        validate_creds(user_ns;
 371        validate_creds( 379

pEXPORT_SYMBO">         414int (         */
subset_ns)
 400);
 404 * commit_creds - Install new credentialss="line" 4ame="L385"> 385
 hat were go/a> * @new: The credferent us4r namespaces
 400
 40417" iL417="conameunlockcommss="line" name="L400"> 400
 * commi> 412 *  of subse4s ancestors.
        /* ="comment4>         */
 366      borine" na>    ref="+code=commit_creds" class="sref">commit_creds(struct cred *parent) {
par4nt)  &&
 419        kdebug("commit_creds(%p{%d,%d})", euid))
BUG_ON(atomic_read(&ne", true;
( 421               read_cred_subscribers( 395        }
 396
 424#ifdef false;
 425        BUG_ON(read_cred_sutask0bscribers( 398}
 399
 425        BUG_ON(atomic_read(&new->/**
 371        put_cred(
pEXPORT_SYMBO">         366      borine" na>   ">put_cred(euid))

 400
 * cf">user> * updated.  This fss="line" name="L400"> 400 396
 402 * @new: The cre5n an over5idden state.
 408<5pan class5"comment"> *
 * updated.  This fu="comment"> * ass="line" name="L408"> 408<5o the new5credentials.
user,368" id/a> *5pan class5"comment"> *
        /*5tail-call5d at the end
 417        const struct     17" id="L417" class="line" name="L417"> 417        const struct cred *-> */
 417        const struct cred *task">BUG_ON(new)
 415{
 419        kdebug("commit_creds(%p{%d,%d})", current;
BUG_ON(atomic_read(&ne", real_cred;
( 421               read_cred_subscribers( 418
new,
 426        validate_creds(usage),
 427        validate_creds(new));
real_cred = get_cred( 422
 366        alter_cred_sub>old);
BUG_ON        task">BUG_ON("prepare_creds() alloc %p&t; 366        old) < 2);
old);
 419        kdebug("commit_cre new);
(BUG_ON(ne",  428#endif
( 421               validgt;) < 1);
valit; 430

pEXPORT_SYMBO">           gt; 432

 400euid) ||
 * updated.  This fu=e" namess="line" name="L400"> 400();
line" name="L402"> 402 * @new: The cre5i=old" cl5ass="sref">new)
 400ENOMEM;
 * updated.  This fu 40"linine" n,ss="line" name="L400"> 400 338
5LONE_NEWUSER) {
        /*5e=new" cl5ss="sref">new);
             e" ine" na>    17" id="L417" class="line" name="L417"> 417        const struct valid /*5ethe subj5ef">ret < 0)
error_put;
 417        const struct cred *task">BUG_ON( 343        }
 344
 419        kdebug("commit_cre CONFIG_KEYS
(BUG_ON(ne", 
( 421               validgt;
) {
 426        validate_creds(5hread_keyring);
 426        NULL;
 366        CLONE_THREAD)
BUG_ON        task">BUG_ON("pre_creds" class="sref">validate_creds(new);
 366         353        }
 371         354

pEXPORT_SYMBO">                     e" ine" na>   date_creds(
         */
 400)) {
is ispan ="ed.  This fustufhe two credentials are in the sam5="sref">p5ocess_keyring);
        /*5=NULL" cl5ss="sref">NULL;
           __el/cr_ON(           de=t_>    voidd /*5name="L365"> 361        }
 362#endif
        /*5=ame="L355ame="L363"> 363
BUG_ONcred *&sizeof ref="+code=commit_creds" class="sref">commit_crede", processes);
"preSLAB_HWCACHE_ALIG"line" name="L42SLAB_HWCACHE_ALIG"el/c|ring">"preSLAB_PANICline" name="L42SLAB_PANICa>-&string">"preNUL" class="sref">pNUL">   date_creds(new);
new, 2);
new);
 400 368<5a>        return 0;
sub_400"> ne" n - Pre>sub       04"> 404    rvi of credentials to the current tas5s="line" 5ame="L369"> 369
 402nss="cof credentials to the current tas5sNULL" cl5ref">error_put:
new);
sub       04"> 404    rvi oe" name=ca"Ln =n02ret;
 373}
 * updateo  Bx        * the capabilities of subs5s="line" 5ame="L374"> 374
subset)
me= cld tocf">vamenacbaspaw);  376{
me=supplin ,Ln =n0>); user_ns;
);rwispan =y>user_ns;
 379
 409 433an =sateo  ro

 * This function  403<5" class="5ref">subset_ns)
<"sref">">BUGde=t_w set o_mu Bxneats the caller's reference 5s="line" 5cap_permitted);
        /*5s="line" 5ame="L385"> 385
 417        const struct sub_400"> ne" nne" name="L371">re>sub_400"> ne" n916" id="L416" class="line" name="L416"> 416        struct  416 daemonvalid /*5ferent us5r namespaces

 417        const struct valiate_creds(
 417        const struct 
cred *BUG_ON"preGFP_KERNE" class="sref">pGFP_KERNE">   date_creds(parent) {
cred *par5nt)  &&
pNUL">   ate_creds(euid))
true;
 419         ne" n()e 411cfef">kdlass="string">"commit_creds(%p{%d,%d})date_creds( 395        }
 396
 416 daemonvalid /*5alse" cla5s="sref">false;
"pre_creds" class="sref">valiref">cred *rea     ame="L417"> 417>rea     ame=3         416 daemonvalidate_creds( 398}
 399
"pre_creds" class="sref">valiref">cred *reaame="L417"> 417>reaame=3 href="+code=atomic_aame="L417"> 417aame=validate_creds(/**
parent) {
 426        validate_creds(euid))
valiate_creds(BUG_ol" class="sref">bl">BUG_ol"3 href="+code=atomic_read" class="sref">atomic_read(&nst>
 366     sreaame=" name="L366href="+code=validateclass="sref">alter_cred_sub0bscribers( 396
reaf="+code=new" clas>reaf="href="+code=validateclass="sref">alter_cred_s_read(&(false;
 366     g n != &_n6href="+code=validateclass="sref">alter_cred_s_read(& 366     != &_n6hrefrscribers( 398}
 366     g n group_infohref="+code=validateclass="sref">alter_cred_s_read(& 366     group_infohrefrscribers( *
 424#ifdef 
euid,  366     srss="c_="commevaliref">cred *pNUL">   ate_creds(euid, user_="comme"> 366     f">user_="commevaliref">cred *pNUL">   ate_creds( */
euid, /_="comme"> 366     ent">/_="commevaliref">cred *pNUL">   ate_creds(new)
euid, cred *pNUL">   ate_creds( 415{
euid,  366     jit_="commevaliref">cred * 366     KEY_REQKEY_DEFL_THREADeKEYRING>   ate_creds(current;
real_cred;
 418
new,
euid,  366     sr"srL43valiref">cred *pNUL">   ate_creds(usage),
new));
, re>sub_e" name="L426"> 426re>sub_e" nahref="+code=validateclass="sref">alter_cred_subnst struct valistring">"preGFP_KERNE" class="sref">pGFP_KERNE">   dw-0d /*6s="line" 6ame="L422"> 422
"preerro"+code=new" claserro">   ate_creds(old);
CONFIG_D6BUG_CREDENTIALS
 371        validate_creds(old) < 2);
 427        validate_creds(old);
new);
 428#endif
"preerro"+code=new" claserro">   :red.c#L418" id="L418" cla6ss="sref"6usage) < 1);
 371        put_cred( 430
 371        validate_creds(pNUL">   ate_creds( 432

pEXPORT_SYMBO">         ne" nne" name="L371">re>sub_400"> ne" n9(euid) ||
();
 400new)
 404 400ENOMEM;
 40    400 338
line" LSM  4006LONE_NEWUSER) {
 400new);
 404 * upda3<="line" name="L400"> 400ret < 0)
 404error_put;
        /*6name="L346"> 343        }
 366     srease"srL43_le" name>    ="L417" class="line" name="L417"> 417        const struct "preucreds too *>     !32el/creuid, /*6s="line" 6ame="L344"> 344
CONFIG_KEYS
 nact_aame="L426"> 426 nact_aahref="+code=validateclass="sref">alter_cred_subnst struct 

pEXPORT_SYMBO">         366     srease"srL43_le" name>   date_creds(6hread_keyring);
 400NULL;
 404 400CLONE_THREAD)
 40    400new);
 40gener   et);  353        }
 354
 404 * upda3<="line" name="L400"> 400
 404 400
 40ba3<="line" name="L400"> 400         */
reted by t); LSMneats the caller's reference 6n" name="6LONE_THREAD)) {
        /*6="sref">p6ocess_keyring);
 366     srease"srL43_le" name_from_ctx>    ="L417" class="line" name="L417"> 417        const struct    d /*6=NULL" cl6ss="sref">NULL;
 361        }
     !32el/creuid,  362#endif
brl"3( 363
processes);
brl"3cred *   ubnst struct  416 strlen>           ),  href="+code=atomic_se"="+code=new" classe"="validate_creds(new);
, brl"3-0d /*6ew" class6"sref">new, 2);
brl"3(new);
 368<6a>        return 0;
 366     srease"srL43_le" name>    "+code=validateclass="sref">alter_cred_subnst struct  369
error_put:
pEXPORT_SYMBO">         366     srease"srL43_le" name_from_ctx>   date_creds(new);
ret;
 400 373}
ine      04"> 404 400 374
 40    400subset)
fromss="line" name="L400"> 400 376{
 400user_ns;
 433an = LSM file ame  ="coeo  Bx >ine      04"> 404 402 400 368<6"sref">user_ns;
 400 379
asp hat in="+neats the caller's reference 6sNULL" cl6space see if
        /*6t are a s6bset of set.
 366     sreaame    files_as>    ="L417" class="line" name="L417"> 417        const struct /*6s" name="6>         */
subset_ns)
euid, cred *euid, );
euid, cred *euid,  385
 name    files_as"> 366     sr"srL43_400"> name    files_as>    "+code=validateclass="sref">alter_cred_subnst struct 

pEXPORT_SYMBO">         366     sreaame    files_as>   date_creds( 368<6ubset or one

 424#ifdef          */
parent) {
 424#ifdefboolel/creuid,   "L417"> 417    s_are_in/a>  >    17" id="L417" class="line" name="L417"> 417        const struct  417        d /*6sref">par6nt)  &&
euid))
,  417        ref">euid, cred */*6s="line" 6ss="sref">true;
( 395        }
 424#ifdef ( 396
 400false;
 40ref"> 40  411c_blank() oass="line" name="L400"> 400 398}
re>sub_e" na() 68" idld an erro"neats the caller's reference 7s="line" 7ame="L399"> 399
        /*7an class=7comment">/**
,  417se*    )  href href" class="line" name="L417"> 417        ref">euid,  366     sr"srL43vali) a>->parent) {
 417        ref">euid,  366     sr"srL43valir-euid,  366     PAGE_SIZE    d /*7entials t7 be assigned
(euid))
,      !32el/cr*) class="line" name="L417"> 417        ref">euid,  366     sr"srL43valir(true;
,  366     POISON_FREEvalir-24 |-euid,  366     POISON_FREEvalir-16 |-euid,  366     POISON_FREEvalir-8)d /*7e6tials t7 > 395        }
( 396
false;
 398}
( *
pEXPORT_SYMBO">         417    s_are_in/a>  >   date_creds((/*7o4tials t7comment"> */
  "> 404 400new)
        /*7odentials7me="L415"> 415{
  ne" name="L427"> 427  ne" na>    17" id="L417" class="line" name="L417"> 417        const struct  417        st17" idcharconst struct  424#ifdeflabel    s /*7o7tials t7"sref">current;
 416        struct  416  sk    d /*7n an over7ref">real_cred;
 418
 416 printk>         416 KERN_ERRel/cre       ks"> 404kpfef">ksef">ksef">ks\nlass="string">>->new,
 424#ifdeflabel    s" class="line" name="L417"> 417        >>->usage),
 417        c==a href="+code=atomic_aame="L417"> 417aame=vali ?re       >->new));
 417        c==ahref="+code=tastskL416"> 416  sk    ref">euid, >-> 422
 417        c==ahref="+code=tastskL416"> 416  sk    ref">euid,  417        c?re       (old);
 416 printk>         416 KERN_ERRel/cre       magic=ef">kx, > 37addr=ef">kp\nlass="string">>->,  417        ref">euid,  417        ref">euid,  416 p 37addr>   date_creds(old) < 2);
 416 printk>         416 KERN_ERRel/cre       ="sre=bug  name==bug>->old);
BUG_ON( 417        ref">euid, ne", new);
,  421                417        dgt; 428#endif
 416 printk>         416 KERN_ERRel/cre       *uid4= { bug(((>->) < 1);
"prefrom_kuid_munge="L417"> 417from_kuid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid,  430
"prefrom_kuid_munge="L417"> 417from_kuid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid, 
"prefrom_kuid_munge="L417"> 417from_kuid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid,  432
"prefrom_kuid_munge="L417"> 417from_kuid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid, 
 416 printk>         416 KERN_ERRel/cre       *gid4= { bug(((>->euid) ||
"prefrom_kgid_munge="L417"> 417from_kgid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid, ();
"prefrom_kgid_munge="L417"> 417from_kgid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid, new)
"prefrom_kgid_munge="L417"> 417from_kgid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid, ENOMEM;
"prefrom_kgid_munge="L417"> 417from_kgid_munge=a>( 366     aef="_n6el/cs" class="line" name="L417"> 417        ref">euid,  338
7LONE_NEWUSER) {
 416 printk>         416 KERN_ERRel/cre       kp\nlass="string">" class="line" name="L417"> 417        ref">euid,  366     sr"srL43vali)t;new);
 417        ref">euid,  366     sr"srL43valir=ahref="+code=tasPAGE_SIZE"> 366     PAGE_SIZE      href href;ret < 0)
 417        ref">euid,  366     sr"srL43valir(error_put;
 366     POISON_FREEvalir-24 |-euid,  366     POISON_FREEvalir-16 |-euid,  366     POISON_FREEvalir-8)dd /*7name="L347"> 343        }
 416 printk>         416 KERN_ERRel/cre       kx, ef">kx}\nlass="string">>-> 344
 417        ref">euid,  366     sr"srL43vali)[0]>>->CONFIG_KEYS
,      !32el/c*) class="line" name="L417"> 417        ref">euid,  366     sr"srL43vali)[1])t;

7hread_keyring);
/*7s=new" cl7ss="sref">NULL;
n cin/a>  "> 404 400CLONE_THREAD)
        /*7s="line" 7ss="sref">new);
  ne" name="L427"> 427<__in/a>  ne" na>    17" id="L417" class="line" name="L417"> 417        const struct  417        st17" idcharconst struct ode=new" claslw/*7name="L357"> 353        }
 354
 416 printk>         416 KERN_ERRel/cre        404
 416 printk>         416 KERN_ERRel/cre       ks:ef">ku\nlass="string">" class="line" nfile+code=new" clasfile    stnst struct ode=new" claslw
  ne" name="L427"> 427  ne" na>    nst struct  417        ste       " class="line" nasref">"L417"> 417 sref">    dt;         */
 366     BUG>    dt;p7ocess_keyring);
pEXPORT_SYMBO">         427<__in/a>  ne" na>   dt;NULL;
 361        }
/*7e" name="7362"> 362#endif
user        /*7eame="L357ame="L363"> 363
        /*7 class="s7ef">processes);
      f">user_e" name="L427"> 427<__/a>      f">user_e" na>    ="L417" class="line" nine" name="L416"> 416        struct  416  sk    >>->new);
ode=new" claslw/*7ew" class7"sref">new, 2);
new);
,  416  sk    ref">euid,  417        c==ahref="+code=tastskL416"> 416  sk    ref">euid, -> 368<7a>        return 0;
,  366     unlikel3>         421                416  sk    ref">euid,  417        dw-2 ||>-> 369
,   "L417"> 417    s_are_in/a>  >    ed_subscribers"tskL416"> 416  sk    ref">euid,  417        ddd /*7sNULL" cl7ref">error_put:
"prein/a>  ne" name="L427"> 427  ne" na>   t;new);
ret;
,  366     unlikel3>         421                416  sk    ref">euid, -1 ||>-> 373}
,  421                416  sk    ref">euid,  417        dw-1 ||>-> 374
,   "L417"> 417    s_are_in/a>  >    ed_subscribers"tskL416"> 416  sk    ref">euid, ->subset)
,   "L417"> 417    s_are_in/a>  >    ed_subscribers"tskL416"> 416  sk    ref">euid,  417        ddd /*7sw" class7me="L376"> 376{
"prein/a>  ne" name="L427"> 427  ne" na>   t;user_ns;
 368<7"sref">user_ns;
 379

  ne" name="L427"> 427  ne" na>   :red.c#L418" id="L418" cla7t are a s7bset of set.
 416 printk>         416 KERN_ERRel/cre       user"> 404 416 printk>         416 KERN_ERRel/cre       ks:ef">ku\nlass="string">" class="line" nfile+code=new" clasfile    stnst struct ode=new" claslwsubset_ns)
);
  ne" name="L427"> 427  ne" na>    nst struct  416  sk    ref">euid, " class="line" ntskL416"> 416  sk    dt; 385
,  416  sk    ref">euid,  417        c!ef">cred * 416  sk    ref">euid, 
"predump_in/a>  ne" name="L427"> 427  ne" na>    nst struct  416  sk    ref">euid,  417        ste       " class="line" ntskL416"> 416  sk    dt;
 368<7ubset or one
 416 printk>         416 KERN_ERRel/cre        40sc==aRaa "> 40s\nlass="string")t;
 366     BUG>    dt;parent) {
pEXPORT_SYMBO">        user_e" name="L427"> 427<__/a>      f">user_e" na>   dt;)  &&
euid))
/*7s="line" 7ss="sref">true;
 40scfor do_exit()        /*7s=new" cl7"> 395        }
        /*7tw" class7ame="L396"> 396
         427            ="L417" class="line" nine" name="L416"> 416        struct  416  sk    );false;
 398}
 416 kdebug>            kp>((>-> 399
 416  sk    ref">euid,  416  sk    ref">euid,  417        s>->
BUG_ON( 416  sk    ref">euid,  417        ref">euid, ne", parent) {
 421                416  sk    ref">euid,  417        ddt;
euid))
      f">user_e" name="L427"> 427<__/a>      f">user_e" na>    href="+code=tastskL416"> 416  sk    >429" id="L429" c__FILE__me="L427"> 427<__FILE__    >429" id="L429" c__LINE__me="L427"> 427<__LINE__>   dt;true;
 395        }
 396
/*8e8entials8p="sref">false;
fafooter">
ne" origina "LXR software by t); LXR d="LunL43vali, t)is experiL388a "v=re="coby lxr@*
faf="footer">
lxr.*Rntpill Ln cL