nodejs / postject

Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.
Other
187 stars 14 forks source link

upx compatibility(Cannot pack after postject-ed) #87

Open y3k00000 opened 1 year ago

y3k00000 commented 1 year ago

I followed NodeJS Official SEA instructions and ended up with an executable that seems works fine.

After that I was advancing to pack the postject-ed executable with upx packer but it turns out to be failing with an error: image

while the original node executable can be packed fine.

Don't know what's happening, I wonder is this a limitation or why is this be happening?

RaisinTen commented 1 year ago

Okay, so you're trying this on an ELF binary and https://github.com/upx/upx/blob/dae45ae0d4e569e071279bac1693a447934a1363/src/p_lx_elf.cpp#L2544-L2547 is where the error is coming from.

while the original node executable can be packed fine.

Could you confirm if the packed original node executable also runs without errors? (I'm asking because I just tried using upx 4.0.2 from brew on the original Node.js v20.2.0 official x86_64 macOS binary and it looks like upx works without errors but running the resultant executable segfaults)

Also, does passing the --force-execve option to upx, as suggested in the error, help in any way?

HCLonely commented 9 months ago

It works fine on windows, but I had the same problem on linux.

image

And the original node executable works fine on both systems.

It was tested on

NodeJS: v21.6.2
UPX: v4.2.2
OS: Windows 11 Pro 23H2 & Ubuntu 22.04.4 LTS