Skip to content

Commit 8ac2ca3

Browse files
Sebastian Andrzej Siewiorjrjohansen
authored andcommitted
apparmor: Switch to GFP_KERNEL where possible
After removing preempt_disable() from get_buffers() it is possible to replace a few GFP_ATOMIC allocations with GFP_KERNEL. Replace GFP_ATOMIC allocations with GFP_KERNEL where the context looks to bee preepmtible. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent df32333 commit 8ac2ca3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

security/apparmor/domain.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,
524524
label = &new_profile->label;
525525
continue;
526526
}
527-
label = aa_label_parse(&profile->label, *name, GFP_ATOMIC,
527+
label = aa_label_parse(&profile->label, *name, GFP_KERNEL,
528528
true, false);
529529
if (IS_ERR(label))
530530
label = NULL;
@@ -604,7 +604,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
604604
/* base the stack on post domain transition */
605605
struct aa_label *base = new;
606606

607-
new = aa_label_parse(base, stack, GFP_ATOMIC, true, false);
607+
new = aa_label_parse(base, stack, GFP_KERNEL, true, false);
608608
if (IS_ERR(new))
609609
new = NULL;
610610
aa_put_label(base);
@@ -712,7 +712,7 @@ static struct aa_label *profile_transition(struct aa_profile *profile,
712712
if (DEBUG_ON) {
713713
dbg_printk("apparmor: scrubbing environment variables"
714714
" for %s profile=", name);
715-
aa_label_printk(new, GFP_ATOMIC);
715+
aa_label_printk(new, GFP_KERNEL);
716716
dbg_printk("\n");
717717
}
718718
*secure_exec = true;
@@ -788,7 +788,7 @@ static int profile_onexec(struct aa_profile *profile, struct aa_label *onexec,
788788
if (DEBUG_ON) {
789789
dbg_printk("apparmor: scrubbing environment "
790790
"variables for %s label=", xname);
791-
aa_label_printk(onexec, GFP_ATOMIC);
791+
aa_label_printk(onexec, GFP_KERNEL);
792792
dbg_printk("\n");
793793
}
794794
*secure_exec = true;
@@ -822,7 +822,7 @@ static struct aa_label *handle_onexec(struct aa_label *label,
822822
bprm, buffer, cond, unsafe));
823823
if (error)
824824
return ERR_PTR(error);
825-
new = fn_label_build_in_ns(label, profile, GFP_ATOMIC,
825+
new = fn_label_build_in_ns(label, profile, GFP_KERNEL,
826826
aa_get_newest_label(onexec),
827827
profile_transition(profile, bprm, buffer,
828828
cond, unsafe));
@@ -834,9 +834,9 @@ static struct aa_label *handle_onexec(struct aa_label *label,
834834
buffer, cond, unsafe));
835835
if (error)
836836
return ERR_PTR(error);
837-
new = fn_label_build_in_ns(label, profile, GFP_ATOMIC,
837+
new = fn_label_build_in_ns(label, profile, GFP_KERNEL,
838838
aa_label_merge(&profile->label, onexec,
839-
GFP_ATOMIC),
839+
GFP_KERNEL),
840840
profile_transition(profile, bprm, buffer,
841841
cond, unsafe));
842842
}
@@ -907,7 +907,7 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
907907
new = handle_onexec(label, ctx->onexec, ctx->token,
908908
bprm, buffer, &cond, &unsafe);
909909
else
910-
new = fn_label_build(label, profile, GFP_ATOMIC,
910+
new = fn_label_build(label, profile, GFP_KERNEL,
911911
profile_transition(profile, bprm, buffer,
912912
&cond, &unsafe));
913913

@@ -951,7 +951,7 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
951951
if (DEBUG_ON) {
952952
dbg_printk("scrubbing environment variables for %s "
953953
"label=", bprm->filename);
954-
aa_label_printk(new, GFP_ATOMIC);
954+
aa_label_printk(new, GFP_KERNEL);
955955
dbg_printk("\n");
956956
}
957957
bprm->secureexec = 1;
@@ -962,7 +962,7 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
962962
if (DEBUG_ON) {
963963
dbg_printk("apparmor: clearing unsafe personality "
964964
"bits. %s label=", bprm->filename);
965-
aa_label_printk(new, GFP_ATOMIC);
965+
aa_label_printk(new, GFP_KERNEL);
966966
dbg_printk("\n");
967967
}
968968
bprm->per_clear |= PER_CLEAR_ON_SETID;

security/apparmor/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void file_audit_cb(struct audit_buffer *ab, void *va)
8080
if (aad(sa)->peer) {
8181
audit_log_format(ab, " target=");
8282
aa_label_xaudit(ab, labels_ns(aad(sa)->label), aad(sa)->peer,
83-
FLAG_VIEW_SUBNS, GFP_ATOMIC);
83+
FLAG_VIEW_SUBNS, GFP_KERNEL);
8484
} else if (aad(sa)->fs.target) {
8585
audit_log_format(ab, " target=");
8686
audit_log_untrustedstring(ab, aad(sa)->fs.target);

security/apparmor/mount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ int aa_pivotroot(struct aa_label *label, const struct path *old_path,
708708
error = -ENOMEM;
709709
if (!old_buffer || !new_buffer)
710710
goto out;
711-
target = fn_label_build(label, profile, GFP_ATOMIC,
711+
target = fn_label_build(label, profile, GFP_KERNEL,
712712
build_pivotroot(profile, new_path, new_buffer,
713713
old_path, old_buffer));
714714
if (!target) {

0 commit comments

Comments
 (0)