Skip to content

Commit d20f5a1

Browse files
committed
apparmor: rename audit_data->label to audit_data->subj_label
rename audit_data's label field to subj_label to better reflect its use. Also at the same time drop unneeded assignments to ->subj_label as the later call to aa_check_perms will do the assignment if needed. Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent bd7bd20 commit d20f5a1

File tree

10 files changed

+17
-18
lines changed

10 files changed

+17
-18
lines changed

security/apparmor/audit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ static void audit_pre(struct audit_buffer *ab, void *va)
113113
audit_log_format(ab, " error=%d", ad->error);
114114
}
115115

116-
if (ad->label) {
117-
struct aa_label *label = ad->label;
116+
if (ad->subj_label) {
117+
struct aa_label *label = ad->subj_label;
118118

119119
if (label_isprofile(label)) {
120120
struct aa_profile *profile = labels_profile(label);
@@ -187,7 +187,7 @@ int aa_audit(int type, struct aa_profile *profile,
187187
if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED)
188188
type = AUDIT_APPARMOR_KILL;
189189

190-
ad->label = &profile->label;
190+
ad->subj_label = &profile->label;
191191

192192
aa_audit_msg(type, ad, cb);
193193

security/apparmor/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void file_audit_cb(struct audit_buffer *ab, void *va)
6767

6868
if (ad->peer) {
6969
audit_log_format(ab, " target=");
70-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
70+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
7171
FLAG_VIEW_SUBNS, GFP_KERNEL);
7272
} else if (ad->fs.target) {
7373
audit_log_format(ab, " target=");

security/apparmor/include/audit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct apparmor_audit_data {
109109
int type;
110110
u16 class;
111111
const char *op;
112-
struct aa_label *label;
112+
struct aa_label *subj_label;
113113
const char *name;
114114
const char *info;
115115
u32 request;

security/apparmor/ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va)
7171
audit_log_format(ab, " signal=rtmin+%d",
7272
ad->signal - SIGRT_BASE);
7373
audit_log_format(ab, " peer=");
74-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
74+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
7575
FLAGS_NONE, GFP_ATOMIC);
7676
}
7777

security/apparmor/lib.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static void aa_audit_perms_cb(struct audit_buffer *ab, void *va)
297297
PERMS_NAMES_MASK);
298298
}
299299
audit_log_format(ab, " peer=");
300-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
300+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
301301
FLAGS_NONE, GFP_ATOMIC);
302302
}
303303

@@ -357,7 +357,6 @@ int aa_profile_label_perm(struct aa_profile *profile, struct aa_profile *target,
357357
typeof(*rules), list);
358358
struct aa_perms perms;
359359

360-
ad->label = &profile->label;
361360
ad->peer = &target->label;
362361
ad->request = request;
363362

@@ -419,7 +418,7 @@ int aa_check_perms(struct aa_profile *profile, struct aa_perms *perms,
419418
}
420419

421420
if (ad) {
422-
ad->label = &profile->label;
421+
ad->subj_label = &profile->label;
423422
ad->request = request;
424423
ad->denied = denied;
425424
ad->error = error;

security/apparmor/lsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ static int apparmor_setprocattr(const char *name, void *value,
722722
return error;
723723

724724
fail:
725-
ad.label = begin_current_label_crit_section();
725+
ad.subj_label = begin_current_label_crit_section();
726726
ad.info = name;
727727
ad.error = error = -EINVAL;
728728
aa_audit_msg(AUDIT_APPARMOR_DENIED, &ad, NULL);
729-
end_current_label_crit_section(ad.label);
729+
end_current_label_crit_section(ad.subj_label);
730730
goto out;
731731
}
732732

security/apparmor/net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void audit_net_cb(struct audit_buffer *ab, void *va)
100100
}
101101
if (ad->peer) {
102102
audit_log_format(ab, " peer=");
103-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
103+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
104104
FLAGS_NONE, GFP_ATOMIC);
105105
}
106106
}

security/apparmor/policy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ static void audit_cb(struct audit_buffer *ab, void *va)
733733

734734
/**
735735
* audit_policy - Do auditing of policy changes
736-
* @label: label to check if it can manage policy
736+
* @subj_label: label to check if it can manage policy
737737
* @op: policy operation being performed
738738
* @ns_name: name of namespace being manipulated
739739
* @name: name of profile being manipulated (NOT NULL)
@@ -742,7 +742,7 @@ static void audit_cb(struct audit_buffer *ab, void *va)
742742
*
743743
* Returns: the error to be returned after audit is done
744744
*/
745-
static int audit_policy(struct aa_label *label, const char *op,
745+
static int audit_policy(struct aa_label *subj_label, const char *op,
746746
const char *ns_name, const char *name,
747747
const char *info, int error)
748748
{
@@ -752,7 +752,7 @@ static int audit_policy(struct aa_label *label, const char *op,
752752
ad.name = name;
753753
ad.info = info;
754754
ad.error = error;
755-
ad.label = label;
755+
ad.subj_label = subj_label;
756756

757757
aa_audit_msg(AUDIT_APPARMOR_STATUS, &ad, audit_cb);
758758

security/apparmor/resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void audit_cb(struct audit_buffer *ab, void *va)
3636
rlim_names[ad->rlim.rlim], ad->rlim.max);
3737
if (ad->peer) {
3838
audit_log_format(ab, " peer=");
39-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
39+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
4040
FLAGS_NONE, GFP_ATOMIC);
4141
}
4242
}

security/apparmor/task.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static void audit_ptrace_cb(struct audit_buffer *ab, void *va)
217217
}
218218
}
219219
audit_log_format(ab, " peer=");
220-
aa_label_xaudit(ab, labels_ns(ad->label), ad->peer,
220+
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
221221
FLAGS_NONE, GFP_ATOMIC);
222222
}
223223

@@ -263,7 +263,7 @@ static int profile_tracer_perm(struct aa_profile *tracer,
263263
if (&tracer->label == tracee)
264264
return 0;
265265

266-
ad->label = &tracer->label;
266+
ad->subj_label = &tracer->label;
267267
ad->peer = tracee;
268268
ad->request = 0;
269269
ad->error = aa_capable(&tracer->label, CAP_SYS_PTRACE,

0 commit comments

Comments
 (0)