Updating bpf syscall: What kernel version should a PR be compatible with?

Dmitry V. Levin ldv at altlinux.org
Thu Jan 26 00:06:03 UTC 2017


On Thu, Jan 26, 2017 at 12:15:48AM +0100, Quentin Monnet wrote:
> Hello,
> I use bpf() system call, that receives frequent updates in Linux
> kernel, and I would like to submit a pull request on GitHub in order
> to support the recent commands, map types, etc. for this syscall in
> strace (i.e., I want to update patch [1]).
> My question is: what is the *maximum* kernel version that would be
> acceptable to compile strace on, if I submit a pull request now? Did I
> miss a list of supported kernels somewhere?

kernel version >= 2.6 is required, older versions without a decent
PTRACE_SETOPTIONS support will not work.
Some architectures have more strict requirements.
I think, this is mentioned in NEWS file.

In practice, 2.6.18 seems to be the oldest kernel version being tested.

> I ask because my patch [2] adds updates for BPF commands that landed
> in kernel 4.4, 4.8 or… _will_ land in 4.10. This means that  the
> associated <linux/bpf.h> header must be available on the host or unit
> tests will fail to compile. Adding #ifdef guards might be a solution,
> but I am not sure this is clean enough (practically, most BPF features
> would need their own #ifdef).

We cannot assume that <linux/bpf.h> exists.  As you can see in bpf.c
and tests/bpf.c, #include <linux/bpf.h> is guarded by #ifdef.
The code that uses new bpf features would need appropriate #ifdef's
as well, and new xlat/ constants should have fallback definitions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170126/05487912/attachment.bin>

More information about the Strace-devel mailing list