• Home
  • Raw
  • Download

Lines Matching refs:new

241 int cap_capset(struct cred *new,  in cap_capset()  argument
268 new->cap_effective = *effective; in cap_capset()
269 new->cap_inheritable = *inheritable; in cap_capset()
270 new->cap_permitted = *permitted; in cap_capset()
276 new->cap_ambient = cap_intersect(new->cap_ambient, in cap_capset()
279 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_capset()
554 struct cred *new = bprm->cred; in bprm_caps_from_vfs_caps() local
572 new->cap_permitted.cap[i] = in bprm_caps_from_vfs_caps()
573 (new->cap_bset.cap[i] & permitted) | in bprm_caps_from_vfs_caps()
574 (new->cap_inheritable.cap[i] & inheritable); in bprm_caps_from_vfs_caps()
576 if (permitted & ~new->cap_permitted.cap[i]) in bprm_caps_from_vfs_caps()
739 struct cred *new = bprm->cred; in handle_privileged_root() local
748 if (has_fcap && __is_suid(root_uid, new)) { in handle_privileged_root()
757 if (__is_eff(root_uid, new) || __is_real(root_uid, new)) { in handle_privileged_root()
759 new->cap_permitted = cap_combine(old->cap_bset, in handle_privileged_root()
765 if (__is_eff(root_uid, new)) in handle_privileged_root()
776 static inline bool __is_setuid(struct cred *new, const struct cred *old) in __is_setuid() argument
777 { return !uid_eq(new->euid, old->uid); } in __is_setuid()
779 static inline bool __is_setgid(struct cred *new, const struct cred *old) in __is_setgid() argument
780 { return !gid_eq(new->egid, old->gid); } in __is_setgid()
799 static inline bool nonroot_raised_pE(struct cred *new, const struct cred *old, in nonroot_raised_pE() argument
804 if ((__cap_grew(effective, ambient, new) && in nonroot_raised_pE()
805 !(__cap_full(effective, new) && in nonroot_raised_pE()
806 (__is_eff(root, new) || __is_real(root, new)) && in nonroot_raised_pE()
809 __is_suid(root, new) && in nonroot_raised_pE()
810 !__cap_full(effective, new)) || in nonroot_raised_pE()
811 (!__is_setuid(new, old) && in nonroot_raised_pE()
813 __cap_gained(permitted, new, old)) || in nonroot_raised_pE()
814 __cap_gained(ambient, new, old)))) in nonroot_raised_pE()
834 struct cred *new = bprm->cred; in cap_bprm_creds_from_file() local
846 root_uid = make_kuid(new->user_ns, 0); in cap_bprm_creds_from_file()
851 if (__cap_gained(permitted, new, old)) in cap_bprm_creds_from_file()
859 is_setid = __is_setuid(new, old) || __is_setgid(new, old); in cap_bprm_creds_from_file()
861 if ((is_setid || __cap_gained(permitted, new, old)) && in cap_bprm_creds_from_file()
863 !ptracer_capable(current, new->user_ns))) { in cap_bprm_creds_from_file()
865 if (!ns_capable(new->user_ns, CAP_SETUID) || in cap_bprm_creds_from_file()
867 new->euid = new->uid; in cap_bprm_creds_from_file()
868 new->egid = new->gid; in cap_bprm_creds_from_file()
870 new->cap_permitted = cap_intersect(new->cap_permitted, in cap_bprm_creds_from_file()
874 new->suid = new->fsuid = new->euid; in cap_bprm_creds_from_file()
875 new->sgid = new->fsgid = new->egid; in cap_bprm_creds_from_file()
879 cap_clear(new->cap_ambient); in cap_bprm_creds_from_file()
885 new->cap_permitted = cap_combine(new->cap_permitted, new->cap_ambient); in cap_bprm_creds_from_file()
892 new->cap_effective = new->cap_permitted; in cap_bprm_creds_from_file()
894 new->cap_effective = new->cap_ambient; in cap_bprm_creds_from_file()
896 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_bprm_creds_from_file()
899 if (nonroot_raised_pE(new, old, root_uid, has_fcap)) { in cap_bprm_creds_from_file()
900 ret = audit_log_bprm_fcaps(bprm, new, old); in cap_bprm_creds_from_file()
905 new->securebits &= ~issecure_mask(SECURE_KEEP_CAPS); in cap_bprm_creds_from_file()
907 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_bprm_creds_from_file()
912 (!__is_real(root_uid, new) && in cap_bprm_creds_from_file()
914 __cap_grew(permitted, ambient, new)))) in cap_bprm_creds_from_file()
1020 static inline void cap_emulate_setxuid(struct cred *new, const struct cred *old) in cap_emulate_setxuid() argument
1027 (!uid_eq(new->uid, root_uid) && in cap_emulate_setxuid()
1028 !uid_eq(new->euid, root_uid) && in cap_emulate_setxuid()
1029 !uid_eq(new->suid, root_uid))) { in cap_emulate_setxuid()
1031 cap_clear(new->cap_permitted); in cap_emulate_setxuid()
1032 cap_clear(new->cap_effective); in cap_emulate_setxuid()
1040 cap_clear(new->cap_ambient); in cap_emulate_setxuid()
1042 if (uid_eq(old->euid, root_uid) && !uid_eq(new->euid, root_uid)) in cap_emulate_setxuid()
1043 cap_clear(new->cap_effective); in cap_emulate_setxuid()
1044 if (!uid_eq(old->euid, root_uid) && uid_eq(new->euid, root_uid)) in cap_emulate_setxuid()
1045 new->cap_effective = new->cap_permitted; in cap_emulate_setxuid()
1057 int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags) in cap_task_fix_setuid() argument
1066 cap_emulate_setxuid(new, old); in cap_task_fix_setuid()
1078 if (uid_eq(old->fsuid, root_uid) && !uid_eq(new->fsuid, root_uid)) in cap_task_fix_setuid()
1079 new->cap_effective = in cap_task_fix_setuid()
1080 cap_drop_fs_set(new->cap_effective); in cap_task_fix_setuid()
1082 if (!uid_eq(old->fsuid, root_uid) && uid_eq(new->fsuid, root_uid)) in cap_task_fix_setuid()
1083 new->cap_effective = in cap_task_fix_setuid()
1084 cap_raise_fs_set(new->cap_effective, in cap_task_fix_setuid()
1085 new->cap_permitted); in cap_task_fix_setuid()
1164 struct cred *new; in cap_prctl_drop() local
1171 new = prepare_creds(); in cap_prctl_drop()
1172 if (!new) in cap_prctl_drop()
1174 cap_lower(new->cap_bset, cap); in cap_prctl_drop()
1175 return commit_creds(new); in cap_prctl_drop()
1194 struct cred *new; in cap_task_prctl() local
1244 new = prepare_creds(); in cap_task_prctl()
1245 if (!new) in cap_task_prctl()
1247 new->securebits = arg2; in cap_task_prctl()
1248 return commit_creds(new); in cap_task_prctl()
1262 new = prepare_creds(); in cap_task_prctl()
1263 if (!new) in cap_task_prctl()
1266 new->securebits |= issecure_mask(SECURE_KEEP_CAPS); in cap_task_prctl()
1268 new->securebits &= ~issecure_mask(SECURE_KEEP_CAPS); in cap_task_prctl()
1269 return commit_creds(new); in cap_task_prctl()
1276 new = prepare_creds(); in cap_task_prctl()
1277 if (!new) in cap_task_prctl()
1279 cap_clear(new->cap_ambient); in cap_task_prctl()
1280 return commit_creds(new); in cap_task_prctl()
1299 new = prepare_creds(); in cap_task_prctl()
1300 if (!new) in cap_task_prctl()
1303 cap_raise(new->cap_ambient, arg3); in cap_task_prctl()
1305 cap_lower(new->cap_ambient, arg3); in cap_task_prctl()
1306 return commit_creds(new); in cap_task_prctl()