|
@@ -211,7 +211,7 @@ static inline void print_ipv4_addr(struct audit_buffer *ab, __be32 addr,
|
|
static void dump_common_audit_data(struct audit_buffer *ab,
|
|
static void dump_common_audit_data(struct audit_buffer *ab,
|
|
struct common_audit_data *a)
|
|
struct common_audit_data *a)
|
|
{
|
|
{
|
|
- struct task_struct *tsk = current;
|
|
|
|
|
|
+ char comm[sizeof(current->comm)];
|
|
|
|
|
|
/*
|
|
/*
|
|
* To keep stack sizes in check force programers to notice if they
|
|
* To keep stack sizes in check force programers to notice if they
|
|
@@ -220,8 +220,8 @@ static void dump_common_audit_data(struct audit_buffer *ab,
|
|
*/
|
|
*/
|
|
BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
|
|
BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
|
|
|
|
|
|
- audit_log_format(ab, " pid=%d comm=", task_pid_nr(tsk));
|
|
|
|
- audit_log_untrustedstring(ab, tsk->comm);
|
|
|
|
|
|
+ audit_log_format(ab, " pid=%d comm=", task_pid_nr(current));
|
|
|
|
+ audit_log_untrustedstring(ab, memcpy(comm, current->comm, sizeof(comm)));
|
|
|
|
|
|
switch (a->type) {
|
|
switch (a->type) {
|
|
case LSM_AUDIT_DATA_NONE:
|
|
case LSM_AUDIT_DATA_NONE:
|
|
@@ -276,16 +276,19 @@ static void dump_common_audit_data(struct audit_buffer *ab,
|
|
audit_log_format(ab, " ino=%lu", inode->i_ino);
|
|
audit_log_format(ab, " ino=%lu", inode->i_ino);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case LSM_AUDIT_DATA_TASK:
|
|
|
|
- tsk = a->u.tsk;
|
|
|
|
|
|
+ case LSM_AUDIT_DATA_TASK: {
|
|
|
|
+ struct task_struct *tsk = a->u.tsk;
|
|
if (tsk) {
|
|
if (tsk) {
|
|
pid_t pid = task_pid_nr(tsk);
|
|
pid_t pid = task_pid_nr(tsk);
|
|
if (pid) {
|
|
if (pid) {
|
|
|
|
+ char comm[sizeof(tsk->comm)];
|
|
audit_log_format(ab, " pid=%d comm=", pid);
|
|
audit_log_format(ab, " pid=%d comm=", pid);
|
|
- audit_log_untrustedstring(ab, tsk->comm);
|
|
|
|
|
|
+ audit_log_untrustedstring(ab,
|
|
|
|
+ memcpy(comm, tsk->comm, sizeof(comm)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ }
|
|
case LSM_AUDIT_DATA_NET:
|
|
case LSM_AUDIT_DATA_NET:
|
|
if (a->u.net->sk) {
|
|
if (a->u.net->sk) {
|
|
struct sock *sk = a->u.net->sk;
|
|
struct sock *sk = a->u.net->sk;
|