[Bug 269568] strip(1) creates an executable which crashes in ld-elf.so.1

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 15 Feb 2023 18:20:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269568

            Bug ID: 269568
           Summary: strip(1) creates an executable which crashes in
                    ld-elf.so.1
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: tom@hur.st

In updating the sysutils/jdupes port to 1.21.3, I came across a reproducible
crash in the LOW_MEMORY=1 executable after it's been stripped:

Process 46048 launched:
'/usr/local/poudriere/ports/default/sysutils/jdupes/work/jdupes-1.21.3/jdupes.stripped'
(x86_64)
Process 46048 stopped
* thread #1, name = 'jdupes.stripped', stop reason = signal SIGSEGV: address
access protected (fault address: 0x7fffffffd768)
    frame #0: 0x0000000800211c90 ld-elf.so.1`_rtld [inlined]
init_rtld(mapbase="\U0000007fELF\U00000002\U00000001\U00000001\t",
aux_info=0x00007fffffffe100) at rtld.c:2406:5
   2403      * The "path" member can't be initialized yet because string
constants
   2404      * cannot yet be accessed. Below we will set it correctly.
   2405      */
-> 2406     memset(&objtmp, 0, sizeof(objtmp));
   2407     objtmp.path = NULL;
   2408     objtmp.rtld = true;
   2409     objtmp.mapbase = mapbase;

Here's a small script to reproduce the issue more directly:

#!/bin/sh
set -e
test -e jdupes || git clone --depth=50 https://github.com/jbruchon/jdupes.git
cd jdupes
git checkout v1.21.3
gmake clean all LOW_MEMORY=1
strip ./jdupes
lldb ./jdupes

If /usr/local/bin/strip (GNU binutils) is used the crash doesn't occur.

-- 
You are receiving this mail because:
You are the assignee for the bug.