lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174342099606.14745.8266804278210076386.tip-bot2@tip-bot2>
Date: Mon, 31 Mar 2025 11:36:36 -0000
From: "tip-bot2 for Mathieu Desnoyers" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 Ingo Molnar <mingo@...nel.org>, x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] rseq: Eliminate useless task_work on execve

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     328802738e1cd091d04076317f3c2174125c5916
Gitweb:        https://git.kernel.org/tip/328802738e1cd091d04076317f3c2174125c5916
Author:        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
AuthorDate:    Thu, 27 Mar 2025 09:29:45 -04:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Mon, 31 Mar 2025 12:30:01 +02:00

rseq: Eliminate useless task_work on execve

Eliminate a useless task_work on execve by moving the call to
rseq_set_notify_resume() from sched_mm_cid_after_execve() to the error
path of bprm_execve().

The call to rseq_set_notify_resume() from sched_mm_cid_after_execve() is
pointless in the success case, because rseq_execve() will clear the rseq
pointer before returning to userspace.

sched_mm_cid_after_execve() is called from both the success and error
paths of bprm_execve(). The call to rseq_set_notify_resume() is needed
on error because the mm_cid may have changed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Link: https://lore.kernel.org/r/20250327132945.1558783-1-mathieu.desnoyers@efficios.com
---
 fs/exec.c           | 3 ++-
 kernel/sched/core.c | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index f45859a..f511409 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1859,10 +1859,10 @@ static int bprm_execve(struct linux_binprm *bprm)
 		goto out;
 
 	sched_mm_cid_after_execve(current);
+	rseq_execve(current);
 	/* execve succeeded */
 	current->fs->in_exec = 0;
 	current->in_execve = 0;
-	rseq_execve(current);
 	user_events_execve(current);
 	acct_update_integrals(current);
 	task_numa_free(current, false);
@@ -1879,6 +1879,7 @@ out:
 		force_fatal_sig(SIGSEGV);
 
 	sched_mm_cid_after_execve(current);
+	rseq_set_notify_resume(current);
 	current->fs->in_exec = 0;
 	current->in_execve = 0;
 
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cfaca30..c81cf64 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10703,7 +10703,6 @@ void sched_mm_cid_after_execve(struct task_struct *t)
 		smp_mb();
 		t->last_mm_cid = t->mm_cid = mm_cid_get(rq, t, mm);
 	}
-	rseq_set_notify_resume(t);
 }
 
 void sched_mm_cid_fork(struct task_struct *t)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ