aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-07 01:05:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-07 01:05:43 -0400
commitcd2093cb45a4d9332d4e5a2170602f74bca298a4 (patch)
treeecf65f1ae67000b94f5a4890af9b140d566df216
parentc1d84a1b42ef70d8ae601df9cadedc7ed4f1beb1 (diff)
parentac1788cc7da4ce54edcfd2e499afdb0a23d5c41d (diff)
Merge tag 'powerpc-4.19-4' of https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Michael writes: "powerpc fixes for 4.19 #4 Four regression fixes. A fix for a change to lib/xz which broke our zImage loader when building with XZ compression. OK'ed by Herbert who merged the original patch. The recent fix we did to avoid patching __init text broke some 32-bit machines, fix that. Our show_user_instructions() could be tricked into printing kernel memory, add a check to avoid that. And a fix for a change to our NUMA initialisation logic, which causes crashes in some kdump configurations. Thanks to: Christophe Leroy, Hari Bathini, Jann Horn, Joel Stanley, Meelis Roos, Murilo Opsfelder Araujo, Srikar Dronamraju." * tag 'powerpc-4.19-4' of https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/numa: Skip onlining a offline node in kdump path powerpc: Don't print kernel instructions in show_user_instructions() powerpc/lib: fix book3s/32 boot failure due to code patching lib/xz: Put CRC32_POLY_LE in xz_private.h
-rw-r--r--arch/powerpc/kernel/process.c10
-rw-r--r--arch/powerpc/lib/code-patching.c20
-rw-r--r--arch/powerpc/mm/numa.c5
-rw-r--r--lib/xz/xz_crc32.c1
-rw-r--r--lib/xz/xz_private.h4
5 files changed, 29 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 913c5725cdb2..bb6ac471a784 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1306,6 +1306,16 @@ void show_user_instructions(struct pt_regs *regs)
1306 1306
1307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); 1307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));
1308 1308
1309 /*
1310 * Make sure the NIP points at userspace, not kernel text/data or
1311 * elsewhere.
1312 */
1313 if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {
1314 pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
1315 current->comm, current->pid);
1316 return;
1317 }
1318
1309 pr_info("%s[%d]: code: ", current->comm, current->pid); 1319 pr_info("%s[%d]: code: ", current->comm, current->pid);
1310 1320
1311 for (i = 0; i < instructions_to_print; i++) { 1321 for (i = 0; i < instructions_to_print; i++) {
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 6ae2777c220d..5ffee298745f 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -28,12 +28,6 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,
28{ 28{
29 int err; 29 int err;
30 30
31 /* Make sure we aren't patching a freed init section */
32 if (init_mem_is_free && init_section_contains(exec_addr, 4)) {
33 pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
34 return 0;
35 }
36
37 __put_user_size(instr, patch_addr, 4, err); 31 __put_user_size(instr, patch_addr, 4, err);
38 if (err) 32 if (err)
39 return err; 33 return err;
@@ -148,7 +142,7 @@ static inline int unmap_patch_area(unsigned long addr)
148 return 0; 142 return 0;
149} 143}
150 144
151int patch_instruction(unsigned int *addr, unsigned int instr) 145static int do_patch_instruction(unsigned int *addr, unsigned int instr)
152{ 146{
153 int err; 147 int err;
154 unsigned int *patch_addr = NULL; 148 unsigned int *patch_addr = NULL;
@@ -188,12 +182,22 @@ out:
188} 182}
189#else /* !CONFIG_STRICT_KERNEL_RWX */ 183#else /* !CONFIG_STRICT_KERNEL_RWX */
190 184
191int patch_instruction(unsigned int *addr, unsigned int instr) 185static int do_patch_instruction(unsigned int *addr, unsigned int instr)
192{ 186{
193 return raw_patch_instruction(addr, instr); 187 return raw_patch_instruction(addr, instr);
194} 188}
195 189
196#endif /* CONFIG_STRICT_KERNEL_RWX */ 190#endif /* CONFIG_STRICT_KERNEL_RWX */
191
192int patch_instruction(unsigned int *addr, unsigned int instr)
193{
194 /* Make sure we aren't patching a freed init section */
195 if (init_mem_is_free && init_section_contains(addr, 4)) {
196 pr_debug("Skipping init section patching addr: 0x%px\n", addr);
197 return 0;
198 }
199 return do_patch_instruction(addr, instr);
200}
197NOKPROBE_SYMBOL(patch_instruction); 201NOKPROBE_SYMBOL(patch_instruction);
198 202
199int patch_branch(unsigned int *addr, unsigned long target, int flags) 203int patch_branch(unsigned int *addr, unsigned long target, int flags)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 59d07bd5374a..055b211b7126 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1217,9 +1217,10 @@ int find_and_online_cpu_nid(int cpu)
1217 * Need to ensure that NODE_DATA is initialized for a node from 1217 * Need to ensure that NODE_DATA is initialized for a node from
1218 * available memory (see memblock_alloc_try_nid). If unable to 1218 * available memory (see memblock_alloc_try_nid). If unable to
1219 * init the node, then default to nearest node that has memory 1219 * init the node, then default to nearest node that has memory
1220 * installed. 1220 * installed. Skip onlining a node if the subsystems are not
1221 * yet initialized.
1221 */ 1222 */
1222 if (try_online_node(new_nid)) 1223 if (!topology_inited || try_online_node(new_nid))
1223 new_nid = first_online_node; 1224 new_nid = first_online_node;
1224#else 1225#else
1225 /* 1226 /*
diff --git a/lib/xz/xz_crc32.c b/lib/xz/xz_crc32.c
index 25a5d87e2e4c..912aae5fa09e 100644
--- a/lib/xz/xz_crc32.c
+++ b/lib/xz/xz_crc32.c
@@ -15,7 +15,6 @@
15 * but they are bigger and use more memory for the lookup table. 15 * but they are bigger and use more memory for the lookup table.
16 */ 16 */
17 17
18#include <linux/crc32poly.h>
19#include "xz_private.h" 18#include "xz_private.h"
20 19
21/* 20/*
diff --git a/lib/xz/xz_private.h b/lib/xz/xz_private.h
index 482b90f363fe..09360ebb510e 100644
--- a/lib/xz/xz_private.h
+++ b/lib/xz/xz_private.h
@@ -102,6 +102,10 @@
102# endif 102# endif
103#endif 103#endif
104 104
105#ifndef CRC32_POLY_LE
106#define CRC32_POLY_LE 0xedb88320
107#endif
108
105/* 109/*
106 * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used 110 * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used
107 * before calling xz_dec_lzma2_run(). 111 * before calling xz_dec_lzma2_run().