Open marcosps opened 4 days ago
We have two options here:
libzstd
, then extract the ELF content into a buffer and expand ElfCXX to load it from memory by calling elf_memory
.vfork
--> exec
to the zstd
tool into a temporary file, and use it.The first option has the disadvantage that libzstd will be placed as a dependency of clang-extract, but we can workaround that by using dlopen
and dlsym
. The second option have an disadvantage that it will be clunky and potentially slow.
I was checking libkmod, which can help to extract all current formats that kernel supports. All distros should package libkmod, since it's part of the kmod project (modprobe, modinfo, etc...). I may need more time to think more about it, but if this trully happens, we may be able to create livepatches from people's own /usr/src/linux and /lib/modules, instead of having to complie their own kernels.
(The only missing piece would be compile_commands.json, but that is being worked ATM)
Curerntly clang-extract doesn't deal with ELF objects that are compressed, like kernel modules. Having this implemented on clang-extract would make it easier to integrate it with different distributions, without having to reset to zstd extraction on /lib/modules for example.