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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <167952533112.5837.7165959544411828393.tip-bot2@tip-bot2>
Date:   Wed, 22 Mar 2023 22:48:51 -0000
From:   "tip-bot2 for Josh Poimboeuf" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Josh Poimboeuf <jpoimboe@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Petr Mladek <pmladek@...e.com>,
        "Seth Forshee (DigitalOcean)" <sforshee@...nel.org>,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] livepatch: Skip task_call_func() for current task

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

Commit-ID:     383439d3d400d4c5a7ffb4495124adc6be6a05e2
Gitweb:        https://git.kernel.org/tip/383439d3d400d4c5a7ffb4495124adc6be6a05e2
Author:        Josh Poimboeuf <jpoimboe@...nel.org>
AuthorDate:    Fri, 24 Feb 2023 08:49:59 -08:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 22 Mar 2023 17:09:28 +01:00

livepatch: Skip task_call_func() for current task

The current task doesn't need the scheduler's protection to unwind its
own stack.

Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Petr Mladek <pmladek@...e.com>
Tested-by: Seth Forshee (DigitalOcean) <sforshee@...nel.org>
Link: https://lore.kernel.org/r/4b92e793462d532a05f03767151fa29db3e68e13.1677257135.git.jpoimboe@kernel.org
---
 kernel/livepatch/transition.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index 135fc73..824e2e3 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -312,7 +312,11 @@ static bool klp_try_switch_task(struct task_struct *task)
 	 * functions.  If all goes well, switch the task to the target patch
 	 * state.
 	 */
-	ret = task_call_func(task, klp_check_and_switch_task, &old_name);
+	if (task == current)
+		ret = klp_check_and_switch_task(current, &old_name);
+	else
+		ret = task_call_func(task, klp_check_and_switch_task, &old_name);
+
 	switch (ret) {
 	case 0:		/* success */
 		break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ