From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751032AbcEIGqc (ORCPT ); Mon, 9 May 2016 02:46:32 -0400 Received: from helium.openadk.org ([89.238.66.15]:34354 "EHLO helium.openadk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbcEIGqb (ORCPT ); Mon, 9 May 2016 02:46:31 -0400 X-Greylist: delayed 446 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 May 2016 02:46:31 EDT Date: Mon, 9 May 2016 08:39:03 +0200 From: Waldemar Brodkorb To: linux-kernel@vger.kernel.org Cc: Denys Vlasenko , Thomas Petazzoni , Gustavo Zacarias Subject: qemu m68k/mcf5208: problem with signal handler Message-ID: <20160509063902.GL26720@waldemar-brodkorb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Operating-System: Linux 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear kernel hackers, I have a problem with the signal handling under qemu-system-m68k emulating coldfire mcf5208 evalboard. Following example code provided by Busybox maintainer Denys Vlasenko shows the problem when running on qemu: #include #include #include #include static void sighandler(int sig) { write(1, "SIGNAL\n", 7); } int main() { int pid; write(1, "VFORK1\n", 7); pid = vfork(); if (pid == 0) { write(1, "EXIT1\n", 6); _exit(1); } wait(NULL); signal(SIGCHLD, sighandler); write(1, "VFORK2\n", 7); pid = vfork(); if (pid == 0) { write(1, "EXIT2\n", 6); _exit(1); } wait(NULL); write(1, "EXIT\n", 5); return 0; } You can generate a bootable image with latest buildroot, which shows the issue: $ git clone git://git.buildroot.net/buildroot $ cd buildroot; make qemu_m68k_mcf5208_defconfig; make $ qemu-system-m68k -M mcf5208evb -cpu m5208 -kernel output/images/vmlinux -nographic Every command forked from busybox hush shell will lead into a segmentation fault. I added following printk to start investigating the problem: diff -Nur linux-4.5.3.orig/arch/m68k/kernel/signal.c linux-4.5.3/arch/m68k/kernel/signal.c --- linux-4.5.3.orig/arch/m68k/kernel/signal.c 2016-05-04 23:50:38.000000000 +0200 +++ linux-4.5.3/arch/m68k/kernel/signal.c 2016-05-09 04:24:53.885199544 +0200 @@ -595,6 +595,7 @@ void __user *fp) { int fsize = frame_extra_sizes(formatvec >> 12); + printk("avoid broken signal handler...\n"); if (fsize < 0) { /* * user process trying to return with weird frame format But now the problem disappeared. :/ What do you think? Is it a Kernel bug or a C library problem? Busybox hush otherwise works fine for other noMMU targets as stm32 evalboard with cortex-m4. It also works in Qemu M68k emulating Q800 full MMU system. Thanks for any ideas, Waldemar http://lists.busybox.net/pipermail/busybox/2014-September/081659.html