-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpf(): make union bpf_attr Linux ABI compatible (#3948)
* bpf(): make union bpf_attr Linux ABI compatible At this point we also take the first steps to fixing the existing ABI incompatibility. On the Linux side, care was taken to avoid most padding in bpf_attr. By forcing the compiler to refuse implicit padding we get a good heuristic for fields in the incorrect order. These changes mean that union bpf_attr in linux/bpf.h is not source compatible with the Linux header anymore. It's not possible to be source compatible and ABI compatible at the same time because we're already using Linux type names with ABI incompatible definitions. For example BPF_OBJ_NAME_LEN differs, and the order of fields in struct bpf_prog_info, etc. also does not match. Change the definition of union bpf_attr to be more convenient to work with. This allows refactoring the macro magic used to check for forwards and backwards compatibility into a class, which ends up a lot less error prone. * Address feedback from Dave Thaler * Address second round of review from Dave Thaler
- Loading branch information
Showing
3 changed files
with
433 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.