提交 3bcac026 编写于 作者: D David Howells 提交者: James Morris

SELinux: Don't flush inherited SIGKILL during execve()

Don't flush inherited SIGKILL during execve() in SELinux's post cred commit
hook.  This isn't really a security problem: if the SIGKILL came before the
credentials were changed, then we were right to receive it at the time, and
should honour it; if it came after the creds were changed, then we definitely
should honour it; and in any case, all that will happen is that the process
will be scrapped before it ever returns to userspace.
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 88c48db9
...@@ -1875,6 +1875,7 @@ extern void sched_dead(struct task_struct *p); ...@@ -1875,6 +1875,7 @@ extern void sched_dead(struct task_struct *p);
extern void proc_caches_init(void); extern void proc_caches_init(void);
extern void flush_signals(struct task_struct *); extern void flush_signals(struct task_struct *);
extern void __flush_signals(struct task_struct *);
extern void ignore_signals(struct task_struct *); extern void ignore_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *, int force_default); extern void flush_signal_handlers(struct task_struct *, int force_default);
extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info);
......
...@@ -238,14 +238,19 @@ void flush_sigqueue(struct sigpending *queue) ...@@ -238,14 +238,19 @@ void flush_sigqueue(struct sigpending *queue)
/* /*
* Flush all pending signals for a task. * Flush all pending signals for a task.
*/ */
void __flush_signals(struct task_struct *t)
{
clear_tsk_thread_flag(t, TIF_SIGPENDING);
flush_sigqueue(&t->pending);
flush_sigqueue(&t->signal->shared_pending);
}
void flush_signals(struct task_struct *t) void flush_signals(struct task_struct *t)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t->sighand->siglock, flags); spin_lock_irqsave(&t->sighand->siglock, flags);
clear_tsk_thread_flag(t, TIF_SIGPENDING); __flush_signals(t);
flush_sigqueue(&t->pending);
flush_sigqueue(&t->signal->shared_pending);
spin_unlock_irqrestore(&t->sighand->siglock, flags); spin_unlock_irqrestore(&t->sighand->siglock, flags);
} }
......
...@@ -2394,11 +2394,12 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) ...@@ -2394,11 +2394,12 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
memset(&itimer, 0, sizeof itimer); memset(&itimer, 0, sizeof itimer);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
do_setitimer(i, &itimer, NULL); do_setitimer(i, &itimer, NULL);
flush_signals(current);
spin_lock_irq(&current->sighand->siglock); spin_lock_irq(&current->sighand->siglock);
flush_signal_handlers(current, 1); if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) {
sigemptyset(&current->blocked); __flush_signals(current);
recalc_sigpending(); flush_signal_handlers(current, 1);
sigemptyset(&current->blocked);
}
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册