~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to security/apparmor/audit.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
static void audit_pre(struct audit_buffer *ab, void *ca)
116
116
{
117
117
        struct common_audit_data *sa = ca;
118
 
        struct task_struct *tsk = sa->tsk ? sa->tsk : current;
 
118
        struct task_struct *tsk = sa->aad->tsk ? sa->aad->tsk : current;
119
119
 
120
120
        if (aa_g_audit_header) {
121
121
                audit_log_format(ab, "apparmor=");
122
 
                audit_log_string(ab, aa_audit_type[sa->aad.type]);
 
122
                audit_log_string(ab, aa_audit_type[sa->aad->type]);
123
123
        }
124
124
 
125
 
        if (sa->aad.op) {
 
125
        if (sa->aad->op) {
126
126
                audit_log_format(ab, " operation=");
127
 
                audit_log_string(ab, op_table[sa->aad.op]);
 
127
                audit_log_string(ab, op_table[sa->aad->op]);
128
128
        }
129
129
 
130
 
        if (sa->aad.info) {
 
130
        if (sa->aad->info) {
131
131
                audit_log_format(ab, " info=");
132
 
                audit_log_string(ab, sa->aad.info);
133
 
                if (sa->aad.error)
134
 
                        audit_log_format(ab, " error=%d", sa->aad.error);
 
132
                audit_log_string(ab, sa->aad->info);
 
133
                if (sa->aad->error)
 
134
                        audit_log_format(ab, " error=%d", sa->aad->error);
135
135
        }
136
136
 
137
 
        if (sa->aad.profile) {
138
 
                struct aa_profile *profile = sa->aad.profile;
 
137
        if (sa->aad->profile) {
 
138
                struct aa_profile *profile = sa->aad->profile;
139
139
                pid_t pid;
140
140
                rcu_read_lock();
141
141
                pid = rcu_dereference(tsk->real_parent)->pid;
149
149
                audit_log_untrustedstring(ab, profile->base.hname);
150
150
        }
151
151
 
152
 
        if (sa->aad.name) {
 
152
        if (sa->aad->name) {
153
153
                audit_log_format(ab, " name=");
154
 
                audit_log_untrustedstring(ab, sa->aad.name);
155
 
        }
 
154
                audit_log_untrustedstring(ab, sa->aad->name);
 
155
        }
 
156
 
 
157
        if (sa->aad->tsk) {
 
158
                audit_log_format(ab, " pid=%d comm=", tsk->pid);
 
159
                audit_log_untrustedstring(ab, tsk->comm);
 
160
        }
 
161
 
156
162
}
157
163
 
158
164
/**
163
169
void aa_audit_msg(int type, struct common_audit_data *sa,
164
170
                  void (*cb) (struct audit_buffer *, void *))
165
171
{
166
 
        sa->aad.type = type;
167
 
        sa->lsm_pre_audit = audit_pre;
168
 
        sa->lsm_post_audit = cb;
169
 
        common_lsm_audit(sa);
 
172
        sa->aad->type = type;
 
173
        common_lsm_audit(sa, audit_pre, cb);
170
174
}
171
175
 
172
176
/**
188
192
        BUG_ON(!profile);
189
193
 
190
194
        if (type == AUDIT_APPARMOR_AUTO) {
191
 
                if (likely(!sa->aad.error)) {
 
195
                if (likely(!sa->aad->error)) {
192
196
                        if (AUDIT_MODE(profile) != AUDIT_ALL)
193
197
                                return 0;
194
198
                        type = AUDIT_APPARMOR_AUDIT;
200
204
        if (AUDIT_MODE(profile) == AUDIT_QUIET ||
201
205
            (type == AUDIT_APPARMOR_DENIED &&
202
206
             AUDIT_MODE(profile) == AUDIT_QUIET))
203
 
                return sa->aad.error;
 
207
                return sa->aad->error;
204
208
 
205
209
        if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED)
206
210
                type = AUDIT_APPARMOR_KILL;
207
211
 
208
212
        if (!unconfined(profile))
209
 
                sa->aad.profile = profile;
 
213
                sa->aad->profile = profile;
210
214
 
211
215
        aa_audit_msg(type, sa, cb);
212
216
 
213
 
        if (sa->aad.type == AUDIT_APPARMOR_KILL)
214
 
                (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current);
215
 
 
216
 
        if (sa->aad.type == AUDIT_APPARMOR_ALLOWED)
217
 
                return complain_error(sa->aad.error);
218
 
 
219
 
        return sa->aad.error;
 
217
        if (sa->aad->type == AUDIT_APPARMOR_KILL)
 
218
                (void)send_sig_info(SIGKILL, NULL,
 
219
                                    sa->aad->tsk ?  sa->aad->tsk : current);
 
220
 
 
221
        if (sa->aad->type == AUDIT_APPARMOR_ALLOWED)
 
222
                return complain_error(sa->aad->error);
 
223
 
 
224
        return sa->aad->error;
220
225
}