Skip to content

Commit 629f820

Browse files
committed
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
2 parents 0572d76 + 30b692d commit 629f820

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

kernel/exit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
734734
autoreap = true;
735735
}
736736

737-
tsk->exit_state = autoreap ? EXIT_DEAD : EXIT_ZOMBIE;
738-
if (tsk->exit_state == EXIT_DEAD)
737+
if (autoreap) {
738+
tsk->exit_state = EXIT_DEAD;
739739
list_add(&tsk->ptrace_entry, &dead);
740+
}
740741

741742
/* mt-exec, de_thread() is waiting for group leader */
742743
if (unlikely(tsk->signal->notify_count < 0))

kernel/signal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,7 @@ static void do_notify_pidfd(struct task_struct *task)
18851885
{
18861886
struct pid *pid;
18871887

1888+
WARN_ON(task->exit_state == 0);
18881889
pid = task_pid(task);
18891890
wake_up_all(&pid->wait_pidfd);
18901891
}

tools/testing/selftests/pidfd/pidfd_test.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,9 @@ static int test_pidfd_send_signal_syscall_support(void)
339339

340340
ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0);
341341
if (ret < 0) {
342-
/*
343-
* pidfd_send_signal() will currently return ENOSYS when
344-
* CONFIG_PROC_FS is not set.
345-
*/
346342
if (errno == ENOSYS)
347343
ksft_exit_skip(
348-
"%s test: pidfd_send_signal() syscall not supported (Ensure that CONFIG_PROC_FS=y is set)\n",
344+
"%s test: pidfd_send_signal() syscall not supported\n",
349345
test_name);
350346

351347
ksft_exit_fail_msg("%s test: Failed to send signal\n",

0 commit comments

Comments
 (0)