This is a proof-of-concept, based off of bpf-next-6.13. The implementation will need additional work. The goal of this prototype was to be able load raw elf object files directly into the kernel and have the kernel perform all the necessary instruction rewriting and relocation calculations. Having a file descriptor tied to a bpf program allowed us to have tighter integration with the existing LSM infrastructure. Additionally, it opens the door for signature and provenance checking, along with loading programs without a functioning userspace. The main goal of this RFC is to get some feedback on the overall approach and feasibility of this design. A new subcommand BPF_LOAD_FD is introduced. This subcommand takes a file descriptor to an elf object file, along with an array of map fds, and a sysfs entry to associate programs and metadata with. The kernel then performs all the relocation calculations and instruction rewriting inside the kernel. Later BPF_PROG_LOAD can reference this sysfs entry and load/attach previously loaded programs by name. Userspace is responsible for generating and populating maps. CO-RE relocation support already existed in the kernel. Support for everything else, maps, externs, etc., was added. In the same vein as 29db4bea1d10 ("bpf: Prepare relo_core.c for kernel duty.") this prototype directly uses code from libbpf. One of the challenges encountered was having different elf and btf abstractions utilized in the kernel vs libpf. Missing btf functionality was ported over to the kernel while trying to minimize the number of changes required to the libpf code. As a result, there is some code duplication and obvious refactoring opportunities. Additionally, being able to directly share code between userspace and kernelspace in a similar fashion to relo_core.c would be a TODO.