Add patch to fix alternatives oops from Thomas Gleixner (rhbz 1258223)

This commit is contained in:
Josh Boyer 2015-09-04 13:19:48 -04:00
parent a80cbfad26
commit 4e416f8cf7
2 changed files with 47 additions and 0 deletions

View File

@ -600,6 +600,9 @@ Patch518: drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch
Patch519: security-device_cgroup-fix-RCU-lockdep-splat.patch
Patch520: ARM-dts-Fix-Makefile-target-for-sun4i-a10-itead-itea.patch
#rhbz 1258223
Patch521: x86-alternatives-Make-optimize_nops-interrupt-safe-a.patch
Patch904: kdbus.patch
# END OF PATCH DEFINITIONS
@ -2047,6 +2050,9 @@ fi
#
#
%changelog
* Fri Sep 04 2015 Josh Boyer <jwboyer@fedoraproject.org>
- Add patch to fix alternatives oops from Thomas Gleixner (rhbz 1258223)
* Fri Sep 04 2015 Josh Boyer <jwboyer@fedoraproject.org> - 4.3.0-0.rc0.git7.1
- Linux v4.2-6663-g807249d3ada1

View File

@ -0,0 +1,41 @@
From 0279e7aded382011be52a2ad340fbfdbf15e75be Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Thu, 3 Sep 2015 12:41:47 +0200
Subject: [PATCH] x86/alternatives: Make optimize_nops() interrupt safe and
synced
optimize_nops() is buggy in two aspects:
- It's not disabling interrupts across the modification
- It's lacking a sync_core() call
Fixes: 4fd4b6e5537c 'x86/alternatives: Use optimized NOPs for padding'
Reported-by: "Richard W.M. Jones" <rjones@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/alternative.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index c42827eb86cf..25f909362b7a 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -338,10 +338,15 @@ done:
static void __init_or_module optimize_nops(struct alt_instr *a, u8 *instr)
{
+ unsigned long flags;
+
if (instr[0] != 0x90)
return;
+ local_irq_save(flags);
add_nops(instr + (a->instrlen - a->padlen), a->padlen);
+ sync_core();
+ local_irq_restore(flags);
DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ",
instr, a->instrlen - a->padlen, a->padlen);
--
2.4.3