Skip to content

Commit 958a3f2

Browse files
olsajiriAlexei Starovoitov
authored andcommitted
bpf: Use tracing helpers for lsm programs
Currenty lsm uses bpf_tracing_func_proto helpers which do not include stack trace or perf event output. It's useful to have those for bpftrace lsm support [1]. Using tracing_prog_func_proto helpers for lsm programs. [1] bpftrace/bpftrace#1347 Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Cc: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 1b698fa commit 958a3f2

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

include/linux/bpf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,9 @@ extern const struct bpf_func_proto bpf_ringbuf_query_proto;
16331633
const struct bpf_func_proto *bpf_tracing_func_proto(
16341634
enum bpf_func_id func_id, const struct bpf_prog *prog);
16351635

1636+
const struct bpf_func_proto *tracing_prog_func_proto(
1637+
enum bpf_func_id func_id, const struct bpf_prog *prog);
1638+
16361639
/* Shared helpers among cBPF and eBPF. */
16371640
void bpf_user_rnd_init_once(void);
16381641
u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);

kernel/bpf/bpf_lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ const struct bpf_prog_ops lsm_prog_ops = {
4949
};
5050

5151
const struct bpf_verifier_ops lsm_verifier_ops = {
52-
.get_func_proto = bpf_tracing_func_proto,
52+
.get_func_proto = tracing_prog_func_proto,
5353
.is_valid_access = btf_ctx_access,
5454
};

kernel/trace/bpf_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ raw_tp_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
14671467
}
14681468
}
14691469

1470-
static const struct bpf_func_proto *
1470+
const struct bpf_func_proto *
14711471
tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
14721472
{
14731473
switch (func_id) {

0 commit comments

Comments
 (0)