BusyBox 1.36.0 regression: Segfaults on i386 musl libc

Steffen Nurpmeso steffen at sdaoden.eu
Tue Jan 10 19:03:24 UTC 2023


So i am really, really sorry to be here once again.
(And without really looking)

Natanael Copa wrote in
 <20230110131112.4d6022cc at ncopa-desktop>:
 |On Sun, 08 Jan 2023 20:22:31 +0100
 |Sören Tempel <soeren at soeren-tempel.net> wrote:
 |> Investigated this further. The problem is a text relocation created by
 |> the hash_md5_sha256_x86-32_shaNI.S file. When compiling BusyBox with
 |> LDFLAGS=-Wl,-z,text one is warned about the following relocation by gcc:
 ...
 |But for the $K256 data we'd need use the global offset table. Not sure \
 |exactly how to do that.

Twenty years ago i head (this x86 not x86-64, say)

  #if SF_PIC
    .extern G(_GLOBAL_OFFSET_TABLE_)
  #  define GET_GOT() \
          pushl %ebx;\
          call 1f;\
    1:    popl %ebx;\
          addl $G(_GLOBAL_OFFSET_TABLE_)+(.-1b), %ebx
  #  define UNGET_GOT() \
          popl %ebx
  #  define GOT           @GOT(%ebx)      // external sym ('s ptr; leal + deref)
  #  define GOTOFF        @GOTOFF(%ebx)   // local sym (leal)
  #  define PLT           @PLT            // function
  #  define PIC_INJ(X)    X
  #  define PICSO(OFF)    OFF+4           // PIC-STACK-OFFSET
  
  #else // SF_PIC
  #  define GET_GOT()
  #  define UNGET_GOT()
  #  define GOT
  #  define GOTOFF
  #  define PLT
  #  define PIC_INJ(X)
  #  define PICSO(OFF)    OFF
  #endif // !SF_PIC

Which then could be used like

  .if SF_PIC ;\
  leal L(THELOCALSYM)GOTOFF, %eax;\
  .else ; \
  pushl $L(THELOCALSYM);\
  .endif ;\

Function arguments loading from stack via

  movl __PICSO(4)(%esp), %edi

I have not done that since about 2006 though.  But should work,
no?  I was never so smart like the guys that did this IBT thing.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the busybox mailing list