NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-mips/59327: user stack pointer is not aligned properly
The following reply was made to PR port-mips/59327; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Rin Okuyama <rokuyama.rk%gmail.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, port-mips-maintainer%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: port-mips/59327: user stack pointer is not aligned properly
Date: Sat, 19 Apr 2025 11:11:52 +0000
> Date: Sat, 19 Apr 2025 07:25:00 +0000 (UTC)
> From: rokuyama.rk%gmail.com@localhost
>
> User stack pointer should be aligned to (1) 16-byte boundaries for
> n{32,64}, and (2) 8-byte boundaries for o{32,64} ABIs, respectively.
>
> However, our codes do not take care of it, except for makecontext(3).
> [...]
> Suggested patches:
> https://gist.github.com/rokuyama/48aaa64604efb4321521e59b9dc92da8
This looks good but I think the most important step is to have
automatic tests to verify stack alignment requirements on all
architectures, for any entry points from the kernel:
1. program start after exec
2. signal handler
3. signal return (see PR 58149 for this weird case)
4. (anything else I'm forgetting?)
We already have tests/kernel/t_signal_and_sp.c for testing PR 58149 on
aarch64; we should:
1. extend it with other architectures,
2. make sure it matches a STACK_ALIGNBYTES definition rather than
hard-coding 16 in the test,
3. add an entry point stub that saves the initial stack pointer in a
global variable and calls the real __start so we can verify it, and
4. add a statically linked helper program to do the same so we check
both ld.elf_so entry and kernel entry.
Home |
Main Index |
Thread Index |
Old Index