Skip to contentSkip to conversation

exec: do not call sched_mm_cid_after_execve() on exec fail

PATCH In review Jinchao Wang 2 participants 4 messages Dec 18, 2025 – Dec 25, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: do not call sched_mm_cid_after_execve() on exec fail

sched_mm_cid_after_execve() is called from the failure path of bprm_execve(). At that point exec has not completed successfully, so updating the mm CID state is incorrect and can trigger a panic, as reported by syzbot.

Remove the call from the exec failure path.

---
 fs/exec.c | 1 -
 1 file changed, 1 deletion(-)
fs/exec.c +0 -1
index 9d5ebc9d15b0..9044a75d26ab 100644
@@ -1773,7 +1773,6 @@ static int bprm_execve(struct linux_binprm *bprm)
 	if (bprm->point_of_no_return && !fatal_signal_pending(current))
 		force_fatal_sig(SIGSEGV);
 
-	sched_mm_cid_after_execve(current);
 	rseq_force_update();
 	current->in_execve = 0;
 
Signature · 1 line
2.43.0
#1 lore raw

On Thu, Dec 18, 2025 at 11:23:23AM +0800, Jinchao Wang wrote:

Hi, mathieu

Please review this patch for mm_cid.

The syzbot test failure occurs because the syz-repro breaks the system state, causing all user commands to fail. Actually the syz-rero can only trigger a panic or error.

The broken system can be recovered by resetting binfmt_misc with:

echo 0 > /proc/sys/fs/binfmt_misc/status

Thanks.

Quoted 29 lines

sched_mm_cid_after_execve() is called from the failure path of bprm_execve(). At that point exec has not completed successfully, so updating the mm CID state is incorrect and can trigger a panic, as reported by syzbot.

Remove the call from the exec failure path.

---
 fs/exec.c | 1 -
 1 file changed, 1 deletion(-)
fs/exec.c +0 -1
index 9d5ebc9d15b0..9044a75d26ab 100644
@@ -1773,7 +1773,6 @@ static int bprm_execve(struct linux_binprm *bprm)
 	if (bprm->point_of_no_return && !fatal_signal_pending(current))
 		force_fatal_sig(SIGSEGV);
 
-	sched_mm_cid_after_execve(current);
 	rseq_force_update();
 	current->in_execve = 0;
 
Signature · 1 line
2.43.0
#2 lore raw
Quoted 5 lines · Jinchao Wang

On Thu, Dec 18, 2025 at 11:23:23AM +0800, Jinchao Wang wrote:

Hi, mathieu

Please review this patch for mm_cid.

Nack. Your fix lacks context and removes a needed call in the common case to fix what I understand to be a init task issue.

See this patch instead which addresses an issue very similar to yours removing the relevant sched_mm_cid_after_exec() call:

https://lore.kernel.org/lkml/[email protected]/

I added Thomas Gleixner in CC.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
#3 lore raw
Quoted 7 lines · Mathieu Desnoyers
Quoted 5 lines · Jinchao Wang

On Thu, Dec 18, 2025 at 11:23:23AM +0800, Jinchao Wang wrote:

Hi, mathieu

Please review this patch for mm_cid.

Quoted 7 lines

Nack. Your fix lacks context and removes a needed call in the common case to fix what I understand to be a init task issue.

See this patch instead which addresses an issue very similar to yours removing the relevant sched_mm_cid_after_exec() call:

https://lore.kernel.org/lkml/[email protected]/

Yes, they are same issue and this patch works.
Thanks.

Quoted 11 lines

I added Thomas Gleixner in CC.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com