NetBSD-Bugs archive

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

port-mips/59327: user stack pointer is not aligned properly



>Number:         59327
>Category:       port-mips
>Synopsis:       user stack pointer is not aligned properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 19 07:25:00 +0000 2025
>Originator:     Rin Okuyama
>Release:        10.99.14 (and prior)
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD erlite 10.99.14 NetBSD 10.99.14 (OCTEON) #5: Sat Apr 19 14:40:33 JST 2025  rin@sakaizumii.local:/home/rin/src/sys/arch/evbmips/compile/OCTEON evbmips mipsn64eb
>Description:
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).

For other architectures, similar bugs have been found and fixed with
GCC updates; newer versions of GCC much more eagerly optimizes codes
by using constraints for usp.

However, for mips, (a) SIMD-based, i.e., alignment-peaky optimization
is not used (IIUC), and (b) for many cases, usp may be aligned to
8-byte boundaries at least, even without any care.

These are probably reasons why the problem had been left uncovered.
>How-To-Repeat:
Code inspection during unsuccessful trials for PR port-evbmips/59236.
>Fix:
Suggested patches:
https://gist.github.com/rokuyama/48aaa64604efb4321521e59b9dc92da8

I've confirmed that there's no regression for full ATF run for
evbmips**n**64-eb (n64) on erlite3 (with HAVE_JEMALLOC=510).

Note that many rump-based cases do not work for evbmips64-eb (n32),
with and without the fix.



Home | Main Index | Thread Index | Old Index