Hi, I have a question about SA_RESTORER: In src/signal/sigaction.c,there is a reference of SA_RESTORER: ksa.flags = sa->sa_flags | SA_RESTORER; LoongArch does not support SA_RESTORER,but must be define the macro of SA_RESTORER in LoongArch,otherwise a build error will occur. I want to ask if could consider the unsupported case about the reference of SA_RESTORER in architecture independent code? thanks.
On Mon, Aug 1, 2022 at 12:27 PM 王洪亮 <wanghongliang@loongson.cn> wrote:
> LoongArch does not support SA_RESTORER,but must be define the macro
> of SA_RESTORER in LoongArch,otherwise a build error will occur.
> I want to ask if could consider the unsupported case about the
> reference of SA_RESTORER in architecture independent code?
Perhaps you could just `#define SA_RESTORER 0` in the corresponding
bits/signal.h?
--
Best regards,
Dmitry Selyutin
On 2022/8/1 19:11, Dmitry Selyutin wrote:
> On Mon, Aug 1, 2022 at 12:27 PM 王洪亮 <wanghongliang@loongson.cn> wrote:
>> LoongArch does not support SA_RESTORER,but must be define the macro
>> of SA_RESTORER in LoongArch,otherwise a build error will occur.
>> I want to ask if could consider the unsupported case about the
>> reference of SA_RESTORER in architecture independent code?
> Perhaps you could just `#define SA_RESTORER 0` in the corresponding
> bits/signal.h?
>
Actually, I don't know if any app is going to check whether SA_RESTORER
is defined and take different codepaths accordingly; if any such app
exists, it could be broken if SA_RESTORER is defined but in fact not
needed/supported by the kernel. Otherwise defining it as 0 should be okay.
BTW so far it seems all arches in musl define SA_RESTORER to some
non-zero value, but at least some are handled differently in kernel and
glibc (e.g. m68k, or1k and riscv). I don't know if unconditionally
defining SA_RESTORER could be harmful at all if this is the case and
nobody reported any related bug yet, but maybe cleaning up the code
would help in future maintenance by making every project consistent with
each other.
On Mon, Aug 01, 2022 at 07:30:39PM +0800, WANG Xuerui wrote:
> On 2022/8/1 19:11, Dmitry Selyutin wrote:
> >On Mon, Aug 1, 2022 at 12:27 PM 王洪亮 <wanghongliang@loongson.cn> wrote:
> >>LoongArch does not support SA_RESTORER,but must be define the macro
> >>of SA_RESTORER in LoongArch,otherwise a build error will occur.
> >>I want to ask if could consider the unsupported case about the
> >>reference of SA_RESTORER in architecture independent code?
> >Perhaps you could just `#define SA_RESTORER 0` in the corresponding
> >bits/signal.h?
> >
> Actually, I don't know if any app is going to check whether
> SA_RESTORER is defined and take different codepaths accordingly; if
> any such app exists, it could be broken if SA_RESTORER is defined
> but in fact not needed/supported by the kernel. Otherwise defining
> it as 0 should be okay.
Applications really should not be using SA_RESTORER at all. It does
not do anything at the application level; libc ignores any restorer
provided by the application. But if you really don't want to expose
SA_RESTORER, I think the definition as 0 could be in the arch's
ksigaction.h rather than the public signal.h bits. Does that work?
Rich