On 11/16, Thomas Gleixner wrote: > > Subject: x86/dumpstack: Don't try to access user space code of other tasks > From: Thomas Gleixner <t...@linutronix.de> > Date: Mon, 16 Nov 2020 22:26:52 +0100 > > sysrq-t ends up invoking show_opcodes() for each task which tries to access > the user space code of other processes which is obviously bogus. > > It either manages to dump where the foreign tasks regs->ip points to in > currents mapping or triggers a pagefault and prints "Code: Bad RIP > value.". Both is just wrong. > > Add a safeguard in copy_code() and check whether the @regs pointer matches > currents pt_regs. If not, do not even try to access it. > > While at it, add commentry why using copy_from_user_nmi() is safe in > copy_code() even if the function name suggests otherwise. > > Reported-by: Mark Mossberg <mark.mossb...@gmail.com> > Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Acked-by: Oleg Nesterov <o...@redhat.com>