summaryrefslogtreecommitdiffstats
path: root/kernel/iomem.c
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2021-12-09 17:46:07 +0100
committerPaul Moore <paul@paul-moore.com>2021-12-15 19:16:39 +0100
commitf4b3ee3c85551d2d343a3ba159304066523f730f (patch)
tree5fb35cfc0d581cb3eed2368cac9d0d414e6536ee /kernel/iomem.c
parentaudit: return early if the filter rule has a lower priority (diff)
downloadlinux-f4b3ee3c85551d2d343a3ba159304066523f730f.tar.xz
linux-f4b3ee3c85551d2d343a3ba159304066523f730f.zip
audit: improve robustness of the audit queue handling
If the audit daemon were ever to get stuck in a stopped state the kernel's kauditd_thread() could get blocked attempting to send audit records to the userspace audit daemon. With the kernel thread blocked it is possible that the audit queue could grow unbounded as certain audit record generating events must be exempt from the queue limits else the system enter a deadlock state. This patch resolves this problem by lowering the kernel thread's socket sending timeout from MAX_SCHEDULE_TIMEOUT to HZ/10 and tweaks the kauditd_send_queue() function to better manage the various audit queues when connection problems occur between the kernel and the audit daemon. With this patch, the backlog may temporarily grow beyond the defined limits when the audit daemon is stopped and the system is under heavy audit pressure, but kauditd_thread() will continue to make progress and drain the queues as it would for other connection problems. For example, with the audit daemon put into a stopped state and the system configured to audit every syscall it was still possible to shutdown the system without a kernel panic, deadlock, etc.; granted, the system was slow to shutdown but that is to be expected given the extreme pressure of recording every syscall. The timeout value of HZ/10 was chosen primarily through experimentation and this developer's "gut feeling". There is likely no one perfect value, but as this scenario is limited in scope (root privileges would be needed to send SIGSTOP to the audit daemon), it is likely not worth exposing this as a tunable at present. This can always be done at a later date if it proves necessary. Cc: stable@vger.kernel.org Fixes: 5b52330bbfe63 ("audit: fix auditd/kernel connection state tracking") Reported-by: Gaosheng Cui <cuigaosheng1@huawei.com> Tested-by: Gaosheng Cui <cuigaosheng1@huawei.com> Reviewed-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/iomem.c')
0 files changed, 0 insertions, 0 deletions