79641515

Date: 2025-05-28 04:49:55
Score: 1
Natty:
Report link

If you don't want to use the memfd_create()+execl() you are going to parse the ELF header & friends yourself, fill in the correct locations, tables, segments, maps and system headers. Also needed is to do all the pre-cleaning the ELF loader does (related to the old/current process) before turning the execution over.

Basically you will be re-inventing the ELF loader. Unless you really need this (and don't want to create another binary format/loader/linker) I would suggest you use the memfd_create()+execl()

If you are brave enough (or has a specific requirement) here goes some more info. You can also take a look at an ELF packer source, just like you said, but most will likely re-implement an ELF loader alike thing. Good luck.

https://lwn.net/Articles/631631/

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: ERic