On Tue, Apr 4, 2023 at 5:37 AM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > Add output-only log_size_actual/btf_log_size_actual field to > BPF_PROG_LOAD and BPF_BTF_LOAD commands, respectively. It will return > the size of log buffer necessary to fit in all the log contents at > specified log_level. This is very useful for BPF loader libraries like > libbpf to be able to size log buffer correctly, but could be used by > users directly, if necessary, as well. > > This patch plumbs all this through the code, taking into account actual > bpf_attr size provided by user to determine if these new fields are > expected by users. And if they are, set them from kernel on return. Can we check that both fields are zero when entering the syscall?