From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzB0d-0005A2-Nu for qemu-devel@nongnu.org; Wed, 18 Nov 2015 17:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzB0a-0006cw-Dh for qemu-devel@nongnu.org; Wed, 18 Nov 2015 17:15:23 -0500 Received: from outpost5.zedat.fu-berlin.de ([130.133.4.89]:51167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzB0a-0006ca-7b for qemu-devel@nongnu.org; Wed, 18 Nov 2015 17:15:20 -0500 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost.zedat.fu-berlin.de (Exim 4.85) for qemu-devel@nongnu.org with esmtp (envelope-from ) id <1ZzB0Z-00221N-DV>; Wed, 18 Nov 2015 23:15:19 +0100 Received: from z6.physik.fu-berlin.de ([160.45.34.66] helo=z6) by relay1.zedat.fu-berlin.de (Exim 4.85) for qemu-devel@nongnu.org with esmtps (envelope-from ) id <1ZzB0Z-000oS4-CT>; Wed, 18 Nov 2015 23:15:19 +0100 Received: from glaubitz by z6 with local (Exim 4.86) (envelope-from ) id 1ZzB0X-00026f-WB for qemu-devel@nongnu.org; Wed, 18 Nov 2015 23:15:18 +0100 From: John Paul Adrian Glaubitz Date: Wed, 18 Nov 2015 23:15:12 +0100 Message-Id: <1447884913-8011-1-git-send-email-glaubitz@physik.fu-berlin.de> Subject: [Qemu-devel] [PATCH] linux-user: Enable sigaltstack syscall for sh4 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hello! I'm the current maintainer for the Debian sh4 port. I maintain several buildds as well as port packages for the sh4 architecture. Recently I discovered qemu for building packages in an emulated chroot environment with qemu-sh4-static. While setting up python, qemu issued an error message about an unimplemented syscall, 186 which is sigaltstack. Looking up the sources, I found that linux-user/syscall.c enables sigaltstack for a limited number of architectures only. In order to fix the problem with the missing sigaltstack syscall, I added TARGET_SH4 to the list of architectures which seems to work. The following sample C program tests the functionality of sigaltstack. Without my patch, the program segfaults on qemu-sh4. With the patch, it works as expected. ===================================================================== #include #include #include #include jmp_buf exit_jmp; void handler(int x) { longjmp(exit_jmp, 1); } int f(void) { return f(); } int main(void) { stack_t sigstack; sigstack.ss_sp = malloc(1024*1024); sigstack.ss_size = 1024*1024; sigstack.ss_flags = 0; sigaltstack(&sigstack, NULL); struct sigaction sa; sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_ONSTACK; sigaction(SIGSEGV, &sa, NULL); if (setjmp(exit_jmp) == 0) { return f(); } puts("recovered"); return 0; } ===================================================================== Any idea what else I should test to verify my changes? Otherwise, it would be great if my patch could be applied to add sigaltstack for sh4. Thanks, Adrian > [1] https://wiki.debian.org/SH4/sbuildQEMU -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz@debian.org `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913