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
| ||
|
Date: Thu, 15 May 2014 09:25:04 -0400 From: Prarit Bhargava <prarit@...hat.com> To: linux-kernel@...r.kernel.org Cc: Yinghai Lu <yinghai@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org, Prarit Bhargava <prarit@...hat.com>, Andi Kleen <ak@...ux.intel.com>, "K. Y. Srinivasan" <kys@...rosoft.com>, "Steven Rostedt (Red Hat)" <rostedt@...dmis.org>, "Elliott, Robert (Server Storage)" <Elliott@...com> Subject: [PATCH 1/2 v2] x86, irq: get correct available vectors for cpu disable From: Yinghai Lu <yinghai@...nel.org> check_irq_vectors_for_cpu_disable() may overestimate the number of available vectors assigned to a cpu. This can cause cpu remove to erroneously fail. commit da6139e49c7cb0f4251265cb5243b8d220adb48d, x86: Add check for number of available vectors before CPU down, introduces a check to see if there are enough empty vectors in the system to replace a downed cpu's vectors. Code inspection shows that the range used in the check (currently from FIRST_EXTERNAL_VECTOR to NR_VECTORS) is incorrect and should be FIRST_EXTERNAL_VECTOR to first_system_vector. The value of first_system_vector is decremented when system vectors are assigned in alloc_system_vector(). The check_irq_vectors_for_cpu_disable() check also does not take into account the first 32 system vectors which are not managed in the per_cpu vector_irq arrays, including IA32_SYSCALL_VECTOR (0x80) and the IRQ_MOVE_CLEANUP_VECTOR (0x20). Cc: Thomas Gleixner <tglx@...utronix.de> Cc: Ingo Molnar <mingo@...hat.com> Cc: "H. Peter Anvin" <hpa@...or.com> Cc: x86@...nel.org Cc: Prarit Bhargava <prarit@...hat.com> Cc: Andi Kleen <ak@...ux.intel.com> Cc: "K. Y. Srinivasan" <kys@...rosoft.com> Cc: "Steven Rostedt (Red Hat)" <rostedt@...dmis.org> Cc: Yinghai Lu <yinghai@...nel.org> Cc: "Elliott, Robert (Server Storage)" <Elliott@...com> Signed-off-by: Yinghai Lu <yinghai@...nel.org> [v2]: fixed up typos --- arch/x86/kernel/irq.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 283a76a..276b02b 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -17,6 +17,7 @@ #include <asm/idle.h> #include <asm/mce.h> #include <asm/hw_irq.h> +#include <asm/desc.h> #define CREATE_TRACE_POINTS #include <asm/trace/irq_vectors.h> @@ -334,8 +335,21 @@ int check_irq_vectors_for_cpu_disable(void) for_each_online_cpu(cpu) { if (cpu == this_cpu) continue; - for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; - vector++) { + + /* + * assign_irq_vector() only scans per_cpu vectors from + * FIRST_EXTERNAL_VECTOR to first_system_vector. + * It also skips vectors that are set in used_vectors bitmask. + * used_vectors could have bits set for + * IA32_SYSCALL_VECTOR (0x80) + * IRQ_MOVE_CLEANUP_VECTOR (0x20) + * Don't count those as available vectors. + */ + for (vector = FIRST_EXTERNAL_VECTOR; + vector < first_system_vector; vector++) { + if (test_bit(vector, used_vectors)) + continue; + if (per_cpu(vector_irq, cpu)[vector] < 0) count++; } -- 1.7.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists