From patchwork Sat Sep 29 16:11:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Barcelo X-Patchwork-Id: 188035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6735E2C00E1 for ; Sun, 30 Sep 2012 02:12:05 +1000 (EST) Received: from localhost ([::1]:60221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THze7-0002QR-Ff for incoming@patchwork.ozlabs.org; Sat, 29 Sep 2012 12:12:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THzdw-0002Jm-78 for qemu-devel@nongnu.org; Sat, 29 Sep 2012 12:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THzdv-0008W1-0o for qemu-devel@nongnu.org; Sat, 29 Sep 2012 12:11:52 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:55742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THzdu-0008Vx-Qi for qemu-devel@nongnu.org; Sat, 29 Sep 2012 12:11:50 -0400 Received: by wgbdr1 with SMTP id dr1so2108790wgb.10 for ; Sat, 29 Sep 2012 09:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=sBW/Fuk6BIv2pCTjr96CT6KLUs0quLwPbKg3lYVAkqY=; b=0tJ9gP7XmtFMkvMXzPzeSN5ZOqQCVPjTNLChMKM9e2M9h0LDKFyfdgZ/zKyzJMp0hi UJO0VNXs6qRH7LR+hVrkWJRnCjAND8RPVkxs1kJ7t474pEpcV9EQKkm6qHYHHNpb4bKB JeYEpAY//iS/bjq0WO7b2CKge/b+kpYMh1xCGJ0QBvljYhY1jfsz3gsc8zW+SoM8VMuq f+1psMxlpJwteeV0FufTA2U2mysqw2LaWt4eIGCvSLqxs741+FY7e1xhh2A5L+VoYk0v sEGmbyJdj1fhEgBxbzWXwnB5cRZfrmPZQyqkVjw+eW/qi24Qnrrr87razItGfNm0Kwk3 McVw== Received: by 10.180.100.97 with SMTP id ex1mr4284814wib.17.1348935110196; Sat, 29 Sep 2012 09:11:50 -0700 (PDT) Received: from localhost.localdomain (62.57.4.176.dyn.user.ono.com. [62.57.4.176]) by mx.google.com with ESMTPS id q4sm5798998wix.9.2012.09.29.09.11.48 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 29 Sep 2012 09:11:49 -0700 (PDT) From: Alex Barcelo To: Date: Sat, 29 Sep 2012 18:11:26 +0200 Message-Id: <1348935086-11336-3-git-send-email-abarcelo@ac.upc.edu> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348935086-11336-1-git-send-email-abarcelo@ac.upc.edu> References: <1348935086-11336-1-git-send-email-abarcelo@ac.upc.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.53 Cc: Riku Voipio , Alex Barcelo Subject: [Qemu-devel] [PATCH 2/2] signal: sigsegv protection on do_sigprocmask X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The sigsegv protection is done by forcing the catch (needed in qemu-user) and then taking it off from the return mask (well, adding it in fact) --- linux-user/signal.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index b8b8268..8764f57 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5468,7 +5468,14 @@ long do_rt_sigreturn(CPUArchState *env) */ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) { - return sigprocmask(how, set, oldset); + int ret; + sigset_t temp = *set; + if (set) { + sigdelset(&temp, SIGSEGV); + } + ret = sigprocmask(how, &temp, oldset); + sigaddset(oldset, SIGSEGV); + return ret; } void process_pending_signals(CPUArchState *cpu_env)