Skip to contentSkip to conversation

FAILED: patch "[PATCH] kprobes: Fix build errors with CONFIG_KRETPROBES=n" failed to apply to 5.17-stable tree

PATCH [email protected] 1 participant 1 message Jun 6, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.17-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 43994049180704fd1faf78623fabd9a5cd443708 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Wed, 4 May 2022 12:36:31 +0900
Subject: [PATCH] kprobes: Fix build errors with CONFIG_KRETPROBES=n
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Max Filippov reported:

When building kernel with CONFIG_KRETPROBES=n kernel/kprobes.c compilation fails with the following messages:

kernel/kprobes.c: In function ‘recycle_rp_inst’:
kernel/kprobes.c:1273:32: error: implicit declaration of function
‘get_kretprobe’

kernel/kprobes.c: In function ‘kprobe_flush_task’:
kernel/kprobes.c:1299:35: error: ‘struct task_struct’ has no member
named ‘kretprobe_instances’

This came from the commit d741bf41d7c7 ("kprobes: Remove kretprobe hash") which introduced get_kretprobe() and kretprobe_instances member in task_struct when CONFIG_KRETPROBES=y, but did not make recycle_rp_inst() and kprobe_flush_task() depending on CONFIG_KRETPORBES.

Since those functions are only used for kretprobe, move those functions into #ifdef CONFIG_KRETPROBE area.

Fixes d741bf41d7c7 ("kprobes: Remove kretprobe hash")
Cc "Naveen N . Rao" <[email protected]>
Cc Anil S Keshavamurthy <[email protected]>
Cc "David S . Miller" <[email protected]>
Cc Peter Zijlstra <[email protected]>
include/linux/kprobes.h +1 -1
index 157168769fc2..55041d2f884d 100644
@@ -424,7 +424,7 @@ void unregister_kretprobe(struct kretprobe *rp);
 int register_kretprobes(struct kretprobe **rps, int num);
 void unregister_kretprobes(struct kretprobe **rps, int num);
 
-#ifdef CONFIG_KRETPROBE_ON_RETHOOK
+#if defined(CONFIG_KRETPROBE_ON_RETHOOK) || !defined(CONFIG_KRETPROBES)
 #define kprobe_flush_task(tk)	do {} while (0)
 #else
 void kprobe_flush_task(struct task_struct *tk);
kernel/kprobes.c +71 -73

156 lines not on this page · raw message