microsoft / ebpf-for-windows

eBPF implementation that runs on top of Windows
MIT License
2.85k stars 217 forks source link

Add windows specific version section to ELF file for reading and passing to bpf_load_program() #728

Open saxena-anurag opened 2 years ago

saxena-anurag commented 2 years ago

bpf_load_program() takes a license and version as input. Looking at samples like https://elixir.bootlin.com/linux/v4.14.2/source/samples/bpf/bpf_load.c , either the kernel version is passed as 0 or is read from the ELF file.

Currently the Windows implementation of bpf_load_program() accepts and ignores the version passed to it. In future, we should ideally have Windows specific versions passed to this API to specify which Windows version this load is targeted to.

Since the Linux kernel versions (a number) and Windows versions will be different, this issue is to track adding a new Windows specific section in ELF file where the target Windows version can be specified.

dthaler commented 1 year ago

we should start using the standard version number capability in the input ELF file. https://github.com/dthaler/ebpf-docs-1/blob/elf/rst/elf.rst#runtime-version-restriction