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-next>] [day] [month] [year] [list]
Message-ID: <20230526184823.1230974-1-ericchancf@google.com>
Date:   Fri, 26 May 2023 18:48:23 +0000
From:   Eric Chan <ericchancf@...gle.com>
To:     Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>
Cc:     Mark Rutland <mark.rutland@....com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Mark Brown <broonie@...nel.org>,
        Frederic Weisbecker <frederic@...nel.org>,
        Mukesh Ojha <quic_mojha@...cinc.com>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Eric Chan <ericchancf@...gle.com>
Subject: [PATCH] arm64: Fix 'lock held when returning to user space' lockdep warning

The arm64 architecture lacks support for CONFIG_GENERIC_ENTRY, resulting
in the failure to report the lockdep warning
"lock held when returning to user space" when lockdep is enabled.

Rename the function to align with exit_to_user_mode_prepare in
kernel/entry/common.c to improve readability.

Signed-off-by: Eric Chan <ericchancf@...gle.com>
---
 arch/arm64/kernel/entry-common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index 3af3c01c93a6..9d6827201b6c 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -126,7 +126,7 @@ static __always_inline void __exit_to_user_mode(void)
 	lockdep_hardirqs_on(CALLER_ADDR0);
 }
 
-static __always_inline void prepare_exit_to_user_mode(struct pt_regs *regs)
+static __always_inline void exit_to_user_mode_prepare(struct pt_regs *regs)
 {
 	unsigned long flags;
 
@@ -135,11 +135,13 @@ static __always_inline void prepare_exit_to_user_mode(struct pt_regs *regs)
 	flags = read_thread_flags();
 	if (unlikely(flags & _TIF_WORK_MASK))
 		do_notify_resume(regs, flags);
+
+	lockdep_sys_exit();
 }
 
 static __always_inline void exit_to_user_mode(struct pt_regs *regs)
 {
-	prepare_exit_to_user_mode(regs);
+	exit_to_user_mode_prepare(regs);
 	mte_check_tfsr_exit();
 	__exit_to_user_mode();
 }
-- 
2.41.0.rc0.172.g3f132b7071-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ