提交 291041e9 编写于 作者: A Al Viro 提交者: Linus Torvalds

fix bogus reporting of signals by audit

Async signals should not be reported as sent by current in audit log.  As
it is, we call audit_signal_info() too early in check_kill_permission().
Note that check_kill_permission() has that test already - it needs to know
if it should apply current-based permission checks.  So the solution is to
move the call of audit_signal_info() between those.

Bogosity in question is easily reproduced - add a rule watching for e.g.
kill(2) from specific process (so that audit_signal_info() would not
short-circuit to nothing), say load_policy, watch the bogus OBJ_PID entry
in audit logs claiming that write(2) on selinuxfs file issued by
load_policy(8) had somehow managed to send a signal to syslogd...
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Acked-by: NSteve Grubb <sgrubb@redhat.com>
Acked-by: NEric Paris <eparis@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7a5c5d57
...@@ -531,18 +531,18 @@ static int check_kill_permission(int sig, struct siginfo *info, ...@@ -531,18 +531,18 @@ static int check_kill_permission(int sig, struct siginfo *info,
if (!valid_signal(sig)) if (!valid_signal(sig))
return error; return error;
if (info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info))) {
error = audit_signal_info(sig, t); /* Let audit system see the signal */ error = audit_signal_info(sig, t); /* Let audit system see the signal */
if (error) if (error)
return error; return error;
error = -EPERM; error = -EPERM;
if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info))) if (((sig != SIGCONT) ||
&& ((sig != SIGCONT) ||
(process_session(current) != process_session(t))) (process_session(current) != process_session(t)))
&& (current->euid ^ t->suid) && (current->euid ^ t->uid) && (current->euid ^ t->suid) && (current->euid ^ t->uid)
&& (current->uid ^ t->suid) && (current->uid ^ t->uid) && (current->uid ^ t->suid) && (current->uid ^ t->uid)
&& !capable(CAP_KILL)) && !capable(CAP_KILL))
return error; return error;
}
return security_task_kill(t, info, sig, 0); return security_task_kill(t, info, sig, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册