projects/linux·commit 45dfb8a5

Merge tag 'task_work-2021-01-19' of git://git.kernel.dk/linux-block

45dfb8a5 · Linus Torvalds <[email protected]> · 2021-01-19 13:26:05 -08:00

Pull task_work fix from Jens Axboe:
 "The TIF_NOTIFY_SIGNAL change inadvertently removed the unconditional
  task_work run we had in get_signal().

  This caused a regression for some setups, since we're relying on eg
  ____fput() being run to close and release, for example, a pipe and
  wake the other end.

  For 5.11, I prefer the simple solution of just reinstating the
  unconditional run, even if it conceptually doesn't make much sense -
  if you need that kind of guarantee, you should be using TWA_SIGNAL
  instead of TWA_NOTIFY. But it's the trivial fix for 5.11, and would
  ensure that other potential gotchas/assumptions for task_work don't
  regress for 5.11.

  We're looking into further simplifying the task_work notifications for
  5.12 which would resolve that too"

* tag 'task_work-2021-01-19' of git://git.kernel.dk/linux-block:
  task_work: unconditionally run task_work from get_signal()
Commit
45dfb8a5659ad286c28fa59008271dbc4e5e3f2d
Parents
f419f031 · 35d0b389

Merge commit. Changes below are compared with the first parent: f419f031.

Changes

1 files changed · +3 −0

FileStatusAddDelContent
kernel/signal.cmodified+3−0View file

kernel/signal.c

View file
diff --git a/kernel/signal.c b/kernel/signal.c
index 5736c55..6b9c431 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2550,6 +2550,9 @@ bool get_signal(struct ksignal *ksig)
struct signal_struct *signal = current->signal;
int signr;
+ if (unlikely(current->task_works))
+ task_work_run();
+
/*
* For non-generic architectures, check for TIF_NOTIFY_SIGNAL so
* that the arch handlers don't all have to do it. If we get here