All of lore.kernel.org
 help / color / mirror / Atom feed
From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 22/26] linux-user: Implement force_sigsegv() via force_sig()
Date: Thu, 22 Sep 2016 15:13:42 +0300	[thread overview]
Message-ID: <c4b3574402053a88612eab3b66a53825a00145a2.1474546244.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1474546244.git.riku.voipio@linaro.org>

From: Peter Maydell <peter.maydell@linaro.org>

Now that we have a force_sig() with the semantics we need,
we can implement force_sigsegv() to call it rather than
open-coding the call to queue_signal().

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/signal.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 60fda18..900ee35 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -512,8 +512,7 @@ void signal_init(void)
     }
 }
 
-#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \
-    !defined(TARGET_X86_64)
+#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32))
 /* Force a synchronously taken signal. The kernel force_sig() function
  * also forces the signal to "not blocked, not ignored", but for QEMU
  * that work is done in process_pending_signals().
@@ -531,9 +530,6 @@ static void force_sig(int sig)
     info._sifields._kill._uid = 0;
     queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
 }
-#endif
-
-#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32))
 
 /* Force a SIGSEGV if we couldn't write to memory trying to set
  * up the signal frame. oldsig is the signal we were trying to handle
@@ -541,22 +537,13 @@ static void force_sig(int sig)
  */
 static void force_sigsegv(int oldsig)
 {
-    CPUState *cpu = thread_cpu;
-    CPUArchState *env = cpu->env_ptr;
-    target_siginfo_t info;
-
     if (oldsig == SIGSEGV) {
         /* Make sure we don't try to deliver the signal again; this will
          * end up with handle_pending_signal() calling dump_core_and_abort().
          */
         sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL;
     }
-    info.si_signo = TARGET_SIGSEGV;
-    info.si_errno = 0;
-    info.si_code = TARGET_SI_KERNEL;
-    info._sifields._kill._pid = 0;
-    info._sifields._kill._uid = 0;
-    queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
+    force_sig(TARGET_SIGSEGV);
 }
 #endif
 
-- 
2.1.4

  parent reply	other threads:[~2016-09-22 12:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 12:13 [Qemu-devel] [PULL 00/26] linux-user update riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 01/26] linux-user: Fix handling of iovec counts riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 02/26] linux-user: Fix errno for sendrecvmsg with large iovec length riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 03/26] linux-user: Allow bad msg_name for recvfrom on connected socket riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 04/26] linux-user: Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 05/26] linux-user: Use direct syscall for utimensat riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 06/26] linux-user: Check for bad event numbers in epoll_wait riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 07/26] linux-user: Range check the nfds argument to ppoll syscall riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 08/26] linux-user: report signals being taken in strace output riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 09/26] linux-user: Pass missing MAP_ANONYMOUS to target_mmap() call riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 10/26] linux-user: Check lock_user() return value for NULL riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 11/26] linux-user: Fix incorrect use of host errno in do_ioctl_dm() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 12/26] linux-user: Fix error handling in flatload.c target_pread() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 13/26] linux-user: Check dump_write() return in elf_core_dump() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 14/26] linux-user: Use glib malloc functions in load_symbols() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 15/26] linux-user: Use correct target SHMLBA in shmat() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 16/26] linux-user: ppc64: set MSR_CM bit for BookE 2.06 MMU riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 17/26] linux-user: Recheck for pending synchronous signals too riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 18/26] linux-user: Pass si_type information to queue_signal() explicitly riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 19/26] linux-user: SIGSEGV on signal entry need not be fatal riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 20/26] linux-user: ARM: Give SIGSEGV if signal frame setup fails riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 21/26] linux-user: SIGSEGV from sigreturn need not be fatal riku.voipio
2016-09-22 12:13 ` riku.voipio [this message]
2016-09-22 12:13 ` [Qemu-devel] [PULL 23/26] linux-user: Remove unnecessary nptl_flags variable from do_fork() riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 24/26] linux-user: Sanity check clone flags riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 25/26] linux-user: Fix incorrect offset of tuc_stack in ARM do_sigframe_return_v2 riku.voipio
2016-09-22 12:13 ` [Qemu-devel] [PULL 26/26] linux-user: fix TARGET_NR_select riku.voipio
2016-09-22 13:07 ` [Qemu-devel] [PULL 00/26] linux-user update no-reply
2016-09-22 15:42 ` 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=c4b3574402053a88612eab3b66a53825a00145a2.1474546244.git.riku.voipio@linaro.org \
    --to=riku.voipio@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.