newtools / ebpf

eBPF Utilities, Maps, and more
MIT License
250 stars 23 forks source link

Support AttachType and many more ProgTypes #115

Closed lorenz closed 5 years ago

lorenz commented 5 years ago

This adds support for expectedAttachType (necessary for many of the new program types) and a bunch of new ProgTypes.

I'm not sure what this library's compatibility targets are, this has only been tested on Linux 4.19 and upwards, so if a lower target is desired this needs testing there.

lmb commented 5 years ago

Thanks for your contribution!

The goal is that the library only returns an error when the user attempts to use a feature that their kernel doesn't yet support. As long as not specifying an attach type works on older kernels we're good.

I've not looked at attach type myself, what happens when the "wrong" attach type is given for a program?

lorenz commented 5 years ago

The goal is that the library only returns an error when the user attempts to use a feature that their kernel doesn't yet support. As long as not specifying an attach type works on older kernels we're good.

It "should" work, but I have only validated it on kernels that do support the feature. I'm not using anything older than 4.19 (which is the latest LTS).

I've not looked at attach type myself, what happens when the "wrong" attach type is given for a program?

The kernel refuses bpf(BPF_PROG_LOAD) and immediately returns EINVAL. All programs that need this are only available on 4.17+ anyways.

lorenz commented 5 years ago

@lmb Can you re-review? I've adressed all of your comments.

lmb commented 5 years ago

Not sure why, but CI isn't picking up this branch. I was hoping that another push would fix this, doesn't seem so. I'll try and get to this by Monday.

nathanjsweet commented 5 years ago

I'm in the middle of revamping CI. I didn't touch semaphore, but it's possible I broke it. I'll get back to you. @lorenz feel free to ping me on Tuesday if you haven't heard anything.

lmb commented 5 years ago

Did a manual test run, looks fine. Thanks for sending this patch!