|
|
Message-ID: <CAH9TF6MMbjxRoQpEy--sxK-Cx2SMEG-pn3eiYK_EoWKF2nrSaA@mail.gmail.com>
Date: Tue, 23 Jul 2024 23:42:51 +0200
From: Alex Rønne Petersen <alex@...xrp.com>
To: musl@...ts.openwall.com
Subject: Stack pointer is misaligned when invoking the musl dynamic linker
directly to run a program without start files
Hi,
Repro:
$ cat test.s
.global _start
_start:
mov %rsp, %rdi
and $15, %rdi
call exit
$ musl-gcc test.s -nostartfiles
$ ./a.out; echo $?
0
$ /lib64/ld-linux-x86-64.so.2 ./a.out; echo $?
0
$ /lib/ld-musl-x86_64.so.1 ./a.out; echo $?
8
$ /lib/ld-musl-x86_64.so.1 --version
musl libc (x86_64)
Version 1.2.3
I could well be missing something here, but at first glance, this
*seems* like an ABI violation; the x86-64 psABI [0] states in §3.4.1
that RSP is guaranteed to be 16-byte aligned on process entry. The
same is true of many other architectures (though the amount obviously
differs).
I suppose it's debatable whether a program interpreter ought to be
required to uphold the same guarantees as the kernel on process
initialization?
[0] https://gitlab.com/x86-psABIs/x86-64-ABI
Regards,
Alex
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.