diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2018-10-11 23:07:30 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-10-11 23:07:30 +0200 |
commit | 90fb814b6c025da45f71db1703cffe3fe87f575c (patch) | |
tree | 5fd739d407654df6f9d6e82900a45e027dd8b9f0 /arch/powerpc/kernel/process.c | |
parent | b30f2f65568f840e5ca522d98ba2ad73b8f59cde (diff) | |
parent | 0238df646e6224016a45505d2c111a24669ebe21 (diff) |
Merge tag 'v4.19-rc7' into i2c/for-4.20
This is the 4.19-rc7 release
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r-- | arch/powerpc/kernel/process.c | 10 |
1 files changed, 10 insertions, 0 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) pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); + /* + * Make sure the NIP points at userspace, not kernel text/data or + * elsewhere. + */ + if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) { + pr_info("%s[%d]: Bad NIP, not dumping instructions.\n", + current->comm, current->pid); + return; + } + pr_info("%s[%d]: code: ", current->comm, current->pid); for (i = 0; i < instructions_to_print; i++) { |