]> git.baikalelectronics.ru Git - kernel.git/commit
x86/dumpstack: Don't dump kernel memory based on usermode RIP
authorJann Horn <jannh@google.com>
Tue, 28 Aug 2018 15:49:01 +0000 (17:49 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 31 Aug 2018 15:08:22 +0000 (17:08 +0200)
commit2a5b6d6f2cff4bc2b6f9d9a003c651a08ea91777
treef33e103e7d44f50f47cd4358189862a2e2381a37
parent3f13befc020de545cd1a51803cc585db5d0c0ce4
x86/dumpstack: Don't dump kernel memory based on usermode RIP

show_opcodes() is used both for dumping kernel instructions and for dumping
user instructions. If userspace causes #PF by jumping to a kernel address,
show_opcodes() can be reached with regs->ip controlled by the user,
pointing to kernel code. Make sure that userspace can't trick us into
dumping kernel memory into dmesg.

Fixes: 5bd4937f65a3 ("x86/dumpstack: Add a show_ip() function")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: security@kernel.org
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180828154901.112726-1-jannh@google.com
arch/x86/include/asm/stacktrace.h
arch/x86/kernel/dumpstack.c
arch/x86/mm/fault.c