From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtgZj-0000hu-Hc for qemu-devel@nongnu.org; Sat, 04 Feb 2012 09:26:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtgZi-0003jR-Ei for qemu-devel@nongnu.org; Sat, 04 Feb 2012 09:26:47 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:50615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtgZi-0003jA-0p for qemu-devel@nongnu.org; Sat, 04 Feb 2012 09:26:46 -0500 Received: by pbaa11 with SMTP id a11so4886506pba.4 for ; Sat, 04 Feb 2012 06:26:44 -0800 (PST) MIME-Version: 1.0 Sender: alex.barcelo@gmail.com From: Alex Barcelo Date: Sat, 4 Feb 2012 15:26:24 +0100 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] sigaltstack bug in qemu (testing on qemu-ppc) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel 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.