History

audit: report audit wait metric in audit status reply

In environments where the preservation of audit events and predictable usage of system memory are prioritized, admins may use a combination of --backlog_wait_time and -b options at the risk of degraded performance resulting from backlog waiting. In some cases, this risk may be preferred to lost events or unbounded memory usage. Ideally, this risk can be mitigated by making adjustments when backlog waiting is detected. However, detection can be difficult using the currently available metrics. For example, an admin attempting to debug degraded performance may falsely believe a full backlog indicates backlog waiting. It may turn out the backlog frequently fills up but drains quickly. To make it easier to reliably track degraded performance to backlog waiting, this patch makes the following changes: Add a new field backlog_wait_time_total to the audit status reply. Initialize this field to zero. Add to this field the total time spent by the current task on scheduled timeouts while the backlog limit is exceeded. Reset field to zero upon request via AUDIT_SET. Tested on Ubuntu 18.04 using complementary changes to the audit-userspace and audit-testsuite: - https://github.com/linux-audit/audit-userspace/pull/134 - https://github.com/linux-audit/audit-testsuite/pull/97

Max Englander committed 6 years ago

Commit b43870c1 parent f1d9b232 files · +36 −17Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/audit.h+11−7
@@ -333,14 +333,15 @@ enum { · 332 unmodified lines
333333 };
334334
335335 /* Status symbols */
336− /* Mask values */
337−#define AUDIT_STATUS_ENABLED 0x0001
338−#define AUDIT_STATUS_FAILURE 0x0002
339−#define AUDIT_STATUS_PID 0x0004
336+ /* Mask values */
337+#define AUDIT_STATUS_ENABLED 0x0001
338+#define AUDIT_STATUS_FAILURE 0x0002
339+#define AUDIT_STATUS_PID 0x0004
340340 #define AUDIT_STATUS_RATE_LIMIT 0x0008
341−#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
342−#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020
343−#define AUDIT_STATUS_LOST 0x0040
341+#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
342+#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020
343+#define AUDIT_STATUS_LOST 0x0040
344+#define AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL 0x0080
344345
345346 #define AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT 0x00000001
346347 #define AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME 0x00000002
@@ -467,6 +468,9 @@ struct audit_status { · 120 unmodified lines
467468 __u32 feature_bitmap; /* bitmap of kernel audit features */
468469 };
469470 __u32 backlog_wait_time;/* message queue wait timeout */
471+ __u32 backlog_wait_time_actual;/* time spent waiting while
472+ * message limit exceeded
473+ */
470474 };
471475
472476 struct audit_features {