]> git.hungrycats.org Git - linux/commit
kprobes/x86: Use copy_from_kernel_nofault() to read from unsafe address
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 14 Mar 2024 15:17:30 +0000 (00:17 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:44 +0000 (15:11 +0200)
commit20fdb21eabaeb8f78f8f701f56d14ea0836ec861
tree2284b5414fcd7540ac3f038195548cfec3120178
parent7cb7c2af181fca7d2f58b6a24605825d8553ee3d
kprobes/x86: Use copy_from_kernel_nofault() to read from unsafe address

[ Upstream commit 4e51653d5d871f40f1bd5cf95cc7f2d8b33d063b ]

Read from an unsafe address with copy_from_kernel_nofault() in
arch_adjust_kprobe_addr() because this function is used before checking
the address is in text or not. Syzcaller bot found a bug and reported
the case if user specifies inaccessible data area,
arch_adjust_kprobe_addr() will cause a kernel panic.

[ mingo: Clarified the comment. ]

Fixes: cc66bb914578 ("x86/ibt,kprobes: Cure sym+0 equals fentry woes")
Reported-by: Qiang Zhang <zzqq0103.hey@gmail.com>
Tested-by: Jinghao Jia <jinghao7@illinois.edu>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/171042945004.154897.2221804961882915806.stgit@devnote2
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/kprobes/core.c