Skip to content

Commit a8086ad

Browse files
committed
Merge branch 'audit.b54' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b54' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current: [PATCH] Fix the bug of using AUDIT_STATUS_RATE_LIMIT when set fail, no error output. [PATCH] Fix the kernel panic of audit_filter_task when key field is set Re: [PATCH] the loginuid field should be output in all AUDIT_CONFIG_CHANGE audit messages kernel/audit.c control character detection is off-by-one [PATCH] Audit: Collect signal info when SIGUSR2 is sent to auditd
2 parents b2bbf43 + 20c6aaa commit a8086ad

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎kernel/audit.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
707707
if (status_get->mask & AUDIT_STATUS_ENABLED) {
708708
err = audit_set_enabled(status_get->enabled,
709709
loginuid, sessionid, sid);
710-
if (err < 0) return err;
710+
if (err < 0)
711+
return err;
711712
}
712713
if (status_get->mask & AUDIT_STATUS_FAILURE) {
713714
err = audit_set_failure(status_get->failure,
714715
loginuid, sessionid, sid);
715-
if (err < 0) return err;
716+
if (err < 0)
717+
return err;
716718
}
717719
if (status_get->mask & AUDIT_STATUS_PID) {
718720
int new_pid = status_get->pid;
@@ -725,9 +727,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
725727
audit_pid = new_pid;
726728
audit_nlk_pid = NETLINK_CB(skb).pid;
727729
}
728-
if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
730+
if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
729731
err = audit_set_rate_limit(status_get->rate_limit,
730732
loginuid, sessionid, sid);
733+
if (err < 0)
734+
return err;
735+
}
731736
if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
732737
err = audit_set_backlog_limit(status_get->backlog_limit,
733738
loginuid, sessionid, sid);
@@ -1366,7 +1371,7 @@ int audit_string_contains_control(const char *string, size_t len)
13661371
{
13671372
const unsigned char *p;
13681373
for (p = string; p < (const unsigned char *)string + len && *p; p++) {
1369-
if (*p == '"' || *p < 0x21 || *p > 0x7f)
1374+
if (*p == '"' || *p < 0x21 || *p > 0x7e)
13701375
return 1;
13711376
}
13721377
return 0;

‎kernel/auditfilter.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,11 @@ static void audit_update_watch(struct audit_parent *parent,
10221022
struct audit_buffer *ab;
10231023
ab = audit_log_start(NULL, GFP_KERNEL,
10241024
AUDIT_CONFIG_CHANGE);
1025+
audit_log_format(ab, "auid=%u ses=%u",
1026+
audit_get_loginuid(current),
1027+
audit_get_sessionid(current));
10251028
audit_log_format(ab,
1026-
"op=updated rules specifying path=");
1029+
" op=updated rules specifying path=");
10271030
audit_log_untrustedstring(ab, owatch->path);
10281031
audit_log_format(ab, " with dev=%u ino=%lu\n",
10291032
dev, ino);
@@ -1058,7 +1061,10 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
10581061
struct audit_buffer *ab;
10591062
ab = audit_log_start(NULL, GFP_KERNEL,
10601063
AUDIT_CONFIG_CHANGE);
1061-
audit_log_format(ab, "op=remove rule path=");
1064+
audit_log_format(ab, "auid=%u ses=%u",
1065+
audit_get_loginuid(current),
1066+
audit_get_sessionid(current));
1067+
audit_log_format(ab, " op=remove rule path=");
10621068
audit_log_untrustedstring(ab, w->path);
10631069
if (r->filterkey) {
10641070
audit_log_format(ab, " key=");

‎kernel/auditsc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static int audit_filter_rules(struct task_struct *tsk,
610610
if (!result)
611611
return 0;
612612
}
613-
if (rule->filterkey)
613+
if (rule->filterkey && ctx)
614614
ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC);
615615
switch (rule->action) {
616616
case AUDIT_NEVER: *state = AUDIT_DISABLED; break;
@@ -2375,7 +2375,7 @@ int __audit_signal_info(int sig, struct task_struct *t)
23752375
struct audit_context *ctx = tsk->audit_context;
23762376

23772377
if (audit_pid && t->tgid == audit_pid) {
2378-
if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {
2378+
if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) {
23792379
audit_sig_pid = tsk->pid;
23802380
if (tsk->loginuid != -1)
23812381
audit_sig_uid = tsk->loginuid;

0 commit comments

Comments
 (0)