Home Home > GIT Browse > SLE15-SP1-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2019-03-07 16:13:26 +0100
committerBorislav Petkov <bp@suse.de>2019-03-07 16:13:26 +0100
commitfc169b3a5cc6c606556bef28d21ed21b85169080 (patch)
treeed3c3cc1647d254d82b9e97e0dbe72ff5551a92a
parent38334dbf166fbb2170dfef92ef1efbda97c62330 (diff)
- x86/kaslr: Fix incorrect i8254 outb() parameters (bsc#1114279).
- Refresh patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch.
-rw-r--r--patches.arch/x86-kaslr-fix-incorrect-i8254-outb-parameters.patch40
-rw-r--r--patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch81
-rw-r--r--series.conf1
3 files changed, 45 insertions, 77 deletions
diff --git a/patches.arch/x86-kaslr-fix-incorrect-i8254-outb-parameters.patch b/patches.arch/x86-kaslr-fix-incorrect-i8254-outb-parameters.patch
new file mode 100644
index 0000000000..33fa1ecb82
--- /dev/null
+++ b/patches.arch/x86-kaslr-fix-incorrect-i8254-outb-parameters.patch
@@ -0,0 +1,40 @@
+From: Daniel Drake <drake@endlessm.com>
+Date: Mon, 7 Jan 2019 11:40:24 +0800
+Subject: x86/kaslr: Fix incorrect i8254 outb() parameters
+Git-commit: 7e6fc2f50a3197d0e82d1c0e86282976c9e6c8a4
+Patch-mainline: v5.0-rc4
+References: bsc#1114279
+
+The outb() function takes parameters value and port, in that order. Fix
+the parameters used in the kalsr i8254 fallback code.
+
+Fixes: 5bfce5ef55cb ("x86, kaslr: Provide randomness functions")
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: bp@alien8.de
+Cc: hpa@zytor.com
+Cc: linux@endlessm.com
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/20190107034024.15005-1-drake@endlessm.com
+
+Acked-by: Borislav Petkov <bp@suse.de>
+---
+ arch/x86/lib/kaslr.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/lib/kaslr.c b/arch/x86/lib/kaslr.c
+index 79778ab200e4..a53665116458 100644
+--- a/arch/x86/lib/kaslr.c
++++ b/arch/x86/lib/kaslr.c
+@@ -36,8 +36,8 @@ static inline u16 i8254(void)
+ u16 status, timer;
+
+ do {
+- outb(I8254_PORT_CONTROL,
+- I8254_CMD_READBACK | I8254_SELECT_COUNTER0);
++ outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0,
++ I8254_PORT_CONTROL);
+ status = inb(I8254_PORT_COUNTER0);
+ timer = inb(I8254_PORT_COUNTER0);
+ timer |= inb(I8254_PORT_COUNTER0) << 8;
+
diff --git a/patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch b/patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch
index d027a89291..7f4f2d6dee 100644
--- a/patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch
+++ b/patches.suse/0003-x86-KASLR-public-the-function-for-getting-random-lon.patch
@@ -15,9 +15,8 @@ Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
arch/x86/boot/compressed/kaslr.c | 21 ------------
arch/x86/boot/compressed/misc.c | 17 ++++++++++
arch/x86/boot/compressed/misc.h | 6 +++
- arch/x86/lib/kaslr.c | 61 +-----------------------------------
arch/x86/lib/random.c | 66 +++++++++++++++++++++++++++++++++++++++
- 5 files changed, 91 insertions(+), 80 deletions(-)
+ 4 files changed, 89 insertions(+), 21 deletions(-)
create mode 100644 arch/x86/lib/random.c
--- a/arch/x86/boot/compressed/kaslr.c
@@ -64,7 +63,7 @@ Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
{
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
-@@ -411,3 +411,20 @@ asmlinkage __visible void *extract_kerne
+@@ -431,3 +431,20 @@ asmlinkage __visible void *extract_kerne
debug_putstr("done.\nBooting the kernel.\n");
return output;
}
@@ -107,78 +106,6 @@ Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
#else
static inline void choose_random_location(unsigned long input,
unsigned long input_size,
---- a/arch/x86/lib/kaslr.c
-+++ b/arch/x86/lib/kaslr.c
-@@ -25,67 +25,10 @@
- #define get_boot_seed() kaslr_offset()
- #endif
-
--#define I8254_PORT_CONTROL 0x43
--#define I8254_PORT_COUNTER0 0x40
--#define I8254_CMD_READBACK 0xC0
--#define I8254_SELECT_COUNTER0 0x02
--#define I8254_STATUS_NOTREADY 0x40
--static inline u16 i8254(void)
--{
-- u16 status, timer;
--
-- do {
-- outb(I8254_PORT_CONTROL,
-- I8254_CMD_READBACK | I8254_SELECT_COUNTER0);
-- status = inb(I8254_PORT_COUNTER0);
-- timer = inb(I8254_PORT_COUNTER0);
-- timer |= inb(I8254_PORT_COUNTER0) << 8;
-- } while (status & I8254_STATUS_NOTREADY);
--
-- return timer;
--}
-+#include "random.c"
-
- unsigned long kaslr_get_random_long(const char *purpose)
- {
--#ifdef CONFIG_X86_64
-- const unsigned long mix_const = 0x5d6008cbf3848dd3UL;
--#else
-- const unsigned long mix_const = 0x3f39e593UL;
--#endif
-- unsigned long raw, random = get_boot_seed();
-- bool use_i8254 = true;
--
-- debug_putstr(purpose);
- debug_putstr(" KASLR using");
--
-- if (has_cpuflag(X86_FEATURE_RDRAND)) {
-- debug_putstr(" RDRAND");
-- if (rdrand_long(&raw)) {
-- random ^= raw;
-- use_i8254 = false;
-- }
-- }
--
-- if (has_cpuflag(X86_FEATURE_TSC)) {
-- debug_putstr(" RDTSC");
-- raw = rdtsc();
--
-- random ^= raw;
-- use_i8254 = false;
-- }
--
-- if (use_i8254) {
-- debug_putstr(" i8254");
-- random ^= i8254();
-- }
--
-- /* Circular multiply for better bit diffusion */
-- asm(_ASM_MUL "%3"
-- : "=a" (random), "=d" (raw)
-- : "a" (random), "rm" (mix_const));
-- random += raw;
--
-- debug_putstr("...\n");
--
-- return random;
-+ return get_random_long(purpose);
- }
--- /dev/null
+++ b/arch/x86/lib/random.c
@@ -0,0 +1,66 @@
@@ -195,8 +122,8 @@ Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
+ u16 status, timer;
+
+ do {
-+ outb(I8254_PORT_CONTROL,
-+ I8254_CMD_READBACK | I8254_SELECT_COUNTER0);
++ outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0,
++ I8254_PORT_CONTROL);
+ status = inb(I8254_PORT_COUNTER0);
+ timer = inb(I8254_PORT_COUNTER0);
+ timer |= inb(I8254_PORT_COUNTER0) << 8;
diff --git a/series.conf b/series.conf
index 4bdf6287bc..a9bbd1faee 100644
--- a/series.conf
+++ b/series.conf
@@ -20503,6 +20503,7 @@
patches.fixes/0001-sched-wake_q-Fix-wakeup-ordering-for-wake_q.patch
patches.fixes/0001-futex-Fix-possible-missed-wakeup.patch
patches.fixes/0001-locking-rwsem-Fix-possible-missed-wakeup.patch
+ patches.arch/x86-kaslr-fix-incorrect-i8254-outb-parameters.patch
patches.fixes/netrom-switch-to-sock-timer-API.patch
patches.suse/net-rose-fix-NULL-ax25_cb-kernel-panic.patch
patches.suse/net-mlx5e-Allow-MAC-invalidation-while-spoofchk-is-O.patch