From patchwork Wed Nov 10 16:31:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Z+7Gzl6R; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9Py0V8Qz9sCD for ; Thu, 11 Nov 2021 03:33:10 +1100 (AEDT) Received: from localhost ([::1]:54470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqX5-0007Yl-Rp for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:33:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWf-0007Vl-Nn for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:41 -0500 Received: from [2607:f8b0:4864:20::d33] (port=45779 helo=mail-io1-xd33.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWb-0005bi-D6 for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:41 -0500 Received: by mail-io1-xd33.google.com with SMTP id v23so3448514iom.12 for ; Wed, 10 Nov 2021 08:32:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UGjqnBrwXclKNyjUNjesMbXpJ87GafcQyfEXdTM32Cg=; b=Z+7Gzl6Rw+3LxZfnOv4qP57M0KRz21kLLGzUv3in4Q956xZ85uxj7md6IFkL2hVSZC Yky+96MMeZ2+t8OtFnLLJrAOKdTKbrmW6CfOJLGMOU66kwIfHM5SiSmkUePm3EHNiAJd 3jws4RnTASJBBkrslf+jkpZax6Sbz3jPLeMi6HmiETjuT3zOdyPTa+9+PUnPKdVlVYjl 2JrvposZWzpmYZoDb6If0J0nzVI/RpoP0q7+8+lNf2bJz0OQGKpvpbd6piiuFHrxweiK Ee6FSG7wTD/B748adTAQzJqo0G67yFrrqhjKZRL3EkjBXQp/tSKjeIiNca67RGBY44Xv mWfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UGjqnBrwXclKNyjUNjesMbXpJ87GafcQyfEXdTM32Cg=; b=s34/D5tqi15WVoIxK82sp9zqaYhH2zF3YEGz+yU/ZkK6wRJCWACXrcs7r0IVFlgfDd 4M0poiVl8iWnE4StWj09sgAZD7D/h2Qda8pqAxSJ4r0lHEExJrd19mcyBqlJuKoyu5vE 526/HvdX5rSOFP6vMt2TWGvuAfiHdnt8kVsptVj9lEiw288T+PwUFZ2U2kabfwTj/Siu 7YBB7uv4ag8i2jGAWnKWGo7beikLlNfxD+vO+nJzoZS8DTKORRzp/I5sn8Y+p8bRPDU0 Rdb0sx9uNtH0u7huj/nWnSxGuoaYt538OifsjQJXV8l/W5bJAIuhA+4IJHkSIxk3bf5t bM6g== X-Gm-Message-State: AOAM533F+37HmJhZ7iz1QmJtFaZpt5TN23YMy9S1bC7s+FRPM2243G0+ xo7HRwj3BxrCEfFFo4d7AQ5vsTL7UXTLkA== X-Google-Smtp-Source: ABdhPJyP6nqoYdtpcjqar2A39OuFVSG0BV4vd0VqEEXdnax+KS3Q/d32OU8IBGjKETeYh2S/EfVBHw== X-Received: by 2002:a05:6638:11cb:: with SMTP id g11mr71212jas.139.1636561956001; Wed, 10 Nov 2021 08:32:36 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:35 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 1/6] linux-user: Add host_signal_set_pc to set pc in mcontext Date: Wed, 10 Nov 2021 09:31:28 -0700 Message-Id: <20211110163133.76357-2-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d33 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a new function host_signal_set_pc to set the next pc in an mcontext. The caller should ensure this is a valid PC for execution. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- linux-user/host/aarch64/host-signal.h | 5 +++++ linux-user/host/alpha/host-signal.h | 5 +++++ linux-user/host/arm/host-signal.h | 5 +++++ linux-user/host/i386/host-signal.h | 5 +++++ linux-user/host/mips/host-signal.h | 5 +++++ linux-user/host/ppc/host-signal.h | 5 +++++ linux-user/host/riscv/host-signal.h | 5 +++++ linux-user/host/s390/host-signal.h | 5 +++++ linux-user/host/sparc/host-signal.h | 9 +++++++++ linux-user/host/x86_64/host-signal.h | 5 +++++ 10 files changed, 54 insertions(+) diff --git a/linux-user/host/aarch64/host-signal.h b/linux-user/host/aarch64/host-signal.h index 0c0b08383a..9770b36dc1 100644 --- a/linux-user/host/aarch64/host-signal.h +++ b/linux-user/host/aarch64/host-signal.h @@ -35,6 +35,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { struct _aarch64_ctx *hdr; diff --git a/linux-user/host/alpha/host-signal.h b/linux-user/host/alpha/host-signal.h index e080be412f..f4c942948a 100644 --- a/linux-user/host/alpha/host-signal.h +++ b/linux-user/host/alpha/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.sc_pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.sc_pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint32_t *pc = (uint32_t *)host_signal_pc(uc); diff --git a/linux-user/host/arm/host-signal.h b/linux-user/host/arm/host-signal.h index efb165c0c5..6c095773c0 100644 --- a/linux-user/host/arm/host-signal.h +++ b/linux-user/host/arm/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.arm_pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.arm_pc = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { /* diff --git a/linux-user/host/i386/host-signal.h b/linux-user/host/i386/host-signal.h index 4c8eef99ce..abe1ece5c9 100644 --- a/linux-user/host/i386/host-signal.h +++ b/linux-user/host/i386/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.gregs[REG_EIP]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.gregs[REG_EIP] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe diff --git a/linux-user/host/mips/host-signal.h b/linux-user/host/mips/host-signal.h index ef341f7c20..c666ed8c3f 100644 --- a/linux-user/host/mips/host-signal.h +++ b/linux-user/host/mips/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.pc; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.pc = pc; +} + #if defined(__misp16) || defined(__mips_micromips) #error "Unsupported encoding" #endif diff --git a/linux-user/host/ppc/host-signal.h b/linux-user/host/ppc/host-signal.h index a491c413dc..1d8e658ff7 100644 --- a/linux-user/host/ppc/host-signal.h +++ b/linux-user/host/ppc/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.regs->nip; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.regs->nip = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.regs->trap != 0x400 diff --git a/linux-user/host/riscv/host-signal.h b/linux-user/host/riscv/host-signal.h index 3b168cb58b..a4f170efb0 100644 --- a/linux-user/host/riscv/host-signal.h +++ b/linux-user/host/riscv/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.__gregs[REG_PC]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.__gregs[REG_PC] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { /* diff --git a/linux-user/host/s390/host-signal.h b/linux-user/host/s390/host-signal.h index 26990e4893..a524f2ab00 100644 --- a/linux-user/host/s390/host-signal.h +++ b/linux-user/host/s390/host-signal.h @@ -16,6 +16,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.psw.addr; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.psw.addr = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint16_t *pinsn = (uint16_t *)host_signal_pc(uc); diff --git a/linux-user/host/sparc/host-signal.h b/linux-user/host/sparc/host-signal.h index 5e71d33f8e..e301c2c1ea 100644 --- a/linux-user/host/sparc/host-signal.h +++ b/linux-user/host/sparc/host-signal.h @@ -20,6 +20,15 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) #endif } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ +#ifdef __arch64__ + uc->uc_mcontext.mc_gregs[MC_PC] = pc; +#else + &uc->uc_mcontext.gregs[REG_PC] = pc; +#endif +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { uint32_t insn = *(uint32_t *)host_signal_pc(uc); diff --git a/linux-user/host/x86_64/host-signal.h b/linux-user/host/x86_64/host-signal.h index 883d2fcf65..c71d597eb2 100644 --- a/linux-user/host/x86_64/host-signal.h +++ b/linux-user/host/x86_64/host-signal.h @@ -15,6 +15,11 @@ static inline uintptr_t host_signal_pc(ucontext_t *uc) return uc->uc_mcontext.gregs[REG_RIP]; } +static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) +{ + uc->uc_mcontext.gregs[REG_RIP] = pc; +} + static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) { return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe From patchwork Wed Nov 10 16:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=O3XmAygW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9VZ0wfSz9sCD for ; Thu, 11 Nov 2021 03:37:10 +1100 (AEDT) Received: from localhost ([::1]:42080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqax-0001Q1-V4 for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:37:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWh-0007Zl-3e for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:43 -0500 Received: from [2607:f8b0:4864:20::d33] (port=40528 helo=mail-io1-xd33.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWc-0005bp-GB for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:42 -0500 Received: by mail-io1-xd33.google.com with SMTP id r8so3488481iog.7 for ; Wed, 10 Nov 2021 08:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bH8XlQNlVgldgvvPm+sZMzPHlugap+34WnaEJEfYxSY=; b=O3XmAygWpA4wpIhfJM2Mui/7zk5/FckhmwJrL69ZJRVV74rIRMabSlZ3ZvzcB4hC4I waw6PI04HOFq5rGOBNQhOuWYuVg1RYQ+ugyq6ip2fbeZlKN6vC+rewEPPSmQ8adwheUJ l6bm7b3QodWFud7iFKiweSMxuFs2V1zr2Qhx7aB0uytli+hojwpGjBaqwFeL8szbVRG2 LF/SiIJbKHx0Dam973AphdUO2jMDooHHhaqzo/klbF9c13Jo5waxNcqhsnB9TtLg9eEM FRL3NLuiOCaOWpFRs4kwEuKWLjInOTWra3wxMXhnaSR3XxqrZoAhjfnQP2O05irgxa0F rkCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bH8XlQNlVgldgvvPm+sZMzPHlugap+34WnaEJEfYxSY=; b=w9UV2EI2KTl7WzyBDfZQQ89/mx6ogVtAKnqLyHcGluWg0JKjZ+vL5NrE/mZjaVKQri HrUm9xO80vOptSMu9zTc01y/fZpFzISyjtTQ9CH8Dou8OBH74ehitvitiHMwQ1TlgQ6Z X9nvz+D6jYWQansMxUvIYzBntYuHveSQKcVhm6ZyKUkK/7G1+Bc9Au0iVkEFkXABp6Dq /MIGeCX4EnATSkJDgy3oDQMozVe9K8+YwUStxdHI511SZaj17q7waOzV1FqLkdzTCYkG TzSJuiIb19fJGgPqoPYCLabO9qP7mnDKnEsUyuPSCxHQCcVOTdOFfa/zN093Z1QEYb3N xntA== X-Gm-Message-State: AOAM533dLkDok4I4/fkF0ruL2mEW4NfGirFNyoxx0mAoktE0S7TGhkgt SXw4Q6DEwOQlD725KP5MZ2MsHYqHIiMXyA== X-Google-Smtp-Source: ABdhPJz8j9BNCvvz2m4MaDihTx2H1xo2wyvMxO0Q1MVsrDoMtfSq8xP4yHd56V1jKplTGkeLX8J2eA== X-Received: by 2002:a02:734d:: with SMTP id a13mr84220jae.113.1636561956982; Wed, 10 Nov 2021 08:32:36 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:36 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 2/6] linux-user/signal.c: Create a common rewind_if_in_safe_syscall Date: Wed, 10 Nov 2021 09:31:29 -0700 Message-Id: <20211110163133.76357-3-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d33 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All instances of rewind_if_in_safe_syscall are the same, differing only in how the instruction point is fetched from the ucontext and the size of the registers. Use host_signal_pc and new host_signal_set_pc interfaces to fetch the pointer to the PC and adjust if needed. Delete all the old copies of rewind_if_in_safe_syscall. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/host/aarch64/hostdep.h | 20 -------------------- linux-user/host/arm/hostdep.h | 20 -------------------- linux-user/host/i386/hostdep.h | 20 -------------------- linux-user/host/ppc64/hostdep.h | 20 -------------------- linux-user/host/riscv/hostdep.h | 20 -------------------- linux-user/host/s390x/hostdep.h | 20 -------------------- linux-user/host/x86_64/hostdep.h | 20 -------------------- linux-user/safe-syscall.h | 3 +++ linux-user/signal.c | 14 +++++++++++++- 9 files changed, 16 insertions(+), 141 deletions(-) diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h index a8d41a21ad..39299d798a 100644 --- a/linux-user/host/aarch64/hostdep.h +++ b/linux-user/host/aarch64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - __u64 *pcreg = &uc->uc_mcontext.pc; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h index 9276fe6ceb..86b137875a 100644 --- a/linux-user/host/arm/hostdep.h +++ b/linux-user/host/arm/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.arm_pc; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h index 073be74d87..ce7136501f 100644 --- a/linux-user/host/i386/hostdep.h +++ b/linux-user/host/i386/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - greg_t *pcreg = &uc->uc_mcontext.gregs[REG_EIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h index 98979ad917..0c290dd904 100644 --- a/linux-user/host/ppc64/hostdep.h +++ b/linux-user/host/ppc64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.gp_regs[PT_NIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/riscv/hostdep.h b/linux-user/host/riscv/hostdep.h index 2ba07456ae..7f67c22868 100644 --- a/linux-user/host/riscv/hostdep.h +++ b/linux-user/host/riscv/hostdep.h @@ -11,24 +11,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.__gregs[REG_PC]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h index 4f0171f36f..d801145854 100644 --- a/linux-user/host/s390x/hostdep.h +++ b/linux-user/host/s390x/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - unsigned long *pcreg = &uc->uc_mcontext.psw.addr; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h index a4fefb5114..9c62bd26bd 100644 --- a/linux-user/host/x86_64/hostdep.h +++ b/linux-user/host/x86_64/hostdep.h @@ -15,24 +15,4 @@ /* We have a safe-syscall.inc.S */ #define HAVE_SAFE_SYSCALL -#ifndef __ASSEMBLER__ - -/* These are defined by the safe-syscall.inc.S file */ -extern char safe_syscall_start[]; -extern char safe_syscall_end[]; - -/* Adjust the signal context to rewind out of safe-syscall if we're in it */ -static inline void rewind_if_in_safe_syscall(void *puc) -{ - ucontext_t *uc = puc; - greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP]; - - if (*pcreg > (uintptr_t)safe_syscall_start - && *pcreg < (uintptr_t)safe_syscall_end) { - *pcreg = (uintptr_t)safe_syscall_start; - } -} - -#endif /* __ASSEMBLER__ */ - #endif diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index 6bc0390262..aaa9ffc0e2 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -127,6 +127,9 @@ #ifdef HAVE_SAFE_SYSCALL /* The core part of this function is implemented in assembly */ extern long safe_syscall_base(int *pending, long number, ...); +/* These are defined by the safe-syscall.inc.S file */ +extern char safe_syscall_start[]; +extern char safe_syscall_end[]; #define safe_syscall(...) \ ({ \ diff --git a/linux-user/signal.c b/linux-user/signal.c index 81c45bfce9..ee038c2399 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -793,7 +793,19 @@ int queue_signal(CPUArchState *env, int sig, int si_type, return 1; /* indicates that the signal was queued */ } -#ifndef HAVE_SAFE_SYSCALL +#ifdef HAVE_SAFE_SYSCALL +/* Adjust the signal context to rewind out of safe-syscall if we're in it */ +static inline void rewind_if_in_safe_syscall(void *puc) +{ + ucontext_t *uc = (ucontext_t *)puc; + uintptr_t pcreg = host_signal_pc(uc); + + if (pcreg > (uintptr_t)safe_syscall_start + && pcreg < (uintptr_t)safe_syscall_end) { + host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); + } +} +#else static inline void rewind_if_in_safe_syscall(void *puc) { /* Default version: never rewind */ From patchwork Wed Nov 10 16:31:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=8RR7sMM4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9RJ6db4z9sCD for ; Thu, 11 Nov 2021 03:34:20 +1100 (AEDT) Received: from localhost ([::1]:60228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqYE-0002xT-Nk for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:34:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWh-0007aw-Eb for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:43 -0500 Received: from [2607:f8b0:4864:20::d2f] (port=43772 helo=mail-io1-xd2f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWd-0005bv-MW for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:43 -0500 Received: by mail-io1-xd2f.google.com with SMTP id z26so3460085iod.10 for ; Wed, 10 Nov 2021 08:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tkJTC1f42Usxm11YPPgsA91Pn7lqAeCzgrwWDOdWQas=; b=8RR7sMM4EixWSP78Cc6SgWRvo2g5czo1DENxkcqfbwo8U7Jt+B9vchBw8y0OTdFdeB J1vIaU0tZ4VpUZ6saCNRiwW8P8+7bVvaRQh3aVy+cB/9IOSy0UXE36+sE3E2wcnt2G2F Giby1UogXkUKs8Y+wxjcUhDoAkUyfYGPdrgA0qdGaGd8l1p6I4rmsPF3OSND6p/9Nz6V gbixi8yVzZ14G7ly+QTR10Y7ENjV8SCZSiFVBgoNYscktrPZ1E4JSIVrlmQ76mcXIbqC 1rYKYaTdj7mettGk6UeEL2Ui3cekr25gBWeHdxSzI5XuRKCuHs3nTjEClcmL+6wiID2V P6CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tkJTC1f42Usxm11YPPgsA91Pn7lqAeCzgrwWDOdWQas=; b=6oiS0UBek/BF4Md5Qu0pSfIOuOx3R1upX56msYNyrMYdUftKRjzdyv+fL+UUaoWb8e W66XStvYN6t+vp5BsI3viy3rHghZbvQ4i4PmUsjvlM7EpktK8zP8kj8xnB1Qzw+vwkGk Pds5Ar9DKN37Y89oUZCl43CLM9P/pUKQhRsufVSSxag5cmXLWKi8a3qL8WjDxYTyICsi IN3rZZ9jU8VHjF1mXtChSnkkrxOwD4xIROa0S3sg/uQfdDTLBp2BB+QTvJzVVW+o7JDn oiVQLBsMTGlxgBcEPC78QEUlq55qhAFAKZmOfLuWye/Qp+1yBqGaeph1dyXfKPIh+GQM mZ5w== X-Gm-Message-State: AOAM531wRFThiC82VEO96usKRnAdxV4igQLqTpcnJk1I/bsTe8MugX8e 3yb8hGs6FMeshdl7dkGmT2HQKBKpjSiyjg== X-Google-Smtp-Source: ABdhPJyZfcP8Hj4EfXnfJwS1Z1NRMfw9z1pZHVMx7GB3NgPg0fVgS4cN4t17W34BTL1Bd8chWXMJvQ== X-Received: by 2002:a05:6638:16d6:: with SMTP id g22mr106597jat.19.1636561958284; Wed, 10 Nov 2021 08:32:38 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:37 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 3/6] linux-user/safe-syscall.inc.S: Move to common-user Date: Wed, 10 Nov 2021 09:31:30 -0700 Message-Id: <20211110163133.76357-4-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2f (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::d2f; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move all the safe_syscall.inc.S files to common-user. They are almost identical between linux-user and bsd-user to re-use. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- {linux-user => common-user}/host/aarch64/safe-syscall.inc.S | 0 {linux-user => common-user}/host/arm/safe-syscall.inc.S | 0 {linux-user => common-user}/host/i386/safe-syscall.inc.S | 0 {linux-user => common-user}/host/ppc64/safe-syscall.inc.S | 0 {linux-user => common-user}/host/riscv/safe-syscall.inc.S | 0 {linux-user => common-user}/host/s390x/safe-syscall.inc.S | 0 {linux-user => common-user}/host/x86_64/safe-syscall.inc.S | 0 meson.build | 1 + 8 files changed, 1 insertion(+) rename {linux-user => common-user}/host/aarch64/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/arm/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/i386/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/ppc64/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/riscv/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/s390x/safe-syscall.inc.S (100%) rename {linux-user => common-user}/host/x86_64/safe-syscall.inc.S (100%) diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/aarch64/safe-syscall.inc.S rename to common-user/host/aarch64/safe-syscall.inc.S diff --git a/linux-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S similarity index 100% rename from linux-user/host/arm/safe-syscall.inc.S rename to common-user/host/arm/safe-syscall.inc.S diff --git a/linux-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S similarity index 100% rename from linux-user/host/i386/safe-syscall.inc.S rename to common-user/host/i386/safe-syscall.inc.S diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/ppc64/safe-syscall.inc.S rename to common-user/host/ppc64/safe-syscall.inc.S diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S similarity index 100% rename from linux-user/host/riscv/safe-syscall.inc.S rename to common-user/host/riscv/safe-syscall.inc.S diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S similarity index 100% rename from linux-user/host/s390x/safe-syscall.inc.S rename to common-user/host/s390x/safe-syscall.inc.S diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S similarity index 100% rename from linux-user/host/x86_64/safe-syscall.inc.S rename to common-user/host/x86_64/safe-syscall.inc.S diff --git a/meson.build b/meson.build index 9702fdce6d..728d305403 100644 --- a/meson.build +++ b/meson.build @@ -2872,6 +2872,7 @@ foreach target : target_dirs if 'CONFIG_LINUX_USER' in config_target base_dir = 'linux-user' target_inc += include_directories('linux-user/host/' / config_host['ARCH']) + target_inc += include_directories('common-user/host/' / config_host['ARCH']) endif if 'CONFIG_BSD_USER' in config_target base_dir = 'bsd-user' From patchwork Wed Nov 10 16:31:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=uWVVrdL2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9Q040FKz9sCD for ; Thu, 11 Nov 2021 03:33:12 +1100 (AEDT) Received: from localhost ([::1]:54628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqX8-0007fY-41 for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:33:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWh-0007Zq-4A for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:43 -0500 Received: from [2607:f8b0:4864:20::133] (port=34507 helo=mail-il1-x133.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWe-0005cC-OH for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:42 -0500 Received: by mail-il1-x133.google.com with SMTP id j28so3151099ila.1 for ; Wed, 10 Nov 2021 08:32:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pp/SgrJ7oVlk8CEiQ0y2Iv+sqjnUd/aIJ3A0oSLvc2o=; b=uWVVrdL2g1xI6fGTzgZyBXhKN6Th/d/5zyTfftPE8PNRC6ZnAOMhDZErNXnsNj3575 dLw7vJ7DLSg/2ptH+oEEU8AFkEmPxVTtvoQ16jKMXZ/mdf8lXGhZt4IzA2AeqPfgQGfo JASm98m8l6nEXhsGn4nE+qL3iludjBEmjYUgEeH39cOl7G+6U34oR7J6yGbIHZwukw9L GFZw0rYLkRgADzeub+TN+b59wbGkoeXAgYy8l9m9zmHE+Vnfz36UF+FtF3U35JEaBwgt iC6Ve+4jXqTT1BUC6nmOcHXcComOMc+EOaMBIVIAg2t4r0LlsdS43k3To3PMh6e6l/qn NviA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pp/SgrJ7oVlk8CEiQ0y2Iv+sqjnUd/aIJ3A0oSLvc2o=; b=V9kJjm6MICL4KfhCdl4S3StnqLX6Gn/3pKNNpI4uBy7YeS1i4+ZRAA9bUKNh2CbmaF 6FyXvfWvMUxqEbAovpbQFafWzd99eqCrng3wrtTRdI60YwSNtenuz6UPAbGQiFTjGCy1 P7YwhffoKva66MQzNRP2pIcERTwhfYzcFd9Wq7SnFORuZOoL5CQwSVO/wv7DfHRAPVwj txJF/yzl1SJofC3MQ2ws4Iz50EG27+ccsA6IZeqpiaawD/wtVFahuC7yPw9yYkenpAZy 1yfacsMcPf6dMAD7x8yH9/uNKK+wbUMZN+tSc0fUPk6/vsmxml2Ur+WJ+OOr/h+gQXnB bsPg== X-Gm-Message-State: AOAM533ci5larn/PW1wyMZBWbY8WIdtFk+MpxkW3YnLqDtkRVDmfjMx+ ks4ZHERSPf97D83g454/ZQRvdD+1/DnQug== X-Google-Smtp-Source: ABdhPJyvaTp0lBJgZlIFZX/kXxcsBxcWCX51Oda4B4yR/lfWEosu3Qq6B/+PKD+N86HUuVk8QqfJqw== X-Received: by 2002:a05:6e02:1b8a:: with SMTP id h10mr181962ili.237.1636561959191; Wed, 10 Nov 2021 08:32:39 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:38 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 4/6] common-user: Adjust system call return on FreeBSD Date: Wed, 10 Nov 2021 09:31:31 -0700 Message-Id: <20211110163133.76357-5-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::133 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::133; envelope-from=imp@bsdimp.com; helo=mail-il1-x133.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All the *-users generally use the Linux style of negative return codes for errno. FreeBSD returns errno, not -errno. Add ifdefs for FreeBSD to make the adjustment on the 4 hosts that we have support for. Signed-off-by: Warner Losh --- common-user/host/aarch64/safe-syscall.inc.S | 5 +++++ common-user/host/arm/safe-syscall.inc.S | 5 +++++ common-user/host/i386/safe-syscall.inc.S | 5 +++++ common-user/host/x86_64/safe-syscall.inc.S | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index bc1f5a9792..6584950ccf 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -64,6 +64,11 @@ safe_syscall_start: svc 0x0 safe_syscall_end: /* code path for having successfully executed the syscall */ +#ifdef __FreeBSD__ + b.cc 2f /* Convert to Linux -ERRNO convention */ + neg x0, x0 +2: +#endif ret 0: diff --git a/common-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S index 88c4958504..85c47387f9 100644 --- a/common-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -78,6 +78,11 @@ safe_syscall_start: swi 0 safe_syscall_end: /* code path for having successfully executed the syscall */ +#ifdef __FreeBSD__ + bcc 2f + neg r0, r0 +2: +#endif pop { r4, r5, r6, r7, r8, pc } 1: diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index 9e58fc6504..7bb6a98a8b 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -75,6 +75,11 @@ safe_syscall_start: int $0x80 safe_syscall_end: /* code path for having successfully executed the syscall */ +#ifdef __FreeBSD__ + jnb 2f /* Convert to Linux -ERRNO convention */ + neg %eax +2: +#endif pop %ebx .cfi_remember_state .cfi_adjust_cfa_offset -4 diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index f36992daa3..7d8792c7ef 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -72,6 +72,11 @@ safe_syscall_start: syscall safe_syscall_end: /* code path for having successfully executed the syscall */ +#ifdef __FreeBSD__ + jnb 2f /* Convert to Linux -ERRNO convention */ + neg %rax +2: +#endif pop %rbp .cfi_remember_state .cfi_def_cfa_offset 8 From patchwork Wed Nov 10 16:31:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=spcPYVd5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9Tc4Z0Rz9sCD for ; Thu, 11 Nov 2021 03:36:20 +1100 (AEDT) Received: from localhost ([::1]:39218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqaA-0007qr-6q for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:36:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWi-0007eu-I0 for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:44 -0500 Received: from [2607:f8b0:4864:20::d29] (port=40519 helo=mail-io1-xd29.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWf-0005cQ-UR for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:44 -0500 Received: by mail-io1-xd29.google.com with SMTP id r8so3488714iog.7 for ; Wed, 10 Nov 2021 08:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M3YNJExhThSIbj1o2Es/Nt0wLEmypXnIdeRMVKOi/c8=; b=spcPYVd584+LiL84FKldoc4r6gg5FlLc4mL6fts4tEtBIiD6xFICDcK34T7Hp9PA0l HjTBIbBK+79mLZbEi8n32xvRRtSulUQkHHydrjFbF6kZQyP2d2BwU9S34Ts/Z82n9IBK DCPDmTVwS6VUmJ6AOLLh5KRJq7GBok+XKCYdC9sKqA3YgOQfIO5qYNLyqyzNuDISmSt0 +lNpEdw4DRbSKfg5Jao6LDoV/8jN7INLZXT4KdRMpNOoF1ZxMAraNd2Y/unFs0IKovLe qOOt1nTyy3NLdQU0pqw4p8Y5twbFC6Rj2bX1jPF9r5vmMrEZHOeeG2hUfYiCDe5dKRga T0Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M3YNJExhThSIbj1o2Es/Nt0wLEmypXnIdeRMVKOi/c8=; b=LGx9yrngvn46LQRJ18m4PDLQS0UJ7B7hhDC7YCRsdMieGH54ArzgSVA5kH3NJt+Wnt EtX33RqTvsvB9kKx04w811nnIByvDgdJjbmIUBIsoJC/yhtaVIehGzvBaT4nRO8NYzgm kFcB67G7yTriXO4/GbKf2NvhKaDSraeVMZ8m4bYqyUYQFN8td/pPJNpde2BtMTv5rQSL NBrhKROs7QiRcjFysUO3TEpOH/kCnedE2xo5QM3cL3GEdYy9kM5uYov+zfXJCk6TELPh KG5wUYB3aw7KIIyFkfXhFp9i3txRo6IbpZasRwXh0crMlbE5FbNnfM2azottDBed2QmO 183w== X-Gm-Message-State: AOAM533k4avdl1r4nGCQs1VJWXqP74F9Kn1/BQ+M3bVb4KAoSKaPmYAm 2d9WIDYdVHZvRv0dAtT6lL5mK6fioGovMQ== X-Google-Smtp-Source: ABdhPJyLCvqe2bgMRYt01kGjPKxFWPBlLdcFhMbV5f2cZCG4zztgincKElPTwMlkbgW1aY95HnGIew== X-Received: by 2002:a05:6638:22c2:: with SMTP id j2mr83356jat.105.1636561960484; Wed, 10 Nov 2021 08:32:40 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:40 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 5/6] common-user/host/mips: create, though mips hosts likely don't work reliably Date: Wed, 10 Nov 2021 09:31:32 -0700 Message-Id: <20211110163133.76357-6-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d29 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh --- common-user/host/mips/safe-syscall.inc.S | 1 + 1 file changed, 1 insertion(+) create mode 100644 common-user/host/mips/safe-syscall.inc.S diff --git a/common-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S new file mode 100644 index 0000000000..72d9064acb --- /dev/null +++ b/common-user/host/mips/safe-syscall.inc.S @@ -0,0 +1 @@ + .asciiz "This file is not compiled and mips hosts are likely broken" From patchwork Wed Nov 10 16:31:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1553506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=XdgKX2MF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hq9Rt6YLbz9sCD for ; Thu, 11 Nov 2021 03:34:49 +1100 (AEDT) Received: from localhost ([::1]:34746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkqYf-0004nh-UZ for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2021 11:34:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkqWj-0007jS-L0 for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:45 -0500 Received: from [2607:f8b0:4864:20::d36] (port=43779 helo=mail-io1-xd36.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkqWg-0005ci-PH for qemu-devel@nongnu.org; Wed, 10 Nov 2021 11:32:45 -0500 Received: by mail-io1-xd36.google.com with SMTP id z26so3460245iod.10 for ; Wed, 10 Nov 2021 08:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xX0hIQSZjL8ZR7arM3SqbUY2tpWX5DtaOT38oFoQlVs=; b=XdgKX2MFsNTdPawTvR1a9Guy4tJRvkcuxcrlRPVJbmu3NQI/C79Hk6C0SXy8eUVPBt bTvX0hiBM80gSjOETPZqq5PEE/7HRKd/WEbfxjTDYmOHjNCnjrgfbVDu96lA+OwDSJuz 3YVV2ars5Y+0fusZ1XDH2qkhKXenxlmS2qdsjlnilzSMn9SeIe+EnvXNuGiqiFIBxsKW POumbpC+ZgxyXLDQnamFhCNnuszZFrJWR+5s/36fWaIj72yg4KRkmU2EEcjClEcUJrnL H4vQszMMA5hPvpvvXJLn29Gu2T1XN3jFOG5g+e0LifRKm05EsRkXmOmS95ZX3q32D7ac RxZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xX0hIQSZjL8ZR7arM3SqbUY2tpWX5DtaOT38oFoQlVs=; b=DlYgA0ceVVSNpf8+7NKGwp+ZDvi5hIlCRVS0Wx6L0PcyXGW0KS2aU9+kkgh0Jktew9 7rlgdsp8tTQh/pIpP8LKd3MVfFT+MIpgKJRQ8eX7lB9GmUwDtE1KS0GPWJsF0SebQlr3 QFHcj7ZuD9CzYmBx66yTsZWCI7aQPEDYCWkJGQDdiaQOaP3/x6tAXpgSipE5lxx7TCl5 BimLqQB0I7U/A5ulioi3bE7pB4TsA5nRXcPOe3cRw/uNIozG8P+dXiN/Zfy82uX11S4C hXAXMA+plbGc7bNQNNLQFWJNFeek9IZjeZr+zxEPkZtm34pEPDzw7hMaegvS3iEGsWBG oWDA== X-Gm-Message-State: AOAM533YDf1HySWufzurPm7APKnyL0hBQlUZZUdgNgIjAY4tNXXoBzlK vqTKCOmP8Qv4Y4zmLtsTk4pCgkiq36FcCQ== X-Google-Smtp-Source: ABdhPJx3Rp7gaStEeZ+vhMmC3WNZCyp/+0l7RWaIV4yyju99auh62UIB1TvzWrj3cHsVjn1Ll3ioqg== X-Received: by 2002:a02:2345:: with SMTP id u66mr74890jau.129.1636561961495; Wed, 10 Nov 2021 08:32:41 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id x2sm130403iom.46.2021.11.10.08.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 08:32:41 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [RFC v2 6/6] *-user: move safe-syscall.* to common-user Date: Wed, 10 Nov 2021 09:31:33 -0700 Message-Id: <20211110163133.76357-7-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110163133.76357-1-imp@bsdimp.com> References: <20211110163133.76357-1-imp@bsdimp.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d36 (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Warner Losh , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move linux-user/safe-syscall.S to common-user/common-safe-syscall.S and replace it with a #include "common-safe-syscall.S" so that bsd-user can also use it. Also move safe-syscall.h so that it can define a few more externs. Signed-off-by: Warner Losh --- common-user/common-safe-syscall.S | 30 +++++++++++++++++++++ {linux-user => common-user}/safe-syscall.h | 0 linux-user/safe-syscall.S | 31 +--------------------- linux-user/signal.c | 1 + meson.build | 1 + 5 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 common-user/common-safe-syscall.S rename {linux-user => common-user}/safe-syscall.h (100%) diff --git a/common-user/common-safe-syscall.S b/common-user/common-safe-syscall.S new file mode 100644 index 0000000000..42ea7c40ba --- /dev/null +++ b/common-user/common-safe-syscall.S @@ -0,0 +1,30 @@ +/* + * safe-syscall.S : include the host-specific assembly fragment + * to handle signals occurring at the same time as system calls. + * + * Written by Peter Maydell + * + * Copyright (C) 2016 Linaro Limited + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "hostdep.h" +#include "target_errno_defs.h" + +/* We have the correct host directory on our include path + * so that this will pull in the right fragment for the architecture. + */ +#ifdef HAVE_SAFE_SYSCALL +#include "safe-syscall.inc.S" +#endif + +/* We must specifically say that we're happy for the stack to not be + * executable, otherwise the toolchain will default to assuming our + * assembly needs an executable stack and the whole QEMU binary will + * needlessly end up with one. This should be the last thing in this file. + */ +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack, "", %progbits +#endif diff --git a/linux-user/safe-syscall.h b/common-user/safe-syscall.h similarity index 100% rename from linux-user/safe-syscall.h rename to common-user/safe-syscall.h diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S index 42ea7c40ba..c86f0aea74 100644 --- a/linux-user/safe-syscall.S +++ b/linux-user/safe-syscall.S @@ -1,30 +1 @@ -/* - * safe-syscall.S : include the host-specific assembly fragment - * to handle signals occurring at the same time as system calls. - * - * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#include "hostdep.h" -#include "target_errno_defs.h" - -/* We have the correct host directory on our include path - * so that this will pull in the right fragment for the architecture. - */ -#ifdef HAVE_SAFE_SYSCALL -#include "safe-syscall.inc.S" -#endif - -/* We must specifically say that we're happy for the stack to not be - * executable, otherwise the toolchain will default to assuming our - * assembly needs an executable stack and the whole QEMU binary will - * needlessly end up with one. This should be the last thing in this file. - */ -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack, "", %progbits -#endif +#include "common-safe-syscall.S" diff --git a/linux-user/signal.c b/linux-user/signal.c index ee038c2399..cfda166f9c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -31,6 +31,7 @@ #include "trace.h" #include "signal-common.h" #include "host-signal.h" +#include "safe-syscall.h" static struct target_sigaction sigact_table[TARGET_NSIG]; diff --git a/meson.build b/meson.build index 728d305403..2f3b0fb2d6 100644 --- a/meson.build +++ b/meson.build @@ -2873,6 +2873,7 @@ foreach target : target_dirs base_dir = 'linux-user' target_inc += include_directories('linux-user/host/' / config_host['ARCH']) target_inc += include_directories('common-user/host/' / config_host['ARCH']) + target_inc += include_directories('common-user') endif if 'CONFIG_BSD_USER' in config_target base_dir = 'bsd-user'