• Home
  • Raw
  • Download

Lines Matching refs:new

221 	struct cred *new;  in cred_alloc_blank()  local
223 new = kmem_cache_zalloc(cred_jar, GFP_KERNEL); in cred_alloc_blank()
224 if (!new) in cred_alloc_blank()
227 atomic_set(&new->usage, 1); in cred_alloc_blank()
229 new->magic = CRED_MAGIC; in cred_alloc_blank()
231 if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) in cred_alloc_blank()
234 return new; in cred_alloc_blank()
237 abort_creds(new); in cred_alloc_blank()
259 struct cred *new; in prepare_creds() local
263 new = kmem_cache_alloc(cred_jar, GFP_KERNEL); in prepare_creds()
264 if (!new) in prepare_creds()
267 kdebug("prepare_creds() alloc %p", new); in prepare_creds()
270 memcpy(new, old, sizeof(struct cred)); in prepare_creds()
272 new->non_rcu = 0; in prepare_creds()
273 atomic_set(&new->usage, 1); in prepare_creds()
274 set_cred_subscribers(new, 0); in prepare_creds()
275 get_group_info(new->group_info); in prepare_creds()
276 get_uid(new->user); in prepare_creds()
277 get_user_ns(new->user_ns); in prepare_creds()
280 key_get(new->session_keyring); in prepare_creds()
281 key_get(new->process_keyring); in prepare_creds()
282 key_get(new->thread_keyring); in prepare_creds()
283 key_get(new->request_key_auth); in prepare_creds()
287 new->security = NULL; in prepare_creds()
290 new->ucounts = get_ucounts(new->ucounts); in prepare_creds()
291 if (!new->ucounts) in prepare_creds()
294 if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) in prepare_creds()
297 validate_creds(new); in prepare_creds()
298 return new; in prepare_creds()
301 abort_creds(new); in prepare_creds()
312 struct cred *new; in prepare_exec_creds() local
314 new = prepare_creds(); in prepare_exec_creds()
315 if (!new) in prepare_exec_creds()
316 return new; in prepare_exec_creds()
320 key_put(new->thread_keyring); in prepare_exec_creds()
321 new->thread_keyring = NULL; in prepare_exec_creds()
324 key_put(new->process_keyring); in prepare_exec_creds()
325 new->process_keyring = NULL; in prepare_exec_creds()
328 new->suid = new->fsuid = new->euid; in prepare_exec_creds()
329 new->sgid = new->fsgid = new->egid; in prepare_exec_creds()
331 return new; in prepare_exec_creds()
345 struct cred *new; in copy_creds() local
368 new = prepare_creds(); in copy_creds()
369 if (!new) in copy_creds()
373 ret = create_user_ns(new); in copy_creds()
376 ret = set_cred_ucounts(new); in copy_creds()
384 if (new->thread_keyring) { in copy_creds()
385 key_put(new->thread_keyring); in copy_creds()
386 new->thread_keyring = NULL; in copy_creds()
388 install_thread_keyring_to_cred(new); in copy_creds()
395 key_put(new->process_keyring); in copy_creds()
396 new->process_keyring = NULL; in copy_creds()
400 p->cred = p->real_cred = get_cred(new); in copy_creds()
402 alter_cred_subscribers(new, 2); in copy_creds()
403 validate_creds(new); in copy_creds()
407 put_cred(new); in copy_creds()
450 int commit_creds(struct cred *new) in commit_creds() argument
455 kdebug("commit_creds(%p{%d,%d})", new, in commit_creds()
456 atomic_read(&new->usage), in commit_creds()
457 read_cred_subscribers(new)); in commit_creds()
463 validate_creds(new); in commit_creds()
465 BUG_ON(atomic_read(&new->usage) < 1); in commit_creds()
467 get_cred(new); /* we will require a ref for the subj creds too */ in commit_creds()
470 if (!uid_eq(old->euid, new->euid) || in commit_creds()
471 !gid_eq(old->egid, new->egid) || in commit_creds()
472 !uid_eq(old->fsuid, new->fsuid) || in commit_creds()
473 !gid_eq(old->fsgid, new->fsgid) || in commit_creds()
474 !cred_cap_issubset(old, new)) { in commit_creds()
491 if (!uid_eq(new->fsuid, old->fsuid)) in commit_creds()
492 key_fsuid_changed(new); in commit_creds()
493 if (!gid_eq(new->fsgid, old->fsgid)) in commit_creds()
494 key_fsgid_changed(new); in commit_creds()
500 alter_cred_subscribers(new, 2); in commit_creds()
501 if (new->user != old->user || new->user_ns != old->user_ns) in commit_creds()
502 inc_rlimit_ucounts(new->ucounts, UCOUNT_RLIMIT_NPROC, 1); in commit_creds()
503 rcu_assign_pointer(task->real_cred, new); in commit_creds()
504 rcu_assign_pointer(task->cred, new); in commit_creds()
505 trace_android_rvh_commit_creds(task, new); in commit_creds()
506 if (new->user != old->user || new->user_ns != old->user_ns) in commit_creds()
511 if (!uid_eq(new->uid, old->uid) || in commit_creds()
512 !uid_eq(new->euid, old->euid) || in commit_creds()
513 !uid_eq(new->suid, old->suid) || in commit_creds()
514 !uid_eq(new->fsuid, old->fsuid)) in commit_creds()
517 if (!gid_eq(new->gid, old->gid) || in commit_creds()
518 !gid_eq(new->egid, old->egid) || in commit_creds()
519 !gid_eq(new->sgid, old->sgid) || in commit_creds()
520 !gid_eq(new->fsgid, old->fsgid)) in commit_creds()
537 void abort_creds(struct cred *new) in abort_creds() argument
539 kdebug("abort_creds(%p{%d,%d})", new, in abort_creds()
540 atomic_read(&new->usage), in abort_creds()
541 read_cred_subscribers(new)); in abort_creds()
544 BUG_ON(read_cred_subscribers(new) != 0); in abort_creds()
546 BUG_ON(atomic_read(&new->usage) < 1); in abort_creds()
547 put_cred(new); in abort_creds()
558 const struct cred *override_creds(const struct cred *new) in override_creds() argument
562 kdebug("override_creds(%p{%d,%d})", new, in override_creds()
563 atomic_read(&new->usage), in override_creds()
564 read_cred_subscribers(new)); in override_creds()
567 validate_creds(new); in override_creds()
580 get_new_cred((struct cred *)new); in override_creds()
581 alter_cred_subscribers(new, 1); in override_creds()
582 rcu_assign_pointer(current->cred, new); in override_creds()
583 trace_android_rvh_override_creds(current, new); in override_creds()
672 int set_cred_ucounts(struct cred *new) in set_cred_ucounts() argument
674 struct ucounts *new_ucounts, *old_ucounts = new->ucounts; in set_cred_ucounts()
680 if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid)) in set_cred_ucounts()
683 if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid))) in set_cred_ucounts()
686 new->ucounts = new_ucounts; in set_cred_ucounts()
721 struct cred *new; in prepare_kernel_cred() local
723 new = kmem_cache_alloc(cred_jar, GFP_KERNEL); in prepare_kernel_cred()
724 if (!new) in prepare_kernel_cred()
727 kdebug("prepare_kernel_cred() alloc %p", new); in prepare_kernel_cred()
736 *new = *old; in prepare_kernel_cred()
737 new->non_rcu = 0; in prepare_kernel_cred()
738 atomic_set(&new->usage, 1); in prepare_kernel_cred()
739 set_cred_subscribers(new, 0); in prepare_kernel_cred()
740 get_uid(new->user); in prepare_kernel_cred()
741 get_user_ns(new->user_ns); in prepare_kernel_cred()
742 get_group_info(new->group_info); in prepare_kernel_cred()
745 new->session_keyring = NULL; in prepare_kernel_cred()
746 new->process_keyring = NULL; in prepare_kernel_cred()
747 new->thread_keyring = NULL; in prepare_kernel_cred()
748 new->request_key_auth = NULL; in prepare_kernel_cred()
749 new->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING; in prepare_kernel_cred()
753 new->security = NULL; in prepare_kernel_cred()
755 new->ucounts = get_ucounts(new->ucounts); in prepare_kernel_cred()
756 if (!new->ucounts) in prepare_kernel_cred()
759 if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) in prepare_kernel_cred()
763 validate_creds(new); in prepare_kernel_cred()
764 return new; in prepare_kernel_cred()
767 put_cred(new); in prepare_kernel_cred()
781 int set_security_override(struct cred *new, u32 secid) in set_security_override() argument
783 return security_kernel_act_as(new, secid); in set_security_override()
797 int set_security_override_from_ctx(struct cred *new, const char *secctx) in set_security_override_from_ctx() argument
806 return set_security_override(new, secid); in set_security_override_from_ctx()
819 int set_create_files_as(struct cred *new, struct inode *inode) in set_create_files_as() argument
823 new->fsuid = inode->i_uid; in set_create_files_as()
824 new->fsgid = inode->i_gid; in set_create_files_as()
825 return security_kernel_create_files_as(new, inode); in set_create_files_as()