Commit 629f8205 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-20190730' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull pidfd fixes from Christian Brauner:
 "This makes setting the exit_state in exit_notify() consistent after
  fixing the pidfd polling race pre-rc1. Related to the race fix, this
  adds a WARN_ON() to do_notify_pidfd() to catch any future exit_state
  races.

  Last, this removes an obsolete comment from the pidfd tests"

* tag 'for-linus-20190730' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
  exit: make setting exit_state consistent
  pidfd: Add warning if exit_state is 0 during notification
  pidfd: remove obsolete comments from test
parents 0572d766 30b692d3
...@@ -734,9 +734,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead) ...@@ -734,9 +734,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
autoreap = true; autoreap = true;
} }
tsk->exit_state = autoreap ? EXIT_DEAD : EXIT_ZOMBIE; if (autoreap) {
if (tsk->exit_state == EXIT_DEAD) tsk->exit_state = EXIT_DEAD;
list_add(&tsk->ptrace_entry, &dead); list_add(&tsk->ptrace_entry, &dead);
}
/* mt-exec, de_thread() is waiting for group leader */ /* mt-exec, de_thread() is waiting for group leader */
if (unlikely(tsk->signal->notify_count < 0)) if (unlikely(tsk->signal->notify_count < 0))
......
...@@ -1885,6 +1885,7 @@ static void do_notify_pidfd(struct task_struct *task) ...@@ -1885,6 +1885,7 @@ static void do_notify_pidfd(struct task_struct *task)
{ {
struct pid *pid; struct pid *pid;
WARN_ON(task->exit_state == 0);
pid = task_pid(task); pid = task_pid(task);
wake_up_all(&pid->wait_pidfd); wake_up_all(&pid->wait_pidfd);
} }
......
...@@ -339,13 +339,9 @@ static int test_pidfd_send_signal_syscall_support(void) ...@@ -339,13 +339,9 @@ static int test_pidfd_send_signal_syscall_support(void)
ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0); ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0);
if (ret < 0) { if (ret < 0) {
/*
* pidfd_send_signal() will currently return ENOSYS when
* CONFIG_PROC_FS is not set.
*/
if (errno == ENOSYS) if (errno == ENOSYS)
ksft_exit_skip( ksft_exit_skip(
"%s test: pidfd_send_signal() syscall not supported (Ensure that CONFIG_PROC_FS=y is set)\n", "%s test: pidfd_send_signal() syscall not supported\n",
test_name); test_name);
ksft_exit_fail_msg("%s test: Failed to send signal\n", ksft_exit_fail_msg("%s test: Failed to send signal\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment