Port-arm archive

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

Re: aarch64's cpu_setmcontext doesn't handle _UC_SETSTACK -- is this a bug?



>I'm debugging a golang issue where lwps in 64-bit mode seem to
>sometimes escape their signal stack and run on the main lwp stack,
>despite SS_ONSTACK being set.
>
>Comparing the 32-bit and 64-bit versions of cpu_setmcontext() and
>sendsig_siginfo() I have found differences in how _UC_SETSTACK is
>handled.
>
>cpu_setmcontext:
>https://nxr.netbsd.org/xref/src/sys/arch/aarch64/aarch64/cpu_machdep.c#198
>https://nxr.netbsd.org/xref/src/sys/arch/arm/arm/sig_machdep.c?r=1.51#265
>
>send_siginfo:
>https://nxr.netbsd.org/xref/src/sys/arch/arm/arm/sig_machdep.c?r=1.51#113
>https://nxr.netbsd.org/xref/src/sys/arch/aarch64/aarch64/sig_machdep.c?r=1.4#71
>
>It seems that aarch64's implementation doesn't handle these flags.
>I wonder if this is a bug or by design?
>It looks like it could cause problems for userland programs that make
>extensive use of setucontext(2).

Probably, it's a bug.
I've written a simple test to do sigaction(2) with SA_ONSTACK after doing sigaltstack(2),
but the signal handler after the second time does not use alternative stack.

I'll add a test case about sigaltstack(2) to usr/tests, and then look into.

-- 
ryo shimizu


Home | Main Index | Thread Index | Old Index