[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <167267480086.4906.14665352998737768536.tip-bot2@tip-bot2>
Date: Mon, 02 Jan 2023 15:53:20 -0000
From: "tip-bot2 for Mathieu Desnoyers" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: kernel test robot <yujie.liu@...el.com>,
Borislav Petkov <bp@...en8.de>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/rseq: Fix concurrency ID handling of
usermodehelper kthreads
The following commit has been merged into the sched/core branch of tip:
Commit-ID: bbd0b031509b880b4e9a880bb27ca2a30ad081ab
Gitweb: https://git.kernel.org/tip/bbd0b031509b880b4e9a880bb27ca2a30ad081ab
Author: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
AuthorDate: Mon, 02 Jan 2023 10:12:16 -05:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Mon, 02 Jan 2023 16:34:12 +01:00
sched/rseq: Fix concurrency ID handling of usermodehelper kthreads
sched_mm_cid_after_execve() does not expect NULL t->mm, but it may happen
if a usermodehelper kthread fails when attempting to execute a binary.
sched_mm_cid_fork() can be issued from a usermodehelper kthread, which
has t->flags PF_KTHREAD set.
Fixes: af7f588d8f73 ("sched: Introduce per-memory-map concurrency ID")
Reported-by: kernel test robot <yujie.liu@...el.com>
Reported-by: Borislav Petkov <bp@...en8.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://lore.kernel.org/oe-lkp/202212301353.5c959d72-yujie.liu@intel.com
---
kernel/sched/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 048ec24..f99ee69 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -11343,8 +11343,8 @@ void sched_mm_cid_after_execve(struct task_struct *t)
struct mm_struct *mm = t->mm;
unsigned long flags;
- WARN_ON_ONCE((t->flags & PF_KTHREAD) || !t->mm);
-
+ if (!mm)
+ return;
local_irq_save(flags);
t->mm_cid = mm_cid_get(mm);
t->mm_cid_active = 1;
@@ -11354,7 +11354,7 @@ void sched_mm_cid_after_execve(struct task_struct *t)
void sched_mm_cid_fork(struct task_struct *t)
{
- WARN_ON_ONCE((t->flags & PF_KTHREAD) || !t->mm || t->mm_cid != -1);
+ WARN_ON_ONCE(!t->mm || t->mm_cid != -1);
t->mm_cid_active = 1;
}
#endif
Powered by blists - more mailing lists