[PATCH] elf: Try not pointing empty PT_LOAD segment's offset past EOF

Bálint Réczey balint@balintreczey.hu
Sat Dec 7 16:22:00 GMT 2019


Hi,

Strip sometimes leaves file offset of empty PT_LOAD segment pointing
past end of file as observed on Ubuntu 19.10's gzip binary. This is
traditionally considered a non-issue as loaders tolerated that, but
WSL1's ELF loader does not run the gzip binary [1] due to this offset.

I have opened a bug [2] in bugzilla, but I was advised to send the
patch here, too.

Please consider accepting the patch. I believe this does not cause any
regression and it fixes ELF loading on WSL.

Thanks,
Balint

[1] https://github.com/microsoft/WSL/issues/4461
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=25237
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elf-Try-not-pointing-empty-PT_LOAD-segment-s-offset-.patch
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20191207/7ec1f2c4/attachment.bin>


More information about the Binutils mailing list