GNU bug report logs - #58033
PatchELF can create broken ELF binaries

Previous Next

Package: guix;

Reported by: Lukasz Olszewski <dev <at> lukaszolszewski.info>

Date: Fri, 23 Sep 2022 22:36:02 UTC

Severity: normal

Full log


Message #23 received at 58033 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Lukasz Olszewski <email <at> lukaszolszewski.info>
Cc: 58033 <at> debbugs.gnu.org
Subject: Re: bug#58033: A bug in file-dynamic-info used by validate-runpath
 in gnu-build-system and others.
Date: Fri, 07 Oct 2022 10:31:20 +0200
Hi Lukasz,

Lukasz Olszewski <email <at> lukaszolszewski.info> skribis:

> Then if I run $ strip --strip-unneeded --enable-deterministic-archives
> file the files can be run fine, but if I use patchelf to add an extra
> folder to the rpath strip complains like this:
> $ strip --strip-unneeded --enable-deterministic-archives
> /home/luk/dev/backup_FileStoreTest
> strip: /home/luk/dev/stt5WKN1: warning: allocated section `.dynstr'
> not in segment
>
> Then the binary has its elf header mangled as described previously.
>
> By copying the unmodified file, modifying rpath and running strip a
> couple of times I found that there is no problem if the rpath change
> results in rpath of the same or shorter length, but adding even one
> byte to it makes 'strip' later complain and mangle the binary.

I believe PatchELF has the potential to break binaries, especially when
trying to extend RUNPATH (the data has to fit in the string table;
PatchELF is supposed to be able to grow the string table as needed, but
there might be bugs.)

It looks like a workaround is to not run ‘strip’, right?

Ludo’.




This bug report was last modified 2 years and 189 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.