Lines Matching full:new

261  * @new: The proposed new credentials; alterations should be made here
263 * @effective: A pointer to the proposed new effective capabilities set
264 * @inheritable: A pointer to the proposed new inheritable capabilities set
265 * @permitted: A pointer to the proposed new permitted capabilities set
268 * process's capability sets. The changes are made to the proposed new
271 int cap_capset(struct cred *new, in cap_capset() argument
287 /* no new pI capabilities outside bounding set */ in cap_capset()
290 /* verify restrictions on target's new Permitted set */ in cap_capset()
298 new->cap_effective = *effective; in cap_capset()
299 new->cap_inheritable = *inheritable; in cap_capset()
300 new->cap_permitted = *permitted; in cap_capset()
306 new->cap_ambient = cap_intersect(new->cap_ambient, in cap_capset()
309 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_capset()
556 * Return: On success, return the new size; on error, return < 0.
612 * Calculate the new process capability sets from the capability sets attached
620 struct cred *new = bprm->cred; in bprm_caps_from_vfs_caps() local
633 new->cap_permitted.val = in bprm_caps_from_vfs_caps()
634 (new->cap_bset.val & caps->permitted.val) | in bprm_caps_from_vfs_caps()
635 (new->cap_inheritable.val & caps->inheritable.val); in bprm_caps_from_vfs_caps()
637 if (caps->permitted.val & ~new->cap_permitted.val) in bprm_caps_from_vfs_caps()
821 struct cred *new = bprm->cred; in handle_privileged_root() local
830 if (has_fcap && __is_suid(root_uid, new)) { in handle_privileged_root()
839 if (__is_eff(root_uid, new) || __is_real(root_uid, new)) { in handle_privileged_root()
841 new->cap_permitted = cap_combine(old->cap_bset, in handle_privileged_root()
847 if (__is_eff(root_uid, new)) in handle_privileged_root()
858 static inline bool __is_setuid(struct cred *new, const struct cred *old) in __is_setuid() argument
859 { return !uid_eq(new->euid, old->uid); } in __is_setuid()
861 static inline bool __is_setgid(struct cred *new, const struct cred *old) in __is_setgid() argument
862 { return !gid_eq(new->egid, old->gid); } in __is_setgid()
881 static inline bool nonroot_raised_pE(struct cred *new, const struct cred *old, in nonroot_raised_pE() argument
886 if ((__cap_grew(effective, ambient, new) && in nonroot_raised_pE()
887 !(__cap_full(effective, new) && in nonroot_raised_pE()
888 (__is_eff(root, new) || __is_real(root, new)) && in nonroot_raised_pE()
891 __is_suid(root, new) && in nonroot_raised_pE()
892 !__cap_full(effective, new)) || in nonroot_raised_pE()
893 (!__is_setuid(new, old) && in nonroot_raised_pE()
895 __cap_gained(permitted, new, old)) || in nonroot_raised_pE()
896 __cap_gained(ambient, new, old)))) in nonroot_raised_pE()
908 * Set up the proposed credentials for a new execution context being
918 struct cred *new = bprm->cred; in cap_bprm_creds_from_file() local
930 root_uid = make_kuid(new->user_ns, 0); in cap_bprm_creds_from_file()
935 if (__cap_gained(permitted, new, old)) in cap_bprm_creds_from_file()
941 * In addition, if NO_NEW_PRIVS, then ensure we get no new privs. in cap_bprm_creds_from_file()
943 is_setid = __is_setuid(new, old) || __is_setgid(new, old); in cap_bprm_creds_from_file()
945 if ((is_setid || __cap_gained(permitted, new, old)) && in cap_bprm_creds_from_file()
947 !ptracer_capable(current, new->user_ns))) { in cap_bprm_creds_from_file()
949 if (!ns_capable(new->user_ns, CAP_SETUID) || in cap_bprm_creds_from_file()
951 new->euid = new->uid; in cap_bprm_creds_from_file()
952 new->egid = new->gid; in cap_bprm_creds_from_file()
954 new->cap_permitted = cap_intersect(new->cap_permitted, in cap_bprm_creds_from_file()
958 new->suid = new->fsuid = new->euid; in cap_bprm_creds_from_file()
959 new->sgid = new->fsgid = new->egid; in cap_bprm_creds_from_file()
963 cap_clear(new->cap_ambient); in cap_bprm_creds_from_file()
969 new->cap_permitted = cap_combine(new->cap_permitted, new->cap_ambient); in cap_bprm_creds_from_file()
976 new->cap_effective = new->cap_permitted; in cap_bprm_creds_from_file()
978 new->cap_effective = new->cap_ambient; in cap_bprm_creds_from_file()
980 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_bprm_creds_from_file()
983 if (nonroot_raised_pE(new, old, root_uid, has_fcap)) { in cap_bprm_creds_from_file()
984 ret = audit_log_bprm_fcaps(bprm, new, old); in cap_bprm_creds_from_file()
989 new->securebits &= ~issecure_mask(SECURE_KEEP_CAPS); in cap_bprm_creds_from_file()
991 if (WARN_ON(!cap_ambient_invariant_ok(new))) in cap_bprm_creds_from_file()
996 (!__is_real(root_uid, new) && in cap_bprm_creds_from_file()
998 __cap_grew(permitted, ambient, new)))) in cap_bprm_creds_from_file()
1103 * cevans - New behaviour, Oct '99
1113 static inline void cap_emulate_setxuid(struct cred *new, const struct cred *old) in cap_emulate_setxuid() argument
1120 (!uid_eq(new->uid, root_uid) && in cap_emulate_setxuid()
1121 !uid_eq(new->euid, root_uid) && in cap_emulate_setxuid()
1122 !uid_eq(new->suid, root_uid))) { in cap_emulate_setxuid()
1124 cap_clear(new->cap_permitted); in cap_emulate_setxuid()
1125 cap_clear(new->cap_effective); in cap_emulate_setxuid()
1133 cap_clear(new->cap_ambient); in cap_emulate_setxuid()
1135 if (uid_eq(old->euid, root_uid) && !uid_eq(new->euid, root_uid)) in cap_emulate_setxuid()
1136 cap_clear(new->cap_effective); in cap_emulate_setxuid()
1137 if (!uid_eq(old->euid, root_uid) && uid_eq(new->euid, root_uid)) in cap_emulate_setxuid()
1138 new->cap_effective = new->cap_permitted; in cap_emulate_setxuid()
1143 * @new: The proposed credentials
1152 int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags) in cap_task_fix_setuid() argument
1161 cap_emulate_setxuid(new, old); in cap_task_fix_setuid()
1173 if (uid_eq(old->fsuid, root_uid) && !uid_eq(new->fsuid, root_uid)) in cap_task_fix_setuid()
1174 new->cap_effective = in cap_task_fix_setuid()
1175 cap_drop_fs_set(new->cap_effective); in cap_task_fix_setuid()
1177 if (!uid_eq(old->fsuid, root_uid) && uid_eq(new->fsuid, root_uid)) in cap_task_fix_setuid()
1178 new->cap_effective = in cap_task_fix_setuid()
1179 cap_raise_fs_set(new->cap_effective, in cap_task_fix_setuid()
1180 new->cap_permitted); in cap_task_fix_setuid()
1265 struct cred *new; in cap_prctl_drop() local
1272 new = prepare_creds(); in cap_prctl_drop()
1273 if (!new) in cap_prctl_drop()
1275 cap_lower(new->cap_bset, cap); in cap_prctl_drop()
1276 return commit_creds(new); in cap_prctl_drop()
1298 struct cred *new; in cap_task_prctl() local
1365 new = prepare_creds(); in cap_task_prctl()
1366 if (!new) in cap_task_prctl()
1368 new->securebits = arg2; in cap_task_prctl()
1369 return commit_creds(new); in cap_task_prctl()
1383 new = prepare_creds(); in cap_task_prctl()
1384 if (!new) in cap_task_prctl()
1387 new->securebits |= issecure_mask(SECURE_KEEP_CAPS); in cap_task_prctl()
1389 new->securebits &= ~issecure_mask(SECURE_KEEP_CAPS); in cap_task_prctl()
1390 return commit_creds(new); in cap_task_prctl()
1397 new = prepare_creds(); in cap_task_prctl()
1398 if (!new) in cap_task_prctl()
1400 cap_clear(new->cap_ambient); in cap_task_prctl()
1401 return commit_creds(new); in cap_task_prctl()
1420 new = prepare_creds(); in cap_task_prctl()
1421 if (!new) in cap_task_prctl()
1424 cap_raise(new->cap_ambient, arg3); in cap_task_prctl()
1426 cap_lower(new->cap_ambient, arg3); in cap_task_prctl()
1427 return commit_creds(new); in cap_task_prctl()
1437 * cap_vm_enough_memory - Determine whether a new virtual mapping is permitted
1438 * @mm: The VM space in which the new mapping is to be made
1441 * Determine whether the allocation of a new virtual mapping by the current