Lines Matching refs:bprm
311 static int aa_xattrs_match(const struct linux_binprm *bprm, in aa_xattrs_match() argument
320 if (!bprm || !profile->xattr_count) in aa_xattrs_match()
326 d = bprm->file->f_path.dentry; in aa_xattrs_match()
388 static struct aa_label *find_attach(const struct linux_binprm *bprm, in find_attach() argument
431 if (bprm && profile->xattr_count) { in find_attach()
437 ret = aa_xattrs_match(bprm, profile, in find_attach()
558 const struct linux_binprm *bprm, in x_to_label() argument
586 new = find_attach(bprm, ns, &profile->base.profiles, in x_to_label()
590 new = find_attach(bprm, ns, &ns->base.profiles, in x_to_label()
625 const struct linux_binprm *bprm, in profile_transition() argument
637 AA_BUG(!bprm); in profile_transition()
640 error = aa_path_name(&bprm->file->f_path, profile->path_flags, buffer, in profile_transition()
649 name = bprm->filename; in profile_transition()
654 new = find_attach(bprm, profile->ns, in profile_transition()
668 new = x_to_label(profile, bprm, name, perms.xindex, &target, in profile_transition()
723 bool stack, const struct linux_binprm *bprm, in profile_onexec() argument
734 AA_BUG(!bprm); in profile_onexec()
747 error = aa_path_name(&bprm->file->f_path, profile->path_flags, buffer, in profile_onexec()
755 xname = bprm->filename; in profile_onexec()
796 const struct linux_binprm *bprm, in handle_onexec() argument
806 AA_BUG(!bprm); in handle_onexec()
812 bprm, buffer, cond, unsafe)); in handle_onexec()
817 profile_transition(profile, bprm, buffer, in handle_onexec()
823 profile_onexec(profile, onexec, stack, bprm, in handle_onexec()
830 profile_transition(profile, bprm, buffer, in handle_onexec()
840 AA_MAY_ONEXEC, bprm->filename, NULL, in handle_onexec()
854 int apparmor_bprm_creds_for_exec(struct linux_binprm *bprm) in apparmor_bprm_creds_for_exec() argument
863 kuid_t i_uid = i_uid_into_mnt(file_mnt_user_ns(bprm->file), in apparmor_bprm_creds_for_exec()
864 file_inode(bprm->file)); in apparmor_bprm_creds_for_exec()
867 file_inode(bprm->file)->i_mode in apparmor_bprm_creds_for_exec()
871 AA_BUG(!cred_label(bprm->cred)); in apparmor_bprm_creds_for_exec()
874 label = aa_get_newest_label(cred_label(bprm->cred)); in apparmor_bprm_creds_for_exec()
883 if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && !unconfined(label) && in apparmor_bprm_creds_for_exec()
897 bprm, buffer, &cond, &unsafe); in apparmor_bprm_creds_for_exec()
900 profile_transition(profile, bprm, buffer, in apparmor_bprm_creds_for_exec()
920 if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && in apparmor_bprm_creds_for_exec()
928 if (bprm->unsafe & LSM_UNSAFE_SHARE) { in apparmor_bprm_creds_for_exec()
933 if (bprm->unsafe & (LSM_UNSAFE_PTRACE)) { in apparmor_bprm_creds_for_exec()
943 "label=", bprm->filename); in apparmor_bprm_creds_for_exec()
947 bprm->secureexec = 1; in apparmor_bprm_creds_for_exec()
954 "bits. %s label=", bprm->filename); in apparmor_bprm_creds_for_exec()
958 bprm->per_clear |= PER_CLEAR_ON_SETID; in apparmor_bprm_creds_for_exec()
960 aa_put_label(cred_label(bprm->cred)); in apparmor_bprm_creds_for_exec()
962 set_cred_label(bprm->cred, new); in apparmor_bprm_creds_for_exec()
973 bprm->filename, NULL, new, in apparmor_bprm_creds_for_exec()