abbat / elfexec

Utility to execute ELF binary directly from stdin pipe.
60 stars 8 forks source link

Not working with PyInstaller #1

Open vdun opened 1 year ago

vdun commented 1 year ago
# cat h.py
print('hello')
# pyinstaller -F -c h.py
...
# cat ./dist/h | elfexec
[1518521] Cannot open PyInstaller archive from executable (/memfd:elfexec (deleted)) or external archive (/memfd:elfexec (deleted).pkg)
abbat commented 1 year ago

PyInstaller use bootloader and try to open executed file itself via /proc/self/exe to unpack it to temppath/_MEIxxxxxx. But if you cat-ing executable file, where is no file on disk to open:

readlink("/proc/self/exe", "/memfd:elfexec (deleted)", 4095) = 24
openat(AT_FDCWD, "/memfd:elfexec (deleted)", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/memfd:elfexec (deleted).pkg", O_RDONLY) = -1 ENOENT (No such file or directory)

I have no idea how to workaround it with PyInstaller binaries.