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] [day] [month] [year] [list]
Message-ID: <156681996837.3355.8063649574269386994.tip-bot2@tip-bot2>
Date:   Mon, 26 Aug 2019 11:46:08 -0000
From:   tip-bot2 for Thomas Gleixner <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Rahul Tanwar <rahul.tanwar@...ux.intel.com>,
        Andy Shevchenko <andriy.shevchenko@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Peter Zijlstra <peterz@...radead.org>, alan@...ux.intel.com,
        bp@...en8.de, cheol.yong.kim@...el.com, qi-ming.wu@...el.com,
        rahul.tanwar@...el.com, rppt@...ux.ibm.com, tony.luck@...el.com,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Subject: [tip: x86/urgent] x86/apic: Fix arch_dynirq_lower_bound() bug for DT
 enabled machines

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     3e5bedc2c258341702ddffbd7688c5e6eb01eafa
Gitweb:        https://git.kernel.org/tip/3e5bedc2c258341702ddffbd7688c5e6eb01eafa
Author:        Thomas Gleixner <tglx@...utronix.de>
AuthorDate:    Wed, 21 Aug 2019 15:16:31 +02:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Mon, 26 Aug 2019 12:11:23 +02:00

x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines

Rahul Tanwar reported the following bug on DT systems:

> 'ioapic_dynirq_base' contains the virtual IRQ base number. Presently, it is
> updated to the end of hardware IRQ numbers but this is done only when IOAPIC
> configuration type is IOAPIC_DOMAIN_LEGACY or IOAPIC_DOMAIN_STRICT. There is
> a third type IOAPIC_DOMAIN_DYNAMIC which applies when IOAPIC configuration
> comes from devicetree.
>
> See dtb_add_ioapic() in arch/x86/kernel/devicetree.c
>
> In case of IOAPIC_DOMAIN_DYNAMIC (DT/OF based system), 'ioapic_dynirq_base'
> remains to zero initialized value. This means that for OF based systems,
> virtual IRQ base will get set to zero.

Such systems will very likely not even boot.

For DT enabled machines ioapic_dynirq_base is irrelevant and not
updated, so simply map the IRQ base 1:1 instead.

Reported-by: Rahul Tanwar <rahul.tanwar@...ux.intel.com>
Tested-by: Rahul Tanwar <rahul.tanwar@...ux.intel.com>
Tested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: alan@...ux.intel.com
Cc: bp@...en8.de
Cc: cheol.yong.kim@...el.com
Cc: qi-ming.wu@...el.com
Cc: rahul.tanwar@...el.com
Cc: rppt@...ux.ibm.com
Cc: tony.luck@...el.com
Link: http://lkml.kernel.org/r/20190821081330.1187-1-rahul.tanwar@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/kernel/apic/io_apic.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index c7bb6c6..d6af97f 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2438,7 +2438,13 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
 	 * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
 	 * gsi_top if ioapic_dynirq_base hasn't been initialized yet.
 	 */
-	return ioapic_initialized ? ioapic_dynirq_base : gsi_top;
+	if (!ioapic_initialized)
+		return gsi_top;
+	/*
+	 * For DT enabled machines ioapic_dynirq_base is irrelevant and not
+	 * updated. So simply return @from if ioapic_dynirq_base == 0.
+	 */
+	return ioapic_dynirq_base ? : from;
 }
 
 #ifdef CONFIG_X86_32

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ