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: <1493020011-18536-1-git-send-email-yu.c.chen@intel.com>
Date:   Mon, 24 Apr 2017 15:46:51 +0800
From:   Chen Yu <yu.c.chen@...el.com>
To:     Chen Yu <yu.c.chen@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
        Len Brown <len.brown@...el.com>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH][RFC] x86: Fix the irq affinity in fixup_cpus

fixup_cpus() is to set appropriate irq affinity once the CPU
has been brought down, however we should also adjust the
desc->irq_common_data.affinity otherwise we will get an
incorrect irqmask during cpu offline:

cat /proc/irq/31/smp_affinity
00000000,80000000
echo 0 > /sys/devices/system/cpu/cpu31/online
cat /proc/irq/31/smp_affinity
00000000,80000000

This might bring potential problems, as reported we
saw plenty of irq flood during hibernation restore:
do_IRQ: 1.51 No irq handler for vector
Maybe it is due to some drivers get incorrect irq mask
during hibernation.

Fix this by invoking the interface of irq_set_affinity_locked()
to also update the desc->irq_common_data.affinity.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=188281
Reported-and-tested-by: Thomas Mitterfellner <thomas@...terfellner.at>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Borislav Petkov <bp@...e.de>
Cc: Len Brown <len.brown@...el.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Cc: x86@...nel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Chen Yu <yu.c.chen@...el.com>
---
 arch/x86/kernel/irq.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 4d8183b..a108ed2 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -480,13 +480,14 @@ void fixup_irqs(void)
 		if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
 			chip->irq_mask(data);
 
-		if (chip->irq_set_affinity) {
-			ret = chip->irq_set_affinity(data, affinity, true);
-			if (ret == -ENOSPC)
+		ret = irq_set_affinity_locked(data, affinity, true);
+		if (ret) {
+			if (ret == -ENOSPC) {
 				pr_crit("IRQ %d set affinity failed because there are no available vectors.  The device assigned to this IRQ is unstable.\n", irq);
-		} else {
-			if (!(warned++))
-				set_affinity = 0;
+			} else {
+				if (!(warned++))
+					set_affinity = 0;
+			}
 		}
 
 		/*
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ