qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] linux-user: Enable sigaltstack syscall for sh4
Date: Wed, 18 Nov 2015 23:15:12 +0100	[thread overview]
Message-ID: <1447884913-8011-1-git-send-email-glaubitz@physik.fu-berlin.de> (raw)

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 <setjmp.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

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

             reply	other threads:[~2015-11-18 22:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 22:15 John Paul Adrian Glaubitz [this message]
2015-11-18 22:15 ` [Qemu-devel] [PATCH] linux-user: Enable sigaltstack syscall for sh4 John Paul Adrian Glaubitz
2015-11-19  9:17   ` Peter Maydell
2015-11-19  9:28     ` John Paul Adrian Glaubitz
2015-11-19 10:22       ` Laurent Vivier
2015-11-19 11:15         ` Peter Maydell
2015-11-19 12:20           ` Laurent Vivier
2015-11-19 12:28             ` John Paul Adrian Glaubitz
2015-11-19 12:54             ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447884913-8011-1-git-send-email-glaubitz@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).