iovisor / iovisor/bcc

Complain loudly when bpf_printk is used OR add bpf_printk macro

Open
#3,928 0 comments 0 reactions 1 assignee Claimed by @davemarchevsky View on GitHub
bug enhancement prio:high
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

I was recently investigating a production issue related to a service which uses BPF programs - specifically of the `bcc` flavor.

Some folks involved in the investigation were more familiar with libbpf-flavored BPF programs, so when it came time to sprinkle print statements everywhere for debugging purposes they used `bpf_printk`. Since `bcc` does not have a `bpf_printk` macro, this resulted in warnings during compilation and silent failure to compile/load program:

```
/virtual/main.c:2631:3: warning: implicit declaration of function 'bpf_printk' is invalid in C99 [-Wimplicit-function-declaration]
bpf_printk("hello");
^
1 warning generated.
```

We should either have attempted `bpf_printk` use result in a more obvious error, OR add a `bpf_printk` macro which just wraps `bpf_trace_printk` and doesn't worry about printing 3+ args.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.