Skip to content

Commit

Permalink
Remove unused load_elf_phdrs kprobe
Browse files Browse the repository at this point in the history
The kprobe was not used and has hence been dropped.
  • Loading branch information
patrickpichler committed Oct 22, 2024
1 parent f5b7c9a commit 65c6f92
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 116 deletions.
1 change: 0 additions & 1 deletion pkg/ebpftracer/c/headers/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ enum event_id_e {
SECURITY_BPRM_CHECK,
SECURITY_SOCKET_CONNECT,
SOCKET_DUP,
LOAD_ELF_PHDRS,
FILE_MODIFICATION,
SOCK_SET_STATE,
PROCESS_OOM_KILLED,
Expand Down
38 changes: 0 additions & 38 deletions pkg/ebpftracer/c/tracee.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,44 +1496,6 @@ int BPF_KPROBE(trace_filp_close)
return 0;
}

SEC("kprobe/load_elf_phdrs")
int BPF_KPROBE(trace_load_elf_phdrs)
{
program_data_t p = {};
if (!init_program_data(&p, ctx))
return 0;

if (!should_trace((&p)))
return 0;

proc_info_t *proc_info = p.proc_info;

struct file *loaded_elf = (struct file *) PT_REGS_PARM2(ctx);
const char *elf_pathname =
(char *) get_path_str(__builtin_preserve_access_index(&loaded_elf->f_path));

// The interpreter field will be updated for any loading of an elf, both for the binary and for
// the interpreter. Because the interpreter is loaded only after the executed elf is loaded, the
// value of the executed binary should be overridden by the interpreter.

size_t sz = sizeof(proc_info->interpreter.pathname);
bpf_probe_read_kernel_str(proc_info->interpreter.pathname, sz, elf_pathname);
proc_info->interpreter.id.device = get_dev_from_file(loaded_elf);
proc_info->interpreter.id.inode = get_inode_nr_from_file(loaded_elf);
proc_info->interpreter.id.ctime = get_ctime_nanosec_from_file(loaded_elf);

if (should_submit(LOAD_ELF_PHDRS, p.event)) {
save_str_to_buf(&p.event->args_buf, (void *) elf_pathname, 0);
save_to_submit_buf(&p.event->args_buf, &proc_info->interpreter.id.device, sizeof(dev_t), 1);
save_to_submit_buf(
&p.event->args_buf, &proc_info->interpreter.id.inode, sizeof(unsigned long), 2);

events_perf_submit(&p, LOAD_ELF_PHDRS, 0);
}

return 0;
}

enum signal_handling_method_e {
SIG_DFL,
SIG_IGN,
Expand Down
43 changes: 0 additions & 43 deletions pkg/ebpftracer/decoder/args_decoder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions pkg/ebpftracer/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -5259,7 +5259,6 @@ func newEventsDefinitionSet(objs *tracerObjects) map[events.ID]definition {
probes: []EventProbe{
{handle: ProbeExecBinprm, required: false},
{handle: ProbeSchedProcessExec, required: true},
{handle: ProbeLoadElfPhdrs, required: false},
},
tailCalls: []TailCall{
{
Expand Down Expand Up @@ -5448,22 +5447,6 @@ func newEventsDefinitionSet(objs *tracerObjects) map[events.ID]definition {
{Type: "struct sockaddr*", Name: "remote_addr"},
},
},
events.LoadElfPhdrs: {
ID: events.LoadElfPhdrs,
id32Bit: events.Sys32Undefined,
name: "load_elf_phdrs",
dependencies: dependencies{
probes: []EventProbe{
{handle: ProbeLoadElfPhdrs, required: true},
},
},
sets: []string{"proc"},
params: []argMeta{
{Type: "const char*", Name: "pathname"},
{Type: "dev_t", Name: "dev"},
{Type: "unsigned long", Name: "inode"},
},
},
events.FileModification: {
ID: events.FileModification,
id32Bit: events.Sys32Undefined,
Expand Down
1 change: 0 additions & 1 deletion pkg/ebpftracer/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const (
SecurityBprmCheck
SecuritySocketConnect
SocketDup
LoadElfPhdrs
FileModification
SockSetState
ProcessOomKilled
Expand Down
2 changes: 0 additions & 2 deletions pkg/ebpftracer/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ const (
ProbeCgroupRmdir
ProbeSecurityBPRMCheck
ProbeSecuritySocketConnect
ProbeLoadElfPhdrs
ProbeCgroupSKBIngress
ProbeCgroupSKBEgress
ProbeFileUpdateTime
Expand Down Expand Up @@ -198,7 +197,6 @@ func newProbes(objs *tracerObjects, cgroupPath string) map[handle]probe {
ProbeCgroupRmdir: newTraceProbe(rawTracepoint, "cgroup:cgroup_rmdir", objs.TracepointCgroupCgroupRmdir),
ProbeSecurityBPRMCheck: newTraceProbe(kProbe, "security_bprm_check", objs.TraceSecurityBprmCheck),
ProbeSecuritySocketConnect: newTraceProbe(kProbe, "security_socket_connect", objs.TraceSecuritySocketConnect),
ProbeLoadElfPhdrs: newTraceProbe(kProbe, "load_elf_phdrs", objs.TraceLoadElfPhdrs),
ProbeCgroupSKBIngress: newCgroupProbe(ebpf.AttachCGroupInetIngress, cgroupPath, objs.CgroupSkbIngress),
ProbeCgroupSKBEgress: newCgroupProbe(ebpf.AttachCGroupInetEgress, cgroupPath, objs.CgroupSkbEgress),
ProbeFileUpdateTime: newTraceProbe(kProbe, "file_update_time", objs.TraceFileUpdateTime),
Expand Down
3 changes: 0 additions & 3 deletions pkg/ebpftracer/tracer_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/ebpftracer/tracer_arm64_bpfel.o
Binary file not shown.
3 changes: 0 additions & 3 deletions pkg/ebpftracer/tracer_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/ebpftracer/tracer_x86_bpfel.o
Binary file not shown.
8 changes: 0 additions & 8 deletions pkg/ebpftracer/types/args.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 65c6f92

Please sign in to comment.