Skip to content

Commit ab6875f

Browse files
lsahn-ghjrjohansen
authored andcommitted
apparmor: domain: clean up duplicated parts of handle_onexec()
Regression test of AppArmor finished without any failures. PASSED: aa_exec access attach_disconnected at_secure introspect capabilities changeprofile onexec changehat changehat_fork changehat_misc chdir clone coredump deleted e2e environ exec exec_qual fchdir fd_inheritance fork i18n link link_subset mkdir mmap mount mult_mount named_pipe namespaces net_raw open openat pipe pivot_root posix_ipc ptrace pwrite query_label regex rename readdir rw socketpair swap sd_flags setattr symlink syscall sysv_ipc tcp unix_fd_server unix_socket_pathname unix_socket_abstract unix_socket_unnamed unix_socket_autobind unlink userns xattrs xattrs_profile longpath nfs exec_stack aa_policy_cache nnp stackonexec stackprofile FAILED: make: Leaving directory '/apparmor/tests/regression/apparmor' Signed-off-by: Leesoo Ahn <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent c030937 commit ab6875f

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

security/apparmor/domain.c

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -826,33 +826,19 @@ static struct aa_label *handle_onexec(const struct cred *subj_cred,
826826
AA_BUG(!bprm);
827827
AA_BUG(!buffer);
828828

829-
if (!stack) {
830-
error = fn_for_each_in_ns(label, profile,
831-
profile_onexec(subj_cred, profile, onexec, stack,
832-
bprm, buffer, cond, unsafe));
833-
if (error)
834-
return ERR_PTR(error);
835-
new = fn_label_build_in_ns(label, profile, GFP_KERNEL,
836-
aa_get_newest_label(onexec),
837-
profile_transition(subj_cred, profile, bprm,
838-
buffer,
839-
cond, unsafe));
840-
841-
} else {
842-
/* TODO: determine how much we want to loosen this */
843-
error = fn_for_each_in_ns(label, profile,
844-
profile_onexec(subj_cred, profile, onexec, stack, bprm,
845-
buffer, cond, unsafe));
846-
if (error)
847-
return ERR_PTR(error);
848-
new = fn_label_build_in_ns(label, profile, GFP_KERNEL,
849-
aa_label_merge(&profile->label, onexec,
850-
GFP_KERNEL),
851-
profile_transition(subj_cred, profile, bprm,
852-
buffer,
853-
cond, unsafe));
854-
}
829+
/* TODO: determine how much we want to loosen this */
830+
error = fn_for_each_in_ns(label, profile,
831+
profile_onexec(subj_cred, profile, onexec, stack,
832+
bprm, buffer, cond, unsafe));
833+
if (error)
834+
return ERR_PTR(error);
855835

836+
new = fn_label_build_in_ns(label, profile, GFP_KERNEL,
837+
stack ? aa_label_merge(&profile->label, onexec,
838+
GFP_KERNEL)
839+
: aa_get_newest_label(onexec),
840+
profile_transition(subj_cred, profile, bprm,
841+
buffer, cond, unsafe));
856842
if (new)
857843
return new;
858844

0 commit comments

Comments
 (0)