aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-01-11 14:55:15 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-01-11 14:55:15 -0800
commitc727b4c63c9bf33c65351bbcc738161edb444b24 (patch)
tree2e9f3d6cfa17f2fc62a64dbb41fff9e6baabfd24 /kernel/auditsc.c
parentMerge tag 'nfs-for-3.8-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs (diff)
parentlib/rbtree.c: avoid the use of non-static __always_inline (diff)
downloadlinux-dev-c727b4c63c9bf33c65351bbcc738161edb444b24.tar.xz
linux-dev-c727b4c63c9bf33c65351bbcc738161edb444b24.zip
Merge branch 'akpm' (incoming fixes from Andrew)
Merge misc fixes from Andrew Morton: "The audit fixes have been floating around for a while - Al and Eric aren't responding to either myself or Kees so I asked Kees to re-review them and here they are." * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (22 commits) lib/rbtree.c: avoid the use of non-static __always_inline MAINTAINERS: Omar had moved mm: compaction: partially revert capture of suitable high-order page linux/audit.h: move ptrace.h include to kernel header kernel/audit.c: avoid negative sleep durations audit: catch possible NULL audit buffers audit: create explicit AUDIT_SECCOMP event type MAINTAINERS: fix a status pattern MAINTAINERS: fix arch/arm/plat-omap/include/plat/omap_hwmod.h mm: thp: acquire the anon_vma rwsem for write during split mm: mmap: annotate vm_lock_anon_vma locking properly for lockdep lockdep, rwsem: provide down_write_nest_lock() arch/mn10300/Kconfig: select CONFIG_GENERIC_ATOMIC64 mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment mm: use aligned zone start for pfn_to_bitidx calculation fs/exec.c: work around icc miscompilation mm: compaction: fix echo 1 > compact_memory return error issue mm: memblock: fix wrong memmove size in memblock_merge_regions() drivers/video/ssd1307fb.c: fix bit order bug in the byte translation function mm: migrate: check page_count of THP before migrating ...
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index e37e6a12c5e3..a371f857a0a9 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1464,14 +1464,14 @@ static void show_special(struct audit_context *context, int *call_panic)
audit_log_end(ab);
ab = audit_log_start(context, GFP_KERNEL,
AUDIT_IPC_SET_PERM);
+ if (unlikely(!ab))
+ return;
audit_log_format(ab,
"qbytes=%lx ouid=%u ogid=%u mode=%#ho",
context->ipc.qbytes,
context->ipc.perm_uid,
context->ipc.perm_gid,
context->ipc.perm_mode);
- if (!ab)
- return;
}
break; }
case AUDIT_MQ_OPEN: {
@@ -2675,7 +2675,7 @@ void __audit_mmap_fd(int fd, int flags)
context->type = AUDIT_MMAP;
}
-static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
+static void audit_log_task(struct audit_buffer *ab)
{
kuid_t auid, uid;
kgid_t gid;
@@ -2693,6 +2693,11 @@ static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
audit_log_task_context(ab);
audit_log_format(ab, " pid=%d comm=", current->pid);
audit_log_untrustedstring(ab, current->comm);
+}
+
+static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
+{
+ audit_log_task(ab);
audit_log_format(ab, " reason=");
audit_log_string(ab, reason);
audit_log_format(ab, " sig=%ld", signr);
@@ -2715,6 +2720,8 @@ void audit_core_dumps(long signr)
return;
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
+ if (unlikely(!ab))
+ return;
audit_log_abend(ab, "memory violation", signr);
audit_log_end(ab);
}
@@ -2723,8 +2730,11 @@ void __audit_seccomp(unsigned long syscall, long signr, int code)
{
struct audit_buffer *ab;
- ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
- audit_log_abend(ab, "seccomp", signr);
+ ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP);
+ if (unlikely(!ab))
+ return;
+ audit_log_task(ab);
+ audit_log_format(ab, " sig=%ld", signr);
audit_log_format(ab, " syscall=%ld", syscall);
audit_log_format(ab, " compat=%d", is_compat_task());
audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));