I am barely able to understand this inline function: static inline int sas_ss_flags(unsigned long sp) { return (target_sigaltstack_used.ss_size == 0 ? SS_DISABLE : on_sig_stack(sp) ? SS_ONSTACK : 0); } (signal.c @97)
... and it seems wrong to me when used in the following function. I have a test program that uses sigaltstack to do some stack manipulation. It doesn't work. The function: ... if ((ka->sa_flags & TARGET_SA_ONSTACK) && (/* here maybe a "!" */ sas_ss_flags(oldsp))) { .... (signal.c, get_sigframe @4121) Forcing a true value makes everything work (not that I'm claiming it as the solution, obviously). I think that it lacks an "!". Either flag SS_DISABLE or SS_ONSTACK are flags that should *disable* the stack change, so 1 (SS_ONSTACK) and 2 (SS_DISABLE) should not enter the if. And a 0 value means that it should be ok to do a stack change. It makes sense, but I'm not sure if I'm oversimplifying things too much. And I wasn't sure if just sending a patch was ok, given that I don't fully understand the code.