提交 f910fde7 编写于 作者: R Richard Guy Briggs 提交者: Eric Paris

audit: add kernel set-up parameter to override default backlog limit

The default audit_backlog_limit is 64.  This was a reasonable limit at one time.

systemd causes so much audit queue activity on startup that auditd doesn't
start before the backlog queue has already overflowed by more than a factor of
2.  On a system with audit= not set on the kernel command line, this isn't an
issue since that history isn't kept for auditd when it is available.  On a
system with audit=1 set on the kernel command line, kaudit tries to keep that
history until auditd is able to drain the queue.

This default can be changed by the "-b" option in audit.rules once the system
has booted, but won't help with lost messages on boot.

One way to solve this would be to increase the default backlog queue size to
avoid losing any messages before auditd is able to consume them.  This would
be overkill to the embedded community and insufficient for some servers.

Another way to solve it might be to add a kconfig option to set the default
based on the system type.  An embedded system would get the current (or
smaller) default, while Workstations might get more than now and servers might
get more.

None of these solutions helps if a system's compiled default is too small to
see the lost messages without compiling a new kernel.

This patch adds a kernel set-up parameter (audit already has one to
enable/disable it) "audit_backlog_limit=<n>" that overrides the default to
allow the system administrator to set the backlog limit.
Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
Signed-off-by: NEric Paris <eparis@redhat.com>
上级 a106fb0c
......@@ -467,6 +467,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
Format: { "0" | "1" } (0 = disabled, 1 = enabled)
Default: unset
audit_backlog_limit= [KNL] Set the audit queue size limit.
Format: <int> (must be >=0)
Default: 64
baycom_epp= [HW,AX25]
Format: <io>,<mode>
......
......@@ -1099,9 +1099,27 @@ static int __init audit_enable(char *str)
return 1;
}
__setup("audit=", audit_enable);
/* Process kernel command-line parameter at boot time.
* audit_backlog_limit=<n> */
static int __init audit_backlog_limit_set(char *str)
{
long int audit_backlog_limit_arg;
pr_info("audit_backlog_limit: ");
if (kstrtol(str, 0, &audit_backlog_limit_arg)) {
printk("using default of %d, unable to parse %s\n",
audit_backlog_limit, str);
return 1;
}
if (audit_backlog_limit_arg >= 0)
audit_backlog_limit = (int)audit_backlog_limit_arg;
printk("%d\n", audit_backlog_limit);
return 1;
}
__setup("audit_backlog_limit=", audit_backlog_limit_set);
static void audit_buffer_free(struct audit_buffer *ab)
{
unsigned long flags;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册