|
|
Message-Id: <73488f54-daa9-4d37-81e5-460076d3ff46@app.fastmail.com>
Date: Wed, 04 Nov 2026 16:10:58 +0100
From: "Imre Kaloz" <kaloz@...nel.org>
To: "Rich Felker" <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH 04/10] add SYSCALL_RT_SIGACTION_RESTORER hook for sparc
Hi Rich,
On Wed, Nov 4, 2026, at 14:19, Rich Felker wrote:
> On Wed, Nov 04, 2026 at 08:15:01AM -0500, Rich Felker wrote:
>> On Wed, Nov 04, 2026 at 10:12:03AM +0100, Imre Kaloz wrote:
<snip>
>> > I'd do both. The generic part is below as an RFC; with it, sparc64
>> > would define
>> >
>> > #define __sys_sigaction(sig,sa,old) \
>> > __syscall(__NR_rt_sigaction,sig,sa,old,__restore,_NSIG/8)
>> > #undef SYS_rt_sigaction
>>
>> I'm pretty sure this breaks expansion of __sys_sigaction.
I checked, and as posted it does expand: the body uses
__NR_rt_sigaction, which the #undef leaves alone. Good thing to double
check, though, since a body using SYS_rt_sigaction would have broken
every call site.
<snip>
>> > (sa is tested as an integer because gcc warns on the address of
>> > abort's compound literal.) Does this look right before I fold it
>> > into v2?
>>
>> Which warning is this? I don't like casts to avoid warnings.
-Waddress on sa?&ksa:0 in sigaction.c; I named abort.c by mistake,
sorry. Agreed on the cast; the inline function would make it go away.
>> It might be better to write an inline function by the same name and
>> just define the macro to itself. That gets rid of the multi-line
>> macros too.
>
> The inline function would also fix the issue with undefining the
> SYS_rt_sigaction macro, but I think it makes a new issue by depending
> on _NSIG. Maybe the macro can add _NSIG in the arguments to the inline
> function.
Thanks, the inline function is much cleaner. The 32-bit one needs
struct k_sigaction and SA_SIGINFO, so in v2 it would live in
arch/sparc/ksigaction.h, whose users include signal.h first; _NSIG is
visible there. syscall_arch.h would only have
#define __sys_sigaction __sys_sigaction
#undef SYS_rt_sigaction
and the function would be
static inline long __sys_sigaction(int sig, const struct k_sigaction *sa, struct k_sigaction *old)
{
void (*restorer)(void) = sa && (sa->flags & SA_SIGINFO) ? __restore_rt : __restore;
return __syscall(__NR_rt_sigaction, sig, sa, old, restorer, _NSIG/8);
}
sparc64 would pass __restore unconditionally. The generic patch would
keep its code and go into v2.
Thanks for taking the time to get this right with me.
Imre
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.