diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-10-08 15:43:12 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-10-08 15:43:12 +0200 |
commit | 4e1a606d552de03aec2b1fd157011bf012fcc870 (patch) | |
tree | 7d7683fc2d5286a36782df572f475abb3bb2e173 /arch/powerpc/kernel/process.c | |
parent | TTY: sn_console: Replace spin_is_locked() with spin_trylock() (diff) | |
parent | Linux 4.19-rc7 (diff) | |
download | linux-4e1a606d552de03aec2b1fd157011bf012fcc870.tar.xz linux-4e1a606d552de03aec2b1fd157011bf012fcc870.zip |
Merge 4.19-rc7 into tty-next
We want the fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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++) { |