diff options
| author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-04 08:58:45 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-05 09:09:52 +0900 |
| commit | a553b499f22bf054964d4fd16d136f3d4f836c23 (patch) | |
| tree | 63561bbc28bad17f6d903ba844df4607e68d653f /include/linux | |
| parent | 2053bac1d6e47b33fa2e570c87518395e64f7da0 (diff) | |
kprobes: Validate re-registration earlier in register_kretprobe()
register_kretprobe() only checked for re-registration if rp->kp.addr was
specified, skipping the check when rp was registered with symbol_name
and rp->kp.addr was NULL. In that scenario, register_kretprobe()
proceeded to allocate a new rethook (or kretprobe holder), and when
register_kprobe(&rp->kp) subsequently failed due to re-registration, the
error path freed and NULL-ed rp->rh (or rp->rph) on the still-active
kretprobe, leading to NULL pointer dereferences when the active probe
was hit.
Resolve the target address via _kprobe_addr() up-front and check whether
the probe is already registered at that address via
check_kprobe_rereg_at() before allocating any resources, and drop the
WARN_ON_ONCE() in the re-registration check now that re-registration is
gracefully detected and rejected.
Link: https://lore.kernel.org/all/179375032568.247640.17429793187163536192.stgit@devnote2/
Fixes: 0188b87899ff ("kretprobe: Avoid re-registration of the same kretprobe earlier")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
