From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E05243858D38; Fri, 19 Apr 2024 22:35:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E05243858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713566106; bh=uKBrd8Ak/CQ+Nlp9x3QoSins//J9/N4MT4xWTWYd9EM=; h=From:To:Subject:Date:From; b=cuO/xdnktSGmN3H+fFX24GWp2Ty5ot1ycpufVH/Cdyat+Gt8IBQACHWQrAf/mO6lu 3hf4GbCA3KKEhi2CixdRNGLyraF8tefZRY6VYTLrsbvRab7IfWWLZmL+e974Um87up eF+uVPZUseMckCNhxcvIWabwf9CLX/lvNS08cZhA= From: "mail@felix-potthast.de" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31663] New: Stack not aligned at _start when calling ld.so explicitly Date: Fri, 19 Apr 2024 22:35:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.35 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mail@felix-potthast.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31663 Bug ID: 31663 Summary: Stack not aligned at _start when calling ld.so explicitly Product: glibc Version: 2.35 Status: UNCONFIRMED Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: mail@felix-potthast.de Target Milestone: --- Up to glibc version 2.35 the stack is not 16-byte aligned when the process = is entered at _start when ld.so was called explicitly. The x86-64 SYS V ABI explicitly states it has to be aligned at that point, though. It also works fine when ld.so is invoked as elf interpreter. This doesn't result in any issue most of the time because the stack is aligned between _start and main in `sysdeps/x86_64/start.S`, for legacy reasons probably. I think the right place to do this alignment is at the end of ld.so. I attached a simple example that can be build with `gcc -nostartfiles test.S -o test`. It runs fine when running `./test` but segfaults when running with `/lib64/ld-linux-x86-64.so.2 ./test` due to missing stack alignment. --=20 You are receiving this mail because: You are on the CC list for the bug.=