From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: syzbot+6cd18e123583550cf469@syzkaller.appspotmail.com,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] freezer,umh: Fix call_usermode_helper_exec() vs SIGKILL
Date: Wed, 15 Feb 2023 10:33:03 -0000 [thread overview]
Message-ID: <167645718365.4906.7791868073788545242.tip-bot2@tip-bot2> (raw)
In-Reply-To: <Y90ar35uKQoUrLEK@hirez.programming.kicks-ass.net>
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: eedeb787ebb53de5c5dcf7b7b39d01bf1b0f037d
Gitweb: https://git.kernel.org/tip/eedeb787ebb53de5c5dcf7b7b39d01bf1b0f037d
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Fri, 03 Feb 2023 15:31:11 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 13 Feb 2023 16:36:14 +01:00
freezer,umh: Fix call_usermode_helper_exec() vs SIGKILL
Tetsuo-San noted that commit f5d39b020809 ("freezer,sched: Rewrite
core freezer logic") broke call_usermodehelper_exec() for the KILLABLE
case.
Specifically it was missed that the second, unconditional,
wait_for_completion() was not optional and ensures the on-stack
completion is unused before going out-of-scope.
Fixes: f5d39b020809 ("freezer,sched: Rewrite core freezer logic")
Reported-by: syzbot+6cd18e123583550cf469@syzkaller.appspotmail.com
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Debugged-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/Y90ar35uKQoUrLEK@hirez.programming.kicks-ass.net
---
kernel/umh.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/kernel/umh.c b/kernel/umh.c
index 8506315..fbf872c 100644
--- a/kernel/umh.c
+++ b/kernel/umh.c
@@ -438,21 +438,27 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
if (wait == UMH_NO_WAIT) /* task has freed sub_info */
goto unlock;
- if (wait & UMH_KILLABLE)
- state |= TASK_KILLABLE;
-
if (wait & UMH_FREEZABLE)
state |= TASK_FREEZABLE;
- retval = wait_for_completion_state(&done, state);
- if (!retval)
- goto wait_done;
-
if (wait & UMH_KILLABLE) {
+ retval = wait_for_completion_state(&done, state | TASK_KILLABLE);
+ if (!retval)
+ goto wait_done;
+
/* umh_complete() will see NULL and free sub_info */
if (xchg(&sub_info->complete, NULL))
goto unlock;
+
+ /*
+ * fallthrough; in case of -ERESTARTSYS now do uninterruptible
+ * wait_for_completion_state(). Since umh_complete() shall call
+ * complete() in a moment if xchg() above returned NULL, this
+ * uninterruptible wait_for_completion_state() will not block
+ * SIGKILL'ed processes for long.
+ */
}
+ wait_for_completion_state(&done, state);
wait_done:
retval = sub_info->retval;
next prev parent reply other threads:[~2023-02-15 10:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230127014137.4906-1-hdanton@sina.com>
2023-02-03 10:22 ` [syzbot] WARNING: locking bug in umh_complete Tetsuo Handa
2023-02-03 10:48 ` Tetsuo Handa
2023-02-03 12:19 ` Peter Zijlstra
2023-02-03 12:30 ` Peter Zijlstra
2023-02-03 12:59 ` Tetsuo Handa
2023-02-03 14:31 ` Peter Zijlstra
2023-02-04 0:48 ` Tetsuo Handa
2023-02-06 15:51 ` Luis Chamberlain
2023-02-13 15:14 ` Peter Zijlstra
2023-02-13 15:27 ` Peter Zijlstra
2023-02-14 2:31 ` Schspa Shi
2023-02-21 21:54 ` Luis Chamberlain
2023-02-22 9:34 ` Peter Zijlstra
2023-02-27 7:57 ` Schspa Shi
2023-02-13 15:34 ` Peter Zijlstra
2023-02-14 11:16 ` Tetsuo Handa
2023-02-15 10:33 ` tip-bot2 for Peter Zijlstra [this message]
2023-02-03 12:00 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=167645718365.4906.7791868073788545242.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--cc=syzbot+6cd18e123583550cf469@syzkaller.appspotmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®