NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/54052: bump STACK_ALIGNBYTES for COMPAT_LINUX

The following reply was made to PR port-amd64/54052; it has been noted by GNATS.

From: Rin Okuyama <>
To: Joerg Sonnenberger <>,
Subject: Re: port-amd64/54052: bump STACK_ALIGNBYTES for COMPAT_LINUX
Date: Tue, 12 Mar 2019 17:55:47 +0900

 On 2019/03/12 7:54, Joerg Sonnenberger wrote:
 > On Mon, Mar 11, 2019 at 05:50:00AM +0000, wrote:
 >>> Description:
 >> Linux binaries with glibc >= 2.23 randomly crashes in dynamic linker.
 >> By bisectioning, the cause turns out to be this commit
 > So the real problem is that doesn't do what any normal startup
 > code does by aligning the stack explicitly. *sigh*
 I don't get what you means...
 (1) The bottom of stack (i.e., %rsp = &argc) is required to be aligned
 to 16-byte boundary by "System V ABI - AMD64 Architecture Processor
 (see pp. 29-30).
 (2) However, we align it to only 8-byte boundary; we don't define
 STACK_ALIGNBYTES for amd64, and __ALIGNBYTES = (8 - 1) is used instead:
    1394  static size_t
    1395  calcstack(struct execve_data * restrict data, const size_t gaplen)
    1396  {
    1415          /* make the stack "safely" aligned */
    1416          return STACK_LEN_ALIGN(stacklen, STACK_ALIGNBYTES);
    1417  }
 (3) If the bottom of stack is aligned to 16-byte boundary, for
 Linux works fine.
 Therefore, I think that is legal within System V ABI. Isn't it?

Home | Main Index | Thread Index | Old Index