Commit 77c9387c authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Alexei Starovoitov says:

====================
pull-request: bpf 2022-03-29

We've added 16 non-merge commits during the last 1 day(s) which contain
a total of 24 files changed, 354 insertions(+), 187 deletions(-).

The main changes are:

1) x86 specific bits of fprobe/rethook, from Masami and Peter.

2) ice/xsk fixes, from Maciej and Magnus.

3) Various small fixes, from Andrii, Yonghong, Geliang and others.

* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  selftests/bpf: Fix clang compilation errors
  ice: xsk: Fix indexing in ice_tx_xsk_pool()
  ice: xsk: Stop Rx processing when ntc catches ntu
  ice: xsk: Eliminate unnecessary loop iteration
  xsk: Do not write NULL in SW ring at allocation failure
  x86,kprobes: Fix optprobe trampoline to generate complete pt_regs
  x86,rethook: Fix arch_rethook_trampoline() to generate a complete pt_regs
  x86,rethook,kprobes: Replace kretprobe with rethook on x86
  kprobes: Use rethook for kretprobe if possible
  bpftool: Fix generated code in codegen_asserts
  selftests/bpf: fix selftest after random: Urandom_read tracepoint removal
  bpf: Fix maximum permitted number of arguments check
  bpf: Sync comments for bpf_get_stack
  fprobe: Fix sparse warning for acccessing __rcu ftrace_hash
  fprobe: Fix smatch type mismatch warning
  bpf/bpftool: Add unprivileged_bpf_disabled check against value of 2
====================

Link: https://lore.kernel.org/r/20220329234924.39053-1-alexei.starovoitov@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 6094e391 ccaff3d5
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -164,7 +164,13 @@ config ARCH_USE_BUILTIN_BSWAP

config KRETPROBES
	def_bool y
	depends on KPROBES && HAVE_KRETPROBES
	depends on KPROBES && (HAVE_KRETPROBES || HAVE_RETHOOK)

config KRETPROBE_ON_RETHOOK
	def_bool y
	depends on HAVE_RETHOOK
	depends on KRETPROBES
	select RETHOOK

config USER_RETURN_NOTIFIER
	bool
+1 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ config X86
	select HAVE_KPROBES_ON_FTRACE
	select HAVE_FUNCTION_ERROR_INJECTION
	select HAVE_KRETPROBES
	select HAVE_RETHOOK
	select HAVE_KVM
	select HAVE_LIVEPATCH			if X86_64
	select HAVE_MIXED_BREAKPOINTS_REGS
+11 −12
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

#include <linux/sched.h>
#include <linux/ftrace.h>
#include <linux/kprobes.h>
#include <linux/rethook.h>
#include <asm/ptrace.h>
#include <asm/stacktrace.h>

@@ -16,7 +16,7 @@ struct unwind_state {
	unsigned long stack_mask;
	struct task_struct *task;
	int graph_idx;
#ifdef CONFIG_KRETPROBES
#if defined(CONFIG_RETHOOK)
	struct llist_node *kr_cur;
#endif
	bool error;
@@ -104,19 +104,18 @@ void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
#endif

static inline
unsigned long unwind_recover_kretprobe(struct unwind_state *state,
unsigned long unwind_recover_rethook(struct unwind_state *state,
				     unsigned long addr, unsigned long *addr_p)
{
#ifdef CONFIG_KRETPROBES
	return is_kretprobe_trampoline(addr) ?
		kretprobe_find_ret_addr(state->task, addr_p, &state->kr_cur) :
		addr;
#else
	return addr;
#ifdef CONFIG_RETHOOK
	if (is_rethook_trampoline(addr))
		return rethook_find_ret_addr(state->task, (unsigned long)addr_p,
					     &state->kr_cur);
#endif
	return addr;
}

/* Recover the return address modified by kretprobe and ftrace_graph. */
/* Recover the return address modified by rethook and ftrace_graph. */
static inline
unsigned long unwind_recover_ret_addr(struct unwind_state *state,
				     unsigned long addr, unsigned long *addr_p)
@@ -125,7 +124,7 @@ unsigned long unwind_recover_ret_addr(struct unwind_state *state,

	ret = ftrace_graph_ret_addr(state->task, &state->graph_idx,
				    addr, addr_p);
	return unwind_recover_kretprobe(state, ret, addr_p);
	return unwind_recover_rethook(state, ret, addr_p);
}

/*
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
obj-$(CONFIG_X86_TSC)		+= trace_clock.o
obj-$(CONFIG_TRACING)		+= trace.o
obj-$(CONFIG_RETHOOK)		+= rethook.o
obj-$(CONFIG_CRASH_CORE)	+= crash_core_$(BITS).o
obj-$(CONFIG_KEXEC_CORE)	+= machine_kexec_$(BITS).o
obj-$(CONFIG_KEXEC_CORE)	+= relocate_kernel_$(BITS).o crash.o
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

#include <asm/asm.h>
#include <asm/frame.h>
#include <asm/insn.h>

#ifdef CONFIG_X86_64

Loading