diff options
Diffstat (limited to 'security/apparmor/audit.c')
-rw-r--r-- | security/apparmor/audit.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c index 5ff67776a5ad..cc3520d39a78 100644 --- a/security/apparmor/audit.c +++ b/security/apparmor/audit.c | |||
@@ -115,23 +115,23 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
115 | 115 | ||
116 | if (aa_g_audit_header) { | 116 | if (aa_g_audit_header) { |
117 | audit_log_format(ab, "apparmor="); | 117 | audit_log_format(ab, "apparmor="); |
118 | audit_log_string(ab, aa_audit_type[sa->aad.type]); | 118 | audit_log_string(ab, aa_audit_type[sa->aad->type]); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (sa->aad.op) { | 121 | if (sa->aad->op) { |
122 | audit_log_format(ab, " operation="); | 122 | audit_log_format(ab, " operation="); |
123 | audit_log_string(ab, op_table[sa->aad.op]); | 123 | audit_log_string(ab, op_table[sa->aad->op]); |
124 | } | 124 | } |
125 | 125 | ||
126 | if (sa->aad.info) { | 126 | if (sa->aad->info) { |
127 | audit_log_format(ab, " info="); | 127 | audit_log_format(ab, " info="); |
128 | audit_log_string(ab, sa->aad.info); | 128 | audit_log_string(ab, sa->aad->info); |
129 | if (sa->aad.error) | 129 | if (sa->aad->error) |
130 | audit_log_format(ab, " error=%d", sa->aad.error); | 130 | audit_log_format(ab, " error=%d", sa->aad->error); |
131 | } | 131 | } |
132 | 132 | ||
133 | if (sa->aad.profile) { | 133 | if (sa->aad->profile) { |
134 | struct aa_profile *profile = sa->aad.profile; | 134 | struct aa_profile *profile = sa->aad->profile; |
135 | pid_t pid; | 135 | pid_t pid; |
136 | rcu_read_lock(); | 136 | rcu_read_lock(); |
137 | pid = rcu_dereference(tsk->real_parent)->pid; | 137 | pid = rcu_dereference(tsk->real_parent)->pid; |
@@ -145,9 +145,9 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
145 | audit_log_untrustedstring(ab, profile->base.hname); | 145 | audit_log_untrustedstring(ab, profile->base.hname); |
146 | } | 146 | } |
147 | 147 | ||
148 | if (sa->aad.name) { | 148 | if (sa->aad->name) { |
149 | audit_log_format(ab, " name="); | 149 | audit_log_format(ab, " name="); |
150 | audit_log_untrustedstring(ab, sa->aad.name); | 150 | audit_log_untrustedstring(ab, sa->aad->name); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
@@ -159,10 +159,8 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
159 | void aa_audit_msg(int type, struct common_audit_data *sa, | 159 | void aa_audit_msg(int type, struct common_audit_data *sa, |
160 | void (*cb) (struct audit_buffer *, void *)) | 160 | void (*cb) (struct audit_buffer *, void *)) |
161 | { | 161 | { |
162 | sa->aad.type = type; | 162 | sa->aad->type = type; |
163 | sa->lsm_pre_audit = audit_pre; | 163 | common_lsm_audit(sa, audit_pre, cb); |
164 | sa->lsm_post_audit = cb; | ||
165 | common_lsm_audit(sa); | ||
166 | } | 164 | } |
167 | 165 | ||
168 | /** | 166 | /** |
@@ -184,7 +182,7 @@ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, | |||
184 | BUG_ON(!profile); | 182 | BUG_ON(!profile); |
185 | 183 | ||
186 | if (type == AUDIT_APPARMOR_AUTO) { | 184 | if (type == AUDIT_APPARMOR_AUTO) { |
187 | if (likely(!sa->aad.error)) { | 185 | if (likely(!sa->aad->error)) { |
188 | if (AUDIT_MODE(profile) != AUDIT_ALL) | 186 | if (AUDIT_MODE(profile) != AUDIT_ALL) |
189 | return 0; | 187 | return 0; |
190 | type = AUDIT_APPARMOR_AUDIT; | 188 | type = AUDIT_APPARMOR_AUDIT; |
@@ -196,21 +194,21 @@ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, | |||
196 | if (AUDIT_MODE(profile) == AUDIT_QUIET || | 194 | if (AUDIT_MODE(profile) == AUDIT_QUIET || |
197 | (type == AUDIT_APPARMOR_DENIED && | 195 | (type == AUDIT_APPARMOR_DENIED && |
198 | AUDIT_MODE(profile) == AUDIT_QUIET)) | 196 | AUDIT_MODE(profile) == AUDIT_QUIET)) |
199 | return sa->aad.error; | 197 | return sa->aad->error; |
200 | 198 | ||
201 | if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED) | 199 | if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED) |
202 | type = AUDIT_APPARMOR_KILL; | 200 | type = AUDIT_APPARMOR_KILL; |
203 | 201 | ||
204 | if (!unconfined(profile)) | 202 | if (!unconfined(profile)) |
205 | sa->aad.profile = profile; | 203 | sa->aad->profile = profile; |
206 | 204 | ||
207 | aa_audit_msg(type, sa, cb); | 205 | aa_audit_msg(type, sa, cb); |
208 | 206 | ||
209 | if (sa->aad.type == AUDIT_APPARMOR_KILL) | 207 | if (sa->aad->type == AUDIT_APPARMOR_KILL) |
210 | (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current); | 208 | (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current); |
211 | 209 | ||
212 | if (sa->aad.type == AUDIT_APPARMOR_ALLOWED) | 210 | if (sa->aad->type == AUDIT_APPARMOR_ALLOWED) |
213 | return complain_error(sa->aad.error); | 211 | return complain_error(sa->aad->error); |
214 | 212 | ||
215 | return sa->aad.error; | 213 | return sa->aad->error; |
216 | } | 214 | } |