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: <20241025100700.3714552-8-ruanjinjie@huawei.com>
Date: Fri, 25 Oct 2024 18:06:48 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <oleg@...hat.com>, <linux@...linux.org.uk>, <will@...nel.org>,
	<mark.rutland@....com>, <catalin.marinas@....com>, <sstabellini@...nel.org>,
	<maz@...nel.org>, <tglx@...utronix.de>, <peterz@...radead.org>,
	<luto@...nel.org>, <kees@...nel.org>, <wad@...omium.org>,
	<akpm@...ux-foundation.org>, <samitolvanen@...gle.com>, <arnd@...db.de>,
	<ojeda@...nel.org>, <rppt@...nel.org>, <hca@...ux.ibm.com>,
	<aliceryhl@...gle.com>, <samuel.holland@...ive.com>, <paulmck@...nel.org>,
	<aquini@...hat.com>, <petr.pavlu@...e.com>, <ruanjinjie@...wei.com>,
	<viro@...iv.linux.org.uk>, <rmk+kernel@...linux.org.uk>, <ardb@...nel.org>,
	<wangkefeng.wang@...wei.com>, <surenb@...gle.com>,
	<linus.walleij@...aro.org>, <yangyj.ee@...il.com>, <broonie@...nel.org>,
	<mbenes@...e.cz>, <puranjay@...nel.org>, <pcc@...gle.com>,
	<guohanjun@...wei.com>, <sudeep.holla@....com>,
	<Jonathan.Cameron@...wei.com>, <prarit@...hat.com>, <liuwei09@...tc.cn>,
	<dwmw@...zon.co.uk>, <oliver.upton@...ux.dev>, <kristina.martsenko@....com>,
	<ptosi@...gle.com>, <frederic@...nel.org>, <vschneid@...hat.com>,
	<thiago.bauermann@...aro.org>, <joey.gouly@....com>,
	<liuyuntao12@...wei.com>, <leobras@...hat.com>,
	<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
	<xen-devel@...ts.xenproject.org>
Subject: [PATCH -next v4 07/19] arm64: entry: Call arm64_preempt_schedule_irq() only if irqs enabled

Only if irqs are enabled when the interrupt trapped, there may be
a chance to reschedule after the interrupt has been handled, so move
arm64_preempt_schedule_irq() into regs_irqs_disabled() check false
if block.

As Mark pointed out, this change will have the following key impact:

    "We will not preempt when taking interrupts from a region of kernel
    code where IRQs are enabled but RCU is not watching, matching the
    behaviour of the generic entry code.

    This has the potential to introduce livelock if we can ever have a
    screaming interrupt in such a region, so we'll need to go figure out
    whether that's actually a problem.

    Having this as a separate patch will make it easier to test/bisect
    for that specifically."

Suggested-by: Mark Rutland <mark.rutland@....com>
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
 arch/arm64/kernel/entry-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index e0380812d71e..b57f6dc66115 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -114,8 +114,6 @@ static void __sched arm64_preempt_schedule_irq(void)
 static void noinstr exit_to_kernel_mode(struct pt_regs *regs,
 					irqentry_state_t state)
 {
-	arm64_preempt_schedule_irq();
-
 	mte_check_tfsr_exit();
 
 	lockdep_assert_irqs_disabled();
@@ -129,6 +127,8 @@ static void noinstr exit_to_kernel_mode(struct pt_regs *regs,
 			return;
 		}
 
+		arm64_preempt_schedule_irq();
+
 		trace_hardirqs_on();
 	} else {
 		if (state.exit_rcu)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ