From patchwork Wed Apr 28 19:33:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428609 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp922909jao; Wed, 28 Apr 2021 12:35:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx24p++CuePh27GHL3yVwMAUwqNcM1hRI2ubDwL/42YBQ1HLKs5L64GkFT3hhrfd8BYPMv X-Received: by 2002:a05:620a:1456:: with SMTP id i22mr29370677qkl.400.1619638551545; Wed, 28 Apr 2021 12:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638551; cv=none; d=google.com; s=arc-20160816; b=QxVhLEKoBlLopBvqpj0EGUFn9bfbhFXktC+IUS81a5MEZp1IP57paZsPWBPhAr3n97 lWf3M3NmIrmqQWY+3KTDvvMnJOgXsqCY9sm6hn4vFj0eAG1vRDFG19bQauMcoJH/5DSj B3DpMg3Nn16Os3aW814Ss/vnje1RLsnVMaGb5+YBdeiM8kYM8X4O4FLOTtnYr8kE4N9x oW3NLWyHbZ+3mZO6QBpfG+hBQveDUmAO0N0ugpd0Wqad8RwYELrq9muo/pafaREUnq8+ PDIR+PnX00NvVChnOiC6icwWoHQmEzQEm8BloJ7n7Wa0aST2mAG61jXirTxQRwuIrAw0 3HDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cKz59LBlWyL1B0Sl0FJSvMv7AA4rumd2kHEJJnx9oPw=; b=Et2sgsm+qZVZivVlpn8F1mIbKQwC50JiAvhBhFNf6dUFv3JOd8PcicQuv1W193kEqQ fJrzS9rHKGC12IKF6hud6eNkr86ywICXSEjs71GVWTg1h2tztHkvjUWy9XMqRcipHxwz 3S4ch4K0ycjtrT57uFC3HwLsYfXGpcB/n4UCL180fGRVAQDlvdCNZnuJO0qROFbhSf+2 fO50b3NrX/bk5PVo8g6rfdOdFOT1IoDjOdzm8xik5qN5rV2v/tuiG02/B/wK1f/PSsQU ij3HcbTdWjtEM3Hx1t7kIWjbPcYqskQXpC03no1IQ3oTCP6yKo6bD28H/jAF3zScuW7F pC3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BBh+gQyE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n15si458850qkh.294.2021.04.28.12.35.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BBh+gQyE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbpyR-0005op-1p for patch@linaro.org; Wed, 28 Apr 2021 15:35:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpws-0005nX-46 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:14 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:39440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwp-0004Zw-Iv for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:13 -0400 Received: by mail-pl1-x62a.google.com with SMTP id s15so5014107plg.6 for ; Wed, 28 Apr 2021 12:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cKz59LBlWyL1B0Sl0FJSvMv7AA4rumd2kHEJJnx9oPw=; b=BBh+gQyEFs9zbVokzSXc6j6ynMGK2MJKeeCf7GjU0gWKfCp1t+l5GATZD5hK2UAfXS 0vMIJc+3Al+9HYrL+cnl1Rw2UH5gAnSKOJMSkUWTqcAaEs81+FmwzmoxMF6ZxCps8MEO Y8Y32tpjXJmiD0PZ3RHteR463o/IlkpEfs4dTNSE2Jgi0VjMUT7cY+nMsUXPph5cdwf8 7ddHJpWCJYFVjxsZCaRr2TB4MTu/d56tgIs7f9G1X5Ts2/Bfwn64Dew0CyxQS+LmCeIA 7FaQ54ScMGHcUzhr5CBwykluNTi4AEbCBon4+IX6ZcaWG0RB7FB+iLoHkxl19beAfmDl GJ3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cKz59LBlWyL1B0Sl0FJSvMv7AA4rumd2kHEJJnx9oPw=; b=rXd4E/EmPNIPKJDtQXo7Zd18hLFmG3B+/R6pI8xOiEp7+AiGsQTtZ8RE7FC1BJC3eB jnGnQU59cKpktcx8Vo5Lr8sU38fjrAuFdwCKhuPiVXv3Azy5Q2k788pdyz6wTCVcvOu2 xN6/qwA56wx+0ZeDuKvRCdfFWYQIdXuVPR57moU01+yng2JFDRfP2KU98QnrBmMWwY6b EmniXyIYyd20pHX9CrWUglc84/lvKfT5gx/lf+7lP5Q4V2gtP8JK0p3lEcKY8VEhuBUI bGyMkj2T0WMamOeHQA6yzPiUIAxnvlIJIe9nqXNUb3Xi7+Aeeap+YRWinz6HtVa2qIiP YOsA== X-Gm-Message-State: AOAM530KfQsvU4tXNoXRwGBTfZWPe5I+Zv0ALW3DRX56EIzv5p8Y52pP Weal8fTPYZ9JS/oJIz4jNpxBhPD8pkitmQ== X-Received: by 2002:a17:902:b494:b029:e7:36be:9ce7 with SMTP id y20-20020a170902b494b02900e736be9ce7mr31689532plr.43.1619638450051; Wed, 28 Apr 2021 12:34:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 01/15] linux-user/s390x: Fix sigframe types Date: Wed, 28 Apr 2021 12:33:54 -0700 Message-Id: <20210428193408.233706-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Noticed via gitlab clang-user job: TEST signals on s390x ../linux-user/s390x/signal.c:258:9: runtime error: \ 1.84467e+19 is outside the range of representable values of \ type 'unsigned long' Which points to the fact that we were performing a double-to-uint64_t conversion while storing the fp registers, instead of just copying the data across. Turns out there are several errors: target_ulong is the size of the target register, whereas abi_ulong is the target 'unsigned long' type. Not a big deal here, since we only support 64-bit s390x, but not correct either. In target_sigcontext and target ucontext, we used a host pointer instead of a target pointer, aka abi_ulong. Fixing this allows the removal of a cast to __put_user. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index b68b44ae7e..707fb603d7 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -37,13 +37,14 @@ typedef struct { target_psw_t psw; - target_ulong gprs[__NUM_GPRS]; - unsigned int acrs[__NUM_ACRS]; + abi_ulong gprs[__NUM_GPRS]; + abi_uint acrs[__NUM_ACRS]; } target_s390_regs_common; typedef struct { - unsigned int fpc; - double fprs[__NUM_FPRS]; + uint32_t fpc; + uint32_t pad; + uint64_t fprs[__NUM_FPRS]; } target_s390_fp_regs; typedef struct { @@ -51,22 +52,22 @@ typedef struct { target_s390_fp_regs fpregs; } target_sigregs; -struct target_sigcontext { - target_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; - target_sigregs *sregs; -}; +typedef struct { + abi_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; + abi_ulong sregs; +} target_sigcontext; typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - struct target_sigcontext sc; + target_sigcontext sc; target_sigregs sregs; int signo; uint8_t retcode[S390_SYSCALL_SIZE]; } sigframe; struct target_ucontext { - target_ulong tuc_flags; - struct target_ucontext *tuc_link; + abi_ulong tuc_flags; + abi_ulong tuc_link; target_stack_t tuc_stack; target_sigregs tuc_mcontext; target_sigset_t tuc_sigmask; /* mask last for extensibility */ @@ -143,8 +144,7 @@ void setup_frame(int sig, struct target_sigaction *ka, save_sigregs(env, &frame->sregs); - __put_user((abi_ulong)(unsigned long)&frame->sregs, - (abi_ulong *)&frame->sc.sregs); + __put_user((abi_ulong)(unsigned long)&frame->sregs, &frame->sc.sregs); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Wed Apr 28 19:33:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428611 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp924476jao; Wed, 28 Apr 2021 12:38:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4UIjzZoY5/gi/mNY8d5DG62nFTzGVh0WZKtMWeSt63bDwM7ep+P56lDMTwX4pyZRFU1sg X-Received: by 2002:a67:ed0b:: with SMTP id l11mr27485992vsp.0.1619638681776; Wed, 28 Apr 2021 12:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638681; cv=none; d=google.com; s=arc-20160816; b=w0az+UnVVKP5fiDiSb+JTAZ6/8Ff6oV/IPIoO57jMILgntfhW1IJFpSA8qeSTPZ6af FqrFqckaH3UbkoPr01dFN0by/K8FC/lj19MmApo/cD8s0MUx9yo/dt1RVkG8S/lxPQ3t 8pTi9lIiT3/ZSdYaa8lj14dRxOoMb9syeuxoiaz5h98YJEBje8ESTvq9veqeD4G9MGLS NIqBmZOdbxbPVmWrtPSF41XcUGg+D6xzepjR3Z+gnu4iQWhec7Qt2WlytyZTWIuiPwxn xkclyHB8rKykoeY2oXIl4c4B7WO5z5MO2RRVRDFCuBMCuEOubTJMvy3WL0Jtu1j661d0 g4+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=MFMQ5QPUjvF/CC4yZGIdqNUY924Mg+oEIBltLfl4FzI=; b=tSaP8Wi5kps8MFDQdnkCZZYSA+IuMiz1o3EsUOCj7lZMc5TLGfMZ+d0yiJ/trjL9KT 4/naA1NSYdCN2anAxJN3t5gjT/kqej6aLEIs+nAeSVQs5JNWPOAR784Z68ENe9QHtiGV DYvK/YA78COp0MhjUZQ3LoRZU4YtZMn8LjTIXzM3eBdrLR/XMDAZhm5uElYWx+fnWuOJ Iq3QP5w/f0RAhSDiLmym7j6Vl7XUHU+PNOhj35xBW1BeFJH8Evhh/o2O1NL1JMYdntHb b/AEWexbfHn/dtmGGGJiFtjNgThTCXXD5LYsFDDMsEWLcqO4tyjWEV8vtD9nMayreOa9 FgHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JwPPJ78S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v34si788499uad.190.2021.04.28.12.38.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JwPPJ78S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbq0X-0000ak-5G for patch@linaro.org; Wed, 28 Apr 2021 15:38:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpws-0005nm-Fq for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:14 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:40468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwp-0004aW-Uq for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:14 -0400 Received: by mail-pj1-x1029.google.com with SMTP id l10-20020a17090a850ab0290155b06f6267so3470944pjn.5 for ; Wed, 28 Apr 2021 12:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MFMQ5QPUjvF/CC4yZGIdqNUY924Mg+oEIBltLfl4FzI=; b=JwPPJ78SqI14p8RMm24HRmsss0d8BqOTcoAAhyiTaurzcxirk6/srcpKQejebuRYXP L3Ylwe5EKXdXN2YnH1MAA23sAmFXAYNVBl51UQLAc/P370AEMyVzouYJtXwmPuAivbB0 9rIJgJhTCRkxFmLZxmP/JOfh4PFzHws5T8WxK+UjnscPWlCT+tL6dHX4pgGuc4zRCRTn r7ijFmXDyll6qU+jQvD4uIN1XSY4xJ7Oi3500EKNViD7VXJYeEEODGbO7ckyD6G3Q7DR XHjnTGh68jsNHOFOvuaOLF2gSVc/qb2encax72uc/BCgqNeV1jcWHL4eDlQboYj/ng1s dTIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MFMQ5QPUjvF/CC4yZGIdqNUY924Mg+oEIBltLfl4FzI=; b=VNqeQFgWEHpmO2cxQjjR+DWQ7TyzKAebLsSCIy5cscLZvssssChpWNNAgrnUZ2Usqz /ByGc7QJoF0H6HgF5bgoiPqvdI/5PbHTmAn1FNM9GlXdtyCo8yW3wnlHENpS2VFox7+j JsPnm+7Mg+eGWLhPsr81YqucO5xU69q07oCnN25gnNS7BbNexCb1BTQiLMo6tzx3pU4o PjryBZw7nkjbrvQxEU3d5rJxh744KWtDv3FzG5QB11wdBQuTwBmY2xcsw+28Da3sIszW sBCFptGouf9eqChqRp23epNKnIa1d1rPcm76L+Ny7MdLFrUJNOJw2Ydj1GfJHcK381fN ER4w== X-Gm-Message-State: AOAM531K9hJavL0xfPI2RhgsN6oWUiiZqtd+UzYEnIeSQpeWoGMYYGCV ouYu45Tw+LgWjC0aJkZAhg3G220TXSK74Q== X-Received: by 2002:a17:902:bcc7:b029:ed:6f73:ffc4 with SMTP id o7-20020a170902bcc7b02900ed6f73ffc4mr5504700pls.1.1619638450688; Wed, 28 Apr 2021 12:34:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 02/15] linux-user/s390x: Use uint16_t for signal retcode Date: Wed, 28 Apr 2021 12:33:55 -0700 Message-Id: <20210428193408.233706-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Using the right type simplifies the frame setup. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 707fb603d7..fece8ab97b 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -25,7 +25,6 @@ #define __NUM_FPRS 16 #define __NUM_ACRS 16 -#define S390_SYSCALL_SIZE 2 #define __SIGNAL_FRAMESIZE 160 /* FIXME: 31-bit mode -> 96 */ #define _SIGCONTEXT_NSIG 64 @@ -62,7 +61,7 @@ typedef struct { target_sigcontext sc; target_sigregs sregs; int signo; - uint8_t retcode[S390_SYSCALL_SIZE]; + uint16_t retcode; } sigframe; struct target_ucontext { @@ -75,7 +74,7 @@ struct target_ucontext { typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - uint8_t retcode[S390_SYSCALL_SIZE]; + uint16_t retcode; struct target_siginfo info; struct target_ucontext uc; } rt_sigframe; @@ -155,7 +154,7 @@ void setup_frame(int sig, struct target_sigaction *ka, env->regs[14] = (frame_addr + offsetof(sigframe, retcode)) | PSW_ADDR_AMODE; __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, - (uint16_t *)(frame->retcode)); + &frame->retcode); } /* Set up backchain. */ @@ -216,7 +215,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode)) | PSW_ADDR_AMODE; __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, - (uint16_t *)(frame->retcode)); + &frame->retcode); } /* Set up backchain. */ From patchwork Wed Apr 28 19:33:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428615 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp928856jao; Wed, 28 Apr 2021 12:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnZyiYXbgySB8lstr4mw6gjiabfsowMhJtCLQDsPh1Ad+yPwj7fz5x3wGaZQ/1ROVlFITe X-Received: by 2002:adf:fbcc:: with SMTP id d12mr37927455wrs.151.1619639073624; Wed, 28 Apr 2021 12:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639073; cv=none; d=google.com; s=arc-20160816; b=x8CGY244iCdlShS4NfR2HuVd6mR853EjashSJ2Q7DdNEyeLOKrTwNFVgQihviD4ZWL 6bDaM0T1NwI5lAJwVUZXBbYTFrBkkaPlO8Ip9LLvD2oddtEL57xDiNZTcXmwZywOQzeZ sMLI3HtbQ8+ScfMKeWyrAqQj2q491rfeU0UsZHQ8YgWU43lO4vWzXeN9rUqls6PXJuuM e3Svl5ZgzLF1/sySZuitV2d8TkO19OQjEw2F8dWZRUPt4GIv9qSuWO94UV63RoqyUI00 UvumehhFjFMtqEIXvYRPbWPaUC9AE1OvOFnzgniOGXbfpybafr2RCksABR/oeMo3Kjs7 Tc6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=efOPXIXBWd1fL7hpfuKuY271cQpsQ0RFxDHULLI6NJM=; b=Xj5xwwX/iw4nI6VC72ZpzZecWvBXZs9HzweD15tRtamWuHxNc7tfjQLeajFZ6WhlDQ +FYF/viixRGHMoKmMVgtTeAPxDrP9a3OqnGdV4BGO/aorfbQRsrrPnYFqzeaaVX1Jk5A gN7i5HdjkRJZ6ZDoBJJH1oC+1PdnFmufYqjrn0WXbvWpURJ8sreZw6+aXyEScoeUMQMT VMF33ww2/nNFHJfCINElEjlYp6iaS+WHxcYxdVaqeC/YhXpP2jhIu8DfDv+xH7+uo6b7 9V4cEVn/Ql5AhIP+xJZPHQP5CjDMe5P+t2vuJLP/Kb18IV+nfPE39TQILSh6EE2ZyZhl N1iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GdFWYOmq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a27si803634wrc.460.2021.04.28.12.44.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GdFWYOmq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbq6q-0006mo-GW for patch@linaro.org; Wed, 28 Apr 2021 15:44:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpwu-0005pQ-1H for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:16 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:36571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwq-0004bE-ML for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:15 -0400 Received: by mail-pl1-x632.google.com with SMTP id a11so2543609plh.3 for ; Wed, 28 Apr 2021 12:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=efOPXIXBWd1fL7hpfuKuY271cQpsQ0RFxDHULLI6NJM=; b=GdFWYOmqllgkcgY0eLesYISiIWZgvQwjNSZA56czPnZNuc5WOGQ1ogjJKF3hqXJK1p u1rh+ZRg3+iGANrOn4QreDcJ72IMw07fFtL7h/JWoI8+Rb8AWbg2zeO5PYdQnta8gaZp jZMF3R9AI3Z4aFVCByjr2ROQE7iYjyAFcJ8PWcl+InaCdl3CZfP9hpLeJHJbUOOdN5/z Av8yhzZHbyH4j1BqzNGX3bADEu2/vBnKlE8ndatUp1eMCaECpXvPNPikQ/YelFm/z4OO CZR6yKckKl6MbVU3u9sFy6NMCRHmNFqP4p0eEmCTU62Oh1ke74jY7Pc+QyAXCJVzdocT xAgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=efOPXIXBWd1fL7hpfuKuY271cQpsQ0RFxDHULLI6NJM=; b=Cr+JPR7h9UgWzDPZRfstz/Zu17gCde/OW2FyRa6gYF/Qwp3snxZp3spmRZY8Yjwzuy 9snnzNWCDYJUijCJtIkAKTXUmY2C3nvxxCggiNnMBtLOZHtdd9xyyVTb1gB9aSU2+j3/ O/QZZXt3YY5AMzqjcq8DFyYutgVtBBlxMAAF1y0P4jTOC22RoaCaZB79lCO0hCfxR7oG /0HrNNT/x7Y2HhbpADaw4wYIiWVYsc53kwDDJTqbKH7Q/CGqq257OG7wvevZ+sNoiRgL ZgwvN1noZtORAB+isjjMswCvsFaBdAZ/HOAdz9iuWgkiS5CeNc6SxyUnXhs5xsIMmBe6 UNcg== X-Gm-Message-State: AOAM532yst2fYCPz8icf9KFgW4h0CMjUXzVnDiBjGc6XubQYSHi8loRd 6NQQyHLZrgKmb3mT3/nT0EOb1Isazvt1cA== X-Received: by 2002:a17:902:b117:b029:e6:81ed:8044 with SMTP id q23-20020a170902b117b02900e681ed8044mr30901177plr.13.1619638451236; Wed, 28 Apr 2021 12:34:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 03/15] linux-user/s390x: Remove PSW_ADDR_AMODE Date: Wed, 28 Apr 2021 12:33:56 -0700 Message-Id: <20210428193408.233706-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is an unnecessary complication since we only support 64-bit mode. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index fece8ab97b..1dfca71fa9 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -31,7 +31,6 @@ #define _SIGCONTEXT_NSIG_BPW 64 /* FIXME: 31-bit mode -> 32 */ #define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW) #define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS) -#define PSW_ADDR_AMODE 0x0000000000000000UL /* 0x80000000UL for 31-bit */ #define S390_SYSCALL_OPCODE ((uint16_t)0x0a00) typedef struct { @@ -148,11 +147,9 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = (unsigned long) - ka->sa_restorer | PSW_ADDR_AMODE; + env->regs[14] = ka->sa_restorer; } else { - env->regs[14] = (frame_addr + offsetof(sigframe, retcode)) - | PSW_ADDR_AMODE; + env->regs[14] = frame_addr + offsetof(sigframe, retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &frame->retcode); } @@ -162,7 +159,7 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; - env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE; + env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); @@ -210,10 +207,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer | PSW_ADDR_AMODE; + env->regs[14] = ka->sa_restorer; } else { - env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode)) - | PSW_ADDR_AMODE; + env->regs[14] = frame_addr + offsetof(typeof(*frame), retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &frame->retcode); } @@ -223,7 +219,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; - env->psw.addr = (target_ulong) ka->_sa_handler | PSW_ADDR_AMODE; + env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr + offsetof(typeof(*frame), info); @@ -248,7 +244,6 @@ restore_sigregs(CPUS390XState *env, target_sigregs *sc) trace_user_s390x_restore_sigregs(env, (unsigned long long)sc->regs.psw.addr, (unsigned long long)env->psw.addr); __get_user(env->psw.addr, &sc->regs.psw.addr); - /* FIXME: 31-bit -> | PSW_ADDR_AMODE */ for (i = 0; i < 16; i++) { __get_user(env->aregs[i], &sc->regs.acrs[i]); From patchwork Wed Apr 28 19:33:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428614 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp927316jao; Wed, 28 Apr 2021 12:42:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjieOYFj2K4ud7LuXxsYPSO1qkZg3aO92igxV8Enw7wvWWp4ENdu7vF9IGy/7x7+I1AbWQ X-Received: by 2002:a6b:5907:: with SMTP id n7mr23955960iob.3.1619638934312; Wed, 28 Apr 2021 12:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638934; cv=none; d=google.com; s=arc-20160816; b=g7mowlVobTJ+md0O9OeYarmkh4rG+GffOeV6KpnepHYi+xGDvJFriPZsLgzOT1Wszc IZEK27d2O8FiMVwD/f4Dj6LcbZXWrQ8jatPo9vkO+OspIArl5tjiQmDkC7tC7pn/ZFkB e8S2RxXLsyw36upDI0SbDXY+9sTxWdYofVxm0QC4thhsgd3L9Yf9GRxqeqOt1Hojx4Rl GOavFVZX3Ha8tv+FTi9Ty1XAQ6wYwnWmfIeU6Nzh81kYKROPPlzylcfbuKDxx0lboNrO T+ytIH6L03FWZJcvtwWxhFJ80KiiDGjoWG8sVXbNnATHFEKgF1Lwv0wnm031gNxXBo/A q14Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PTbBn14FconxhVlG/Qed7GcchUeX7ogzz1x+sK3RjOU=; b=GmGZxo0rqyazeMy+rciPabxAHOokpZtKQmvlSgyJRTEkOVPMcvu3rNlG8zk0gda8N/ O++u+6rfp/SoAnVc1DL6P4EygOhNv4JhVAixVpjssDSqlzl+pBW1lrLOnvwUP9OBJfEf iq/USMHVw2F8aIpg4F+cZ7Fb/pRUhSZZMn8WJGKP2kemP2A0P1aFanUId7izqzZSjuWs EucSSBj51/48Fa27m6gWTS7iTF76ebeLClhyq9tm5HZ+9rqiR7v7/T6s27IJVi5gEe+G Fyn4tNTo8dpenRDoXivodAlZDMWXHB3G+XmyCI/+gnuUvStOeelHj0E9RssWel8oXiDf 2Hww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mUqZ7PUv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u5si837861jad.71.2021.04.28.12.42.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:42:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mUqZ7PUv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbq4W-0003na-Et for patch@linaro.org; Wed, 28 Apr 2021 15:42:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpwu-0005qf-Sd for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:16 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:45602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwr-0004bj-R4 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:16 -0400 Received: by mail-pj1-x1030.google.com with SMTP id gc22-20020a17090b3116b02901558435aec1so5951307pjb.4 for ; Wed, 28 Apr 2021 12:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PTbBn14FconxhVlG/Qed7GcchUeX7ogzz1x+sK3RjOU=; b=mUqZ7PUvJ9gNfjurbj1vNWAeOK0KBcdGSU4m4JWMWNGsGPITebEk2WCkQ8oVWqaJG3 sb2WYXofHWyyL9WDOMXPYcDi/GZ5ZewzZOYJgi21W8ZvNfZ+eo4gjLbX3dvchmarRFIX cZPaPj3rVY14XfxIB7K3xsDGtqUb1NO73VdquDR23TS9zQ0D+oGDJh4H9L1BqB+1X58V wGIZ/m8GinghDlSjx+/oO5M6BixGg0phiN/mO+0wo6NDCPh7g4gUP1I0xcpB6B+iwSuk OAl2EJcEF7woCYDpgxHW75aB4JVm9k6oYBe5AzvzskKmn57dG4/Rw7i5upoUJhIJDaKD XhqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PTbBn14FconxhVlG/Qed7GcchUeX7ogzz1x+sK3RjOU=; b=kO8Z6qzdFIL/Fc8bWGWq7tbZR+EvxNgp5TfEzfTM9l9hXb6OFlq8mDuffW8QfVEeC0 TkyKdTVepYitueaO5H5lfRV25gJKfBmKgf/qpfnk/n4sw43k7fTUH4eq0cYIZJXavwao z1/z05mPlXotYqeFiKbFPazqVWQR+FSW44SXN8J+lTWaBEbwr/OKEKUYX5mRtvXRR0L/ nyGKWfXRnx/VBWvCFzEO0YgcwpoU1Q9mM//QAnlnDRQNZEWsjjjUDNkADprl9+VzRYyU OjDqVxYveoWCH58vpT5T4HuGEALECCwtmGARMSLVMO0uWHupZbGhAOKBkKe1jHj37TS4 +dSg== X-Gm-Message-State: AOAM531ETSI0SBGifWNaRVljKKfV2Vo3fV+WlxEoboDfqU9SXp8CSHZG McXwm0pcmJQKJ4oLwzJ5W9l9GqysvIkQwQ== X-Received: by 2002:a17:902:e804:b029:ed:5748:9047 with SMTP id u4-20020a170902e804b02900ed57489047mr10543072plg.36.1619638451913; Wed, 28 Apr 2021 12:34:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/15] linux-user/s390x: Remove restore_sigregs return value Date: Wed, 28 Apr 2021 12:33:57 -0700 Message-Id: <20210428193408.233706-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The function cannot fail. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 1dfca71fa9..e455a9818d 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -230,10 +230,8 @@ give_sigsegv: force_sigsegv(sig); } -static int -restore_sigregs(CPUS390XState *env, target_sigregs *sc) +static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) { - int err = 0; int i; for (i = 0; i < 16; i++) { @@ -251,8 +249,6 @@ restore_sigregs(CPUS390XState *env, target_sigregs *sc) for (i = 0; i < 16; i++) { __get_user(*get_freg(env, i), &sc->fpregs.fprs[i]); } - - return err; } long do_sigreturn(CPUS390XState *env) @@ -271,9 +267,7 @@ long do_sigreturn(CPUS390XState *env) target_to_host_sigset_internal(&set, &target_set); set_sigmask(&set); /* ~_BLOCKABLE? */ - if (restore_sigregs(env, &frame->sregs)) { - goto badframe; - } + restore_sigregs(env, &frame->sregs); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; @@ -297,9 +291,7 @@ long do_rt_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ - if (restore_sigregs(env, &frame->uc.tuc_mcontext)) { - goto badframe; - } + restore_sigregs(env, &frame->uc.tuc_mcontext); target_restore_altstack(&frame->uc.tuc_stack, env); From patchwork Wed Apr 28 19:33:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428616 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp929376jao; Wed, 28 Apr 2021 12:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD5MODJ5Fr8grDD5wWgISj3kkw/iEvbgtkgRnujIyvVDSA/kRehf+SoEUq7bYAvcGydPYg X-Received: by 2002:a6b:7b45:: with SMTP id m5mr25764220iop.97.1619639116857; Wed, 28 Apr 2021 12:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639116; cv=none; d=google.com; s=arc-20160816; b=pvf8dozpO9hxRzYywNO+0CGSgjeuwXPAFGt9HrapWyJKrOgzMwXaAb/gDONWD/YGvO pZxanwP3W0EXGOihoiHdRYLRIZYK+veo4h3WPoaPbM+IPqRQ8K/HsgZjr6+itIy/47zP ChEDOtMCftN5D9N2jv6sNHprKHD07XwH2RpeYXRE+Rx5nuGpmH13NEsb1PaeSESpIALD MRh46xb6BPPQPyEP0cAWtfvUXEoqRmj8QY4sraFzYvNGo9cAWNnx7ssiso7EeXt9waAN hsU5H7eLMbrc2N5+oaMNCHdMi1/KAAnjYOngvpYMiZI8aN73cS86y/RT3ZlWJaKjPCKS Gr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=N/2oVwTgtFzi/+6uPZ9HD/sYjxDk5kmDDtru0pgwsuU=; b=yrobtu0eq5Lsj59WrDM2nV3T1tyHEo0T4ZycXqVET60Gus5OmBw2RROCsa40FJdJhD slI9FFX8GZgM2TFzGsKEnFR352lzkOPsMSec8rz9mCaC5S2Q0iO+v7bPi4FG4+QItbVk RdAMe5VXCWc3ppgtuKUpAoe5g9aDbLylkJodPXWbaxZ2MxZTUEaU4+GcdVupr5/QUR+R P55AU0tEKBPEdklgf5SjXcYARmmib9pp+p+xYKhmyOtaMfscRaKrt21h2dWFOu1/Kf5K pRCTeTAK3kpEFuKeOGVY+yc7+BuzALhvH+VAZbM2+W8R1yeplwdNjIxoiMo4OWqjqoBu EFew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TObIAaV5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h10si966148ioe.38.2021.04.28.12.45.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TObIAaV5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbq7Y-0007SJ-9T for patch@linaro.org; Wed, 28 Apr 2021 15:45:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpwv-0005sI-FQ for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:17 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:39441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwr-0004cC-SG for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:17 -0400 Received: by mail-pl1-x62b.google.com with SMTP id s15so5014161plg.6 for ; Wed, 28 Apr 2021 12:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N/2oVwTgtFzi/+6uPZ9HD/sYjxDk5kmDDtru0pgwsuU=; b=TObIAaV5V0JHvtPwBUbYZtw815b+i3Mh1i+lfPpQmdtDJ0GDN89wzDcB8Vi89ZVg/c N+p3OZBGn7GWPpCEx7Y3wjdaTmWSMNnlMJm9mAROFUACooTdHT/Ndy1dCTz0pKt8jDY9 dLg6hMxe8k5S7hDO+OGV8850fYAD3uZzaRW2vT7H+BA8MsJYohjGUY4lhg6ql3t7c6Tf TKgYHBgtA+9MeStfGEALR0MyYyyLjlfdTNMThRynFUXlBNKqfRNpJGOYj4rmfsLhRdfK +9C3s6lwIXKiL18vtAAy/QsNZTFYbwE9MfeUJNMnkmA1DyTFqWijoRXe7NMKxKrfmg1S jszg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N/2oVwTgtFzi/+6uPZ9HD/sYjxDk5kmDDtru0pgwsuU=; b=pkEAFBCYq1XMGcWO6K9K6a6kbEdPv4TIRdfJ3Tqf9j95ze1fDc3bMVFkZD5fOnmx9Q ouCO/dMNb7i0EVDeHwVCHG0lu9X5EzT+g7+6BJmPmme0UDbJRiumk4InvSSqudKYgWeS GSwga0GBQYe/ma5XR366Cv/ZrDoZfRkUfatmjrTtYuc69UiqrVeSpcbwT6qLjxlRsh0m 0qU2jOlmKFhLNnShUmqT/uqcZR7xN+OheI3BAh4K/qgKbe+YcCaVQFcQEuKqIGBgEDEF aSCV7Ze80m3DQB/GZOyaCKLN0F6MyCOAobFnkwJwHuyzRHNYbkTOd50VV4nBaUe3cToi D15Q== X-Gm-Message-State: AOAM533vXN7FoCqdilGFMEBfBArCZOYHB89fwJ80MYruX0etDwmFd7n7 f3kIuLa+qCDDfuj7XA7RXrnMyatoSYCYkw== X-Received: by 2002:a17:902:c244:b029:ed:4d5a:cdaf with SMTP id 4-20020a170902c244b02900ed4d5acdafmr12989731plg.5.1619638452527; Wed, 28 Apr 2021 12:34:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/15] linux-user/s390x: Fix trace in restore_regs Date: Wed, 28 Apr 2021 12:33:58 -0700 Message-Id: <20210428193408.233706-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Directly reading sc->regs.psw.addr misses the bswap that may be performed by __get_user. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index e455a9818d..dcc6f7bc02 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -232,16 +232,17 @@ give_sigsegv: static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) { + target_ulong prev_addr; int i; for (i = 0; i < 16; i++) { __get_user(env->regs[i], &sc->regs.gprs[i]); } + prev_addr = env->psw.addr; __get_user(env->psw.mask, &sc->regs.psw.mask); - trace_user_s390x_restore_sigregs(env, (unsigned long long)sc->regs.psw.addr, - (unsigned long long)env->psw.addr); __get_user(env->psw.addr, &sc->regs.psw.addr); + trace_user_s390x_restore_sigregs(env, env->psw.addr, prev_addr); for (i = 0; i < 16; i++) { __get_user(env->aregs[i], &sc->regs.acrs[i]); From patchwork Wed Apr 28 19:33:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428610 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp923193jao; Wed, 28 Apr 2021 12:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydNvB7Ks1Lfsh+sFMV5ldH2DR2Q8t5ucdMfn4fTg/5jL0Wt1lAHMIVEdCTQZi/rFvWZJqb X-Received: by 2002:ae9:f30c:: with SMTP id p12mr18397913qkg.294.1619638571209; Wed, 28 Apr 2021 12:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638571; cv=none; d=google.com; s=arc-20160816; b=g9g/6WmEm1zpgFn3xHPxa19BGvcIG3KysdqHKXOMg1ZcZHk7a+08Sc5qCah2pZUIz1 i1s181NPzwV3CmaCEIOVKurtCIzVehrE1MjzczK/KK6+AxtmXsv242Cf3gNia3gFMq9a kHyGVuIq+PuqBcG4xpKChL7lbr+ytyYwW+AIafUolUjk5c/XubExCxdJqT5hRfnRVY1P SVVKDhCo9eoRz4WSp6I5IglbsxPExm55b0rDXaNlhBtcyfzJXY00CcXDBUlPxjjPuMbR Zsk5QFxfb7VrzC28OsXu2kNpUfWovz66PBrKjWNhqvf3TM0TnNI16qAGlqP9zXQ7j4MU C92g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jfZsQ4ONGBdD4XoGEls4UPD+wvPxpUSmaLIy3AFINu8=; b=bI6YFLn0UfF915vt+YMRnyxBlo/DOiVWmP88AuZxaaTbsrajLZuo1ax2WJwpJP7pjO uc13BmZaiisfbQQdJwgN40iIiqhj34d5VyqCInOYK1eoGfC7U9GHaiX5hf0PYceyPIx3 TjW7pNM+zr87XSPRta1Da8b135u/w8bymnIHNMiiNt9tBT1WQ5eNQRyLIceAb+3ao7xl qfPBQ+mE2Nr+QaRQAXiMkaTCB4LXM1+9UckRXWHpiK1vI7rsNZYMLojzcBNOJjCRIZbl lWMPl9pF7yPJsCbwTit9AOydoAGUkR8ET88pAg45SbZUMl6245qKT31ER8nDUQiPoe7b wo7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ds+4gEQT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2si436327qkl.172.2021.04.28.12.36.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:36:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ds+4gEQT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbpyk-00063h-Oi for patch@linaro.org; Wed, 28 Apr 2021 15:36:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpww-0005uU-JM for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:18 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:33407) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpws-0004cx-Ja for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:18 -0400 Received: by mail-pg1-x52e.google.com with SMTP id t22so10235344pgu.0 for ; Wed, 28 Apr 2021 12:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jfZsQ4ONGBdD4XoGEls4UPD+wvPxpUSmaLIy3AFINu8=; b=Ds+4gEQTrkeCuLjdEgQyO9IUKxOaKmQ36mruNJjJDPLOLtvVdaU/1a6Hhu/OHi+Xay FAI6LRvpKw4DW9qQED7GMzolrTngaXGh72OrgtLFOs/NbYVC39ahSlUPOx15VXvcGVGn eko0zkBufHr2BiiePSYETRhhjMlHNPiRpXVwLuHknAWUyiJyO7BlirQp/nUatEM+xDHd vqn9ictOyDdLlRIfLOl/N08jjh+xvfR2byyoYUX9vFq2rmB4WIOBV+Uy6GZr0d5jMqBk 9cvHZbk4RQzU8yGW9zTD7jYNYbTrbly6q2NS2otuMsaQJ1RvYUNEEbD8L+ECpo2+6m+n U//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jfZsQ4ONGBdD4XoGEls4UPD+wvPxpUSmaLIy3AFINu8=; b=IIMGyVkDbbRNp6zwkAns4kpJTp/U/+xixYMMCGbcVLarLwtG6/siUusuiNQnbi3i3N o7kCu8IaDvtrXKs0zJGcYXLGebYua2l7UdT5/Lv01rW4SJES+Re/R5Wkshuh4+0G2+Gp eCeCJcdIDPkXw1gToRnN/8AKQPEvRP67nq8hzCpjQ/GAAQoFuyZ0uarIyKT8EnzwAGqO EV3jtRw1Da+x7nWYjLsxj25b3AENqDMgWhiAIAZfLBtzaitGlG4yt/nUS3loViOdAbLS hFZE3itiRftVsd+LOfMQXl9sdcF0NFYsT7iLY1lkOnUtTpYbQkpsu7hfIkn+rJxEjHM8 nUKQ== X-Gm-Message-State: AOAM5315+/i51QzdPH4D44qeMY6tzLbTuhnooNe8yUQv0lCiRscuC2n1 CBDJxO0Ta94h/Edq2k4L8tCz/OdqPBxBRA== X-Received: by 2002:aa7:8593:0:b029:259:c31b:945b with SMTP id w19-20020aa785930000b0290259c31b945bmr29030621pfn.27.1619638453173; Wed, 28 Apr 2021 12:34:13 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/15] linux-user/s390x: Fix sigcontext sregs value Date: Wed, 28 Apr 2021 12:33:59 -0700 Message-Id: <20210428193408.233706-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Using the host address of &frame->sregs is incorrect. We need the guest address. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index dcc6f7bc02..f8515dd332 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -142,7 +142,7 @@ void setup_frame(int sig, struct target_sigaction *ka, save_sigregs(env, &frame->sregs); - __put_user((abi_ulong)(unsigned long)&frame->sregs, &frame->sc.sregs); + __put_user(frame_addr + offsetof(sigframe, sregs), &frame->sc.sregs); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Wed Apr 28 19:34:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428617 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp931228jao; Wed, 28 Apr 2021 12:47:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcJMfKs3syjfoBsjojCmTqBlePBb9Ig+fjcfmUY+H6mUeGyEUDawA8VDyRN8+yWIlKoz9z X-Received: by 2002:a92:bf11:: with SMTP id z17mr24882623ilh.146.1619639279602; Wed, 28 Apr 2021 12:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639279; cv=none; d=google.com; s=arc-20160816; b=Ghr3Sco+swNdhrb0zYKzF9WYYTx7AbtV5/46S/0QKIFv+LCe29HQ7N5aiOe6yCBtaW 4Eoszai26GID0CHku7tStKOX2451ExWUxZcFzMG16rFKKeZ7Lp558Wv8WKF2aiyuB3ww c1rHPTULY8rbS/PxeqFZPOwmns3IbS6H69WeQBsOJqcdRxDVcBGY9LYNVfCnF8Ebc2YM beLCG8iqC7rTFoCij090HfCqJ3PXJXmmq3rg5riQDEwxrSt165sT1xzc1LEIVzl2A/ia 3RqRPMXYULUVAjUNThdanup/7ATXVc80XsOuzXY6zNwak01L/Zmhg/mGy44Ipxb4IEar dtkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cvyPgkJcYXZ6bOSc2nb/SiFpxkxj4N6j6VcfwxXf6c0=; b=DF8VqfaMfEtG+ZmItUptSoVBlHvqpU35ncGlJpZtUvfBxgA5lrxJuUuPsXRyI3DhFp BaK1kEiCBkg8C4XLaxSLBqmThj4rHOhbw7EhgEdQylkWg5TuQ9mlglSMySEuvmzlNlWh aTBKp5qE0fIL5U/cupp/XL1pCBjBo1UwJKYofGk2sjSdWxTwn80HHCFHUt/d+dtLCYNa 0yH5fwEXDmSzKlQm0eoCzQwEgdfqE1Ke4cs7dmHZ9vJOlcJl8ZB/VuZvtL7kv9g4TH6j QcxoPtBXYTUff4RaGv4qPp835uxQeOw/FU2JV5eOmvgcr8rQHUrYhnT2FXepB3pZZYsL LWCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F5iPEB7h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q6si764227ils.144.2021.04.28.12.47.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:47:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F5iPEB7h; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqAB-0002cz-1d for patch@linaro.org; Wed, 28 Apr 2021 15:47:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpwx-0005vJ-MZ for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:19 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:36684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwt-0004d9-2l for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:19 -0400 Received: by mail-pj1-x102f.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so9591698pjh.1 for ; Wed, 28 Apr 2021 12:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cvyPgkJcYXZ6bOSc2nb/SiFpxkxj4N6j6VcfwxXf6c0=; b=F5iPEB7hNaVF+SsZHPgoK02I4TEz+fErymRMVqpfEkjnDqa4WB29dKStD8FKwcZi0q xaIVS+UnJnjOANgkrIML07VNCQJEUPmrMuYh8o0itwioaQoLTOTMIK2hJVA+bj8LZDE2 JTaZxGabmIoMo4PcCXNzjY3ZuWIo5vODBf0Tw/d7+/x8bqGVr1K4r+ZPhKoOCeRByeQT YxIoAXEKOypHt6pzdfJmJwoYwOqkSerpQzU5CIevWLZu9crsr04zH7Jx9SgrosGuNwqj smljolcvR4FTS1SKQrXUusrp/OBLwfiylBrO2dmDBm/I6IfXvT7mKiaNDSt4e3S1mlyE h1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cvyPgkJcYXZ6bOSc2nb/SiFpxkxj4N6j6VcfwxXf6c0=; b=ZqeiinrlSR9xmDzRrvGF1/N56VAj57sGRNuAs+3o2GMZB7N0vhmsg5drUmyseJHq1r S9MlcjrHd09gkf2Irbr3TjbehCrBmlEayVF3eNFC/EhfEGBkgcsHPqCQ2bm+XyUTAgif ZsovJcxjnV8+XJwbtIiaanQNbNUHI7Nx6UpQf1msfAru0ytzhJgFqHSEmeTozUNYbQyC t/l4VbuQRLr/qLYnDAB//371UHhY+p/smexVUoGfT/gshaQ8nvJM5+vuYC67qQ8d8iW4 TYZaIOCKkEUGui3+JV9CJy3xofZJOO5CEwQ/V3LUyIlB8ImRiSCeQB50abSLN7kV0LBW 6OqA== X-Gm-Message-State: AOAM5339+3IJysXvHGq+m1TBqD81wXr3faURmOo0mbqyPlDeezOg3rCS 1U6xIbalR2iyihnraRDMuoF3UbaBUFCbcg== X-Received: by 2002:a17:903:18a:b029:ed:1ded:d180 with SMTP id z10-20020a170903018ab02900ed1dedd180mr20114004plg.34.1619638453743; Wed, 28 Apr 2021 12:34:13 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/15] linux-user/s390x: Use tswap_sigset in setup_rt_frame Date: Wed, 28 Apr 2021 12:34:00 -0700 Message-Id: <20210428193408.233706-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index f8515dd332..4dde55d4d5 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -182,7 +182,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUS390XState *env) { - int i; rt_sigframe *frame; abi_ulong frame_addr; @@ -199,10 +198,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user((abi_ulong)0, (abi_ulong *)&frame->uc.tuc_link); target_save_altstack(&frame->uc.tuc_stack, env); save_sigregs(env, &frame->uc.tuc_mcontext); - for (i = 0; i < TARGET_NSIG_WORDS; i++) { - __put_user((abi_ulong)set->sig[i], - (abi_ulong *)&frame->uc.tuc_sigmask.sig[i]); - } + tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up to return from userspace. If provided, use a stub already in userspace. */ From patchwork Wed Apr 28 19:34:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428618 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp931400jao; Wed, 28 Apr 2021 12:48:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzMTEgCHiCwuzhwe19dSs6nIFUgoa1xPGHUFTKs9aG2BHLQNs65lX/M1p3tR0oFyOxKQFG X-Received: by 2002:a0c:aa44:: with SMTP id e4mr23661793qvb.41.1619639293604; Wed, 28 Apr 2021 12:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639293; cv=none; d=google.com; s=arc-20160816; b=o/RJwCSxj4XrMhX6PmNuNxyEZ1cDGmi8AuOhnsaaU7LtGQeTbJNJT6+SZ/KDZVw9R2 4oZg167qH4r6yqyRrJSG0zubW9cpJZdH0YxntGtVJjdFImw5ZOCgIR9qbcfLg190yW0y dzljfO2kyyH0syduXG6sa49mAMdSZfy5Kry/XRNTcYikvUig7oQ4SzdZAiU2qCow7sBo PMlMjas8cxVe8k+Z63x+VwmYGLi1/kEVJv9e6jL74Ox7CUYeIzpcSg3Sv/STPe8PGGgy vduKDyXdcHH0RVZIIRjkPeHcj8g6fNISBURuzDhQXnRi07AGCIZE8Gry8HAmNGnTXbm4 sxDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VEYCuDHkcV/lHpGQXOvQlgAwlC6Cxm9+fq9gwubDK9c=; b=Myeh8WuGP4lQbUD6BwBoMaOiY9TGlQbO8S8bnknBHgrnpEAwnp6UE34CZCgpcrAd5K Jxv9nceC5kDLWWjn1FuoPBGwbhhTP0n6ryMYILQO7KJFx4nQ6PRuycT8RNSrH390zNwA XKuK7CEvi4sKrNR41q64e0pdy28knjGAGtQLvXOUUaIS9UaP6xlXtfHuniWYwmDvlGeo BfuqM56tUQbUQksCthTjEfRsQvHvtKBLs4CraQdOgiAzydc4Qy7iay7Z/46nsOcmQkwb DvIT7itkdVcMdqpjMCdTKU6qnAkdEJWHs7vkGG8jHUZ1fSCEfLeY0jQfybU1RsF205KD b0kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cUAg8UYh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c21si414146qkj.313.2021.04.28.12.48.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:48:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cUAg8UYh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqAP-00029W-4F for patch@linaro.org; Wed, 28 Apr 2021 15:48:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpwy-0005vc-FQ for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:26 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:34759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwt-0004dh-PE for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:19 -0400 Received: by mail-pj1-x102a.google.com with SMTP id t2-20020a17090a0242b0290155433387beso3652968pje.1 for ; Wed, 28 Apr 2021 12:34:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VEYCuDHkcV/lHpGQXOvQlgAwlC6Cxm9+fq9gwubDK9c=; b=cUAg8UYhUdhvrmG7jC0kKW5w6chVGCENRnYXT+yO8Cc0V+VNwBjTTtPIFPgBHO7MjI nV+dt8Nk2miTBTLKuI7PIs2opjf4AyV/cjYiETVx3ADgXPZQauHNAFXwVPsYqLUtHaj2 HLdUmhgdIMvJnOhz/Ury6STEBkkaPpsuvnQxXmZvsMA9/zLSPNI8u89ahGUwV29JlF4I IwqwV67cZ1vhtK8jmq143I069qKLEO3Q0h+L1QaZmz+EgX3RXId137bh2tGzzkZ6S+IY F2sQKMmmyv8Ue3WVhTXTGbWEkV7uFPBikIpSzg8XYCCvLbpq+K1M1eGKsJkuPGbgC44E c/SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VEYCuDHkcV/lHpGQXOvQlgAwlC6Cxm9+fq9gwubDK9c=; b=ASr1QvRxI62/5l28Upn6DI5IuQtmhID/qMg7Y1U2qCGyUON9/+JNnmjjcZd8Wntp8x zBYdi7k5D/iSKDJIV7ysg7t4sebeWUy3Wu5ozkJUXJyjE0MPlRzXDUxAYw20VgQtG+l1 qlaHfUsR18fJqeKimmAqlviRFsijXd1ZRMisWN6iiHdTj+LCGKgh+6zAr/c1RsaG0A/D MM1Ii2WeprASlhdlpbeehV77YxKKXQaRgKyogChDnh05R9tnp8veJC78mTf+HyenYza+ UaHk/FTbKlR/YEGY7EAM73ZrgZq7OI8NRcv4zQldxJ7+OpvdkLBeiecQ864Lm3KXN17o QUEQ== X-Gm-Message-State: AOAM5305w9H3cU1tNiEnkI6aQZgPwrobFNJOYRKkVDvJzgA20G+DBOki mpPcqMibhxSinxDrlXgs9zmN+STF5oxjBg== X-Received: by 2002:a17:90a:f195:: with SMTP id bv21mr5591852pjb.56.1619638454370; Wed, 28 Apr 2021 12:34:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 08/15] linux-user/s390x: Tidy save_sigregs Date: Wed, 28 Apr 2021 12:34:01 -0700 Message-Id: <20210428193408.233706-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The "save" routines copied from the kernel, which are currently commented out, are unnecessary in qemu. We can copy from env where the kernel needs special instructions. Fix comment style. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 4dde55d4d5..eabfe4293f 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -104,23 +104,25 @@ get_sigframe(struct target_sigaction *ka, CPUS390XState *env, size_t frame_size) static void save_sigregs(CPUS390XState *env, target_sigregs *sregs) { int i; - //save_access_regs(current->thread.acrs); FIXME - /* Copy a 'clean' PSW mask to the user to avoid leaking - information about whether PER is currently on. */ + /* + * Copy a 'clean' PSW mask to the user to avoid leaking + * information about whether PER is currently on. + */ __put_user(env->psw.mask, &sregs->regs.psw.mask); __put_user(env->psw.addr, &sregs->regs.psw.addr); + for (i = 0; i < 16; i++) { __put_user(env->regs[i], &sregs->regs.gprs[i]); } for (i = 0; i < 16; i++) { __put_user(env->aregs[i], &sregs->regs.acrs[i]); } + /* * We have to store the fp registers to current->thread.fp_regs * to merge them with the emulated registers. */ - //save_fp_regs(¤t->thread.fp_regs); FIXME for (i = 0; i < 16; i++) { __put_user(*get_freg(env, i), &sregs->fpregs.fprs[i]); } From patchwork Wed Apr 28 19:34:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428620 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp934263jao; Wed, 28 Apr 2021 12:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF2yNtmdaCCuSI/9f1bFsndBBnv1l0ZmjbnfLUMjWtGiWujzKYzBdRplZwkKvTsg2qoBX1 X-Received: by 2002:a37:a34b:: with SMTP id m72mr29151652qke.92.1619639537488; Wed, 28 Apr 2021 12:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639537; cv=none; d=google.com; s=arc-20160816; b=Zj4jQjdcbAOSct0qS0h/uEIpEDGAJ7Pn/NquPzxReI5NxMptG7EqUZ2E4jAfBtU7Ex /0xqT099BQQz/74YTJhinIA/bVFNmnxktYxvKXueRlslq/1wq9pcI0Df0jIxFbU1wvbU zpuoii+yOIE0/pk1Oa+LCtdtsK1e2wK90SF6voYqIAXu6iLv18A7lWyFy6Q7SfAmyx8F kkr87wm49NZBtKoat46LdF4TH6ENl/f/dIOL5gBBr7uDPEEqI7/HN4jlssy97Ko6YQT/ W0mWHP/CpCKLPyxEcRU1+Ij55RUXIfwuJtfnSFWU0UH9Asy14tUK29/c9Jk2JykRJVEF LcyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=f8MdWoDokEF0cHPZFw2bFHzROtZRzCCUjyEwgPtySPNegMjSAt41p+rcCjhlpVinZx ryjbZhzEFzmI1tGfembueSePVCwqFtCGXlXlM8wHXM9opdKT3G761846HaoxwPNRDQ4q jWEFyq8qmNzoLvF2r7UUcNwf2kIQavow+XP0NADyR10cU+YaQ4m11J/D64NFWWFJVxBL UFuXEiphL2A9fLqFTwN9wx1HEyjPlZLbMJNIaaitpR1+2uV/wy50r0XIIsq+YiROBB0w 7xLnKzFD/KKaWbdmbtV2+57JNS3p/8r8ae5oEoY1yhPuASy23+rFpwTCiX002wsp0TPo MwNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x8IjsIad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b13si454572qka.42.2021.04.28.12.52.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:52:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x8IjsIad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqEK-0006F5-TC for patch@linaro.org; Wed, 28 Apr 2021 15:52:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpx6-0005z4-Lk for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:28 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:35736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwu-0004er-FX for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:26 -0400 Received: by mail-pf1-x42e.google.com with SMTP id c19so8558643pfv.2 for ; Wed, 28 Apr 2021 12:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=x8IjsIadr9yYK6/prYuf35p2vPokhrmWwGPNYB2/VDm/BlbQsWB6h4eNF0TX5+HseH E06j3RQza/32oneAlOX7gE7IC1hTMDHfoa7DcdgRl/Oe0VmVIuWA6/YmEi+N2QUPd84R VTeG0K0q8sJVhCbepSt4tNnwlZ9jdprAl1NK4eFfPfc/ZpCJDJ/X3gIh36O13ABH1GkD ltMTp8MPiHv9H0eEhE1nAxdlRzfDlWbLh0R3BMGSrMk4JTGLw5jyNgmcnMTWRpN3WOos T7LLouCFpC/8Y5HAuheJS1RunDQ6UWw3cJOVYy47D7hbleGPWOaZYyGXJbYvTniDZmWs MSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=kbfDDuz3D3mx1Sv9UCPZIRS4CfCNDGD++ksWElqLvMHcZlEFejzOzozsdePYK/3qA0 3y+VsGDs3Pdo+d0sLyQk/km6sOIGUJWVPDYNo42Ki1wNIAWgHEdVYFTffdSPFvGiMaox QcBHNq8LRfD8ArCftcNxC5BxikiytPVu6YmSdCfEUk3Bi3tz3I70xmtLAzjOK+gnw/yJ elOBxYhEA/fIiO/uEZhxnEpycjNptd5fLpXpHvV4n2M2DHmQRydDnHu7RT0V05PGTjq9 MwtBnPV9f7n38UAxOB7Q5AeTkARHsJRP+2eBusnm2mRTnfdg82fVLsejkKndJHBS2aZh kH1A== X-Gm-Message-State: AOAM530JcwSKHT2mh4+575bV5lqAUu6I3VdR7WSMWngyqTMK5Ev3i85U PodYdFaXUt29qJJgZclDllcxX8CXa9B1gA== X-Received: by 2002:a63:ff09:: with SMTP id k9mr7500501pgi.35.1619638455178; Wed, 28 Apr 2021 12:34:15 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/15] linux-user/s390x: Clean up single-use gotos in signal.c Date: Wed, 28 Apr 2021 12:34:02 -0700 Message-Id: <20210428193408.233706-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index eabfe4293f..64a9eab097 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -137,7 +137,8 @@ void setup_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof(*frame)); trace_user_setup_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } __put_user(set->sig[0], &frame->sc.oldmask[0]); @@ -174,10 +175,6 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Place signal number on stack to allow backtrace from handler. */ __put_user(env->regs[2], &frame->signo); unlock_user_struct(frame, frame_addr, 1); - return; - -give_sigsegv: - force_sigsegv(sig); } void setup_rt_frame(int sig, struct target_sigaction *ka, @@ -190,7 +187,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } tswap_siginfo(&frame->info, info); @@ -222,10 +220,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr + offsetof(typeof(*frame), info); env->regs[4] = frame_addr + offsetof(typeof(*frame), uc); - return; - -give_sigsegv: - force_sigsegv(sig); } static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) @@ -259,7 +253,8 @@ long do_sigreturn(CPUS390XState *env) trace_user_do_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } __get_user(target_set.sig[0], &frame->sc.oldmask[0]); @@ -270,10 +265,6 @@ long do_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUS390XState *env) @@ -284,7 +275,8 @@ long do_rt_sigreturn(CPUS390XState *env) trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); @@ -296,9 +288,4 @@ long do_rt_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - unlock_user_struct(frame, frame_addr, 0); - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; } From patchwork Wed Apr 28 19:34:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428619 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp933327jao; Wed, 28 Apr 2021 12:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyILvLQgBTwLRSLyRBshvUCFmWWnmmLpiy0ahKQaRtagpUiyqvpfCsyvGJKBuk4xHFOUQ4F X-Received: by 2002:a05:6214:bd4:: with SMTP id ff20mr15185945qvb.1.1619639466485; Wed, 28 Apr 2021 12:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639466; cv=none; d=google.com; s=arc-20160816; b=SjwkFa646nodXLTW+DGBFVQi4Jc+CkU+CtNfcxsSFhKrLvC9qQGUuWvbqIiWnxZW2Q wfYQO5aKsP9N/5ry5ubIOTl913MzxIw/F10AhPxvoMzTlxAVxogiNC09cw5z+Uqmt5BN Ipy2QoV7BucxxyE6iej33WcdWyF7HR4T7cnRDNBB/Z86N1+vbjvr2emh5KenBzq+gR0M K8HKKrbgUzPTl5QvB5zlc4y5L1KTAZZT8XSDEbzbeDe9Qf2kGjDWQYb3WKxqnMaADGwc e4oe1pL48LlDLneIMwZ7Hh/1mRQo1XKN3yQk3tonrrGTaYNESq2DwJnrDW1qUet6vOmN cbBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Cm5TMYYSdbHhrEfgw+Q+FUKj8miS2gdnBD1hAWEVD3E=; b=gfxiO+jPQfm6DOJoiqMVX6sjDSAehAWlCRSo35KLDCiB5btydCg31uSjjbGRfIzKf9 RVUieQM989+7o7JpWTckf3W+RIH6NaK6yFMbrdaeVd0hMSTXHzbVK20UTDjHagkEnzD+ v3QPyRp/qI4G2468sgEo7JxBd4kx+8/LztzYJ6ymvRIF7sN/AyxqbBoR+PpxtDVawPw/ gpkiHwMXbTcXw7oHDdsYrc3Ku9TYcxeKC+gZPO4GABZDRPRY323NRfxg0HPsZQQiRJjc D7gtJJhepI/JG2K0on5Vo7om1iRMT2/BX8nYDOSzqPOO25fuTchedrgdkbpkIjdiUJdM qjWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="X0KPTs/J"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s187si477952qka.284.2021.04.28.12.51.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="X0KPTs/J"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqDB-0005es-Vo for patch@linaro.org; Wed, 28 Apr 2021 15:51:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpx4-0005wb-HD for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:27 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:52737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwv-0004fP-87 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:26 -0400 Received: by mail-pj1-x1034.google.com with SMTP id lr7so15201704pjb.2 for ; Wed, 28 Apr 2021 12:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cm5TMYYSdbHhrEfgw+Q+FUKj8miS2gdnBD1hAWEVD3E=; b=X0KPTs/JjEjv/hdhe+C0sEdi+C4DTA3noNV8I7esXJEmsML3YRfbWScBmz0QigNdKg KmrbIeXkRJm2k+sVk12FXLfD3dkWbD8dmrx7QqyHuZ6Ieq+3IlWJ9RTSMhvwq5J/ME5s AaYYmaaiLovRhL94HHs4KAy+ntM50TE39qd8jFPsDOg+WwreOSGLYIfsL8T9/RewUkNq v6Ahv2PehCFrCGhTYz8zPYUCUDNJ4uOgWixx7xZuo5D4hQy2JpXj/ZAcngjjajsmjJP/ gqIUM4y3cZ2/N6QPbGDcTgT0kLzE80IJSybdk5RLlyOYnost0oTBEgmj7ybaNpe+xMHH JJJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cm5TMYYSdbHhrEfgw+Q+FUKj8miS2gdnBD1hAWEVD3E=; b=UwHniMyTw5sz3NjDCNG9kPco9pDYd9vH03y0X9BUEYZFJ3S6os9KwpwhCyMwM8RrB2 kCkODzhGsSKM5y1EPWaw7aCZYds0wJo1PXCO49/CPDJhL/Dbap5uH4USKOHpuug14x2l M3wxlMkEf2Kpf445ErnSWJTi+jYPcr/qGmdxBI0w6xVbeZZhmNX3VoNXXhyh1TKPUN7C dZhhfcIJQoJ2dmgfK/6LtuZHKvy+hULH3c3LsSo0BH9OGT1kZraQfn98YkhnxKCl0DN8 RzH1iQIA1OrTd8m2TOL/jb3QqGGrUxM0d+jWJw2cB3PcmqKb5b+4tMMpQXPJu+Ay9/FS u19w== X-Gm-Message-State: AOAM531XOme2EIZiHUKyw9j0BiM3baxxlZjVWwnDLsxSQHgGr34FBPG8 i5+P3IWRTdTLno2HR2Nr7jPGAehltOvZEA== X-Received: by 2002:a17:90b:e95:: with SMTP id fv21mr19337108pjb.107.1619638455801; Wed, 28 Apr 2021 12:34:15 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/15] linux-user/s390x: Set psw.mask properly for the signal handler Date: Wed, 28 Apr 2021 12:34:03 -0700 Message-Id: <20210428193408.233706-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Note that PSW_ADDR_{64,32} are called PSW_MASK_{EA,BA} in the kernel source. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 64a9eab097..17f617c655 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -162,6 +162,9 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; + /* Force default amode and default user address space control. */ + env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY + | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); @@ -215,6 +218,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up registers for signal handler */ env->regs[15] = frame_addr; + /* Force default amode and default user address space control. */ + env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY + | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; env->regs[2] = sig; //map_signal(sig); From patchwork Wed Apr 28 19:34:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428621 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp935534jao; Wed, 28 Apr 2021 12:53:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm+VdUogKFsNrdJpRo27NkW0hp+/fHEgP/eAO0bYxSq4uKLAFfTIxjT7JzD1AYEaWgCpPG X-Received: by 2002:a02:9643:: with SMTP id c61mr28446437jai.124.1619639632229; Wed, 28 Apr 2021 12:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639632; cv=none; d=google.com; s=arc-20160816; b=GIJwCFIkUyWrX3Fu+DxDIzA3s6grgvvxhQVTsXNQLGjGOWNfqyE0CMpaSzwzKv3Ee8 dBPz9Nnuius9eEcMWW8IZODZPg+3bbHYiAT+SJZYRBr7LctR6zbrCHvdUu0j8EqXcle0 /6Ale0Edip9J8zIGsUBlhQPbfIU53EHq3ckM90sapGQDWWoQCGNgC4KS9TcxoAK1JuNI cXG45VmrhnNPe1c2zYhDCsy0OKtNb7apmZdHVxS2a1hVih1vxm19O6+xFjX0bn8T3co+ niLQj6EnbOPosKdVUtGXcGLDEr5CtcZN1QSOURdC50RfFE08Krv67jmDrOE7QX3FdxBd QXCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vh0kfN5CfXJgIuyczvf+DwPn2SrN7UGjddvSaX9nPq0=; b=PtyHvH73IisHmWM/obaHag9KBaGe+WsdpodW3/bVdJlNsQioD9AXTBN1TsBLFWuNvC g5IwZ4AIgZAjqLoWP6RQUjBhU0bkXGJ2GfRwT6N7CL4A9Q1l9pYZIWk9JTz01zEesQ8K ZMZKG80aaKk34gRsFQDQpCqoqFHxF2j/j8Xqvts5IGUYwvnVd8fyozHt/UAQWbpbgDNo HbdGiULar183gwETflXFysoiLIUiRNQsIEfmWqn0HzWKBm++GiGhC0GpiWl1CrhIVwmp UQkvNd8O5vq/FgQZumH24EM0R98ioeZVmvHs5SnuGJnCLwaKLH6+X6FwTXSUh4pG87ZJ PLjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UuIAdgLH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q4si887644jas.111.2021.04.28.12.53.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:53:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UuIAdgLH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqFr-0000ry-MD for patch@linaro.org; Wed, 28 Apr 2021 15:53:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpx8-00060x-Mo for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:30 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:40711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwv-0004gC-UI for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:29 -0400 Received: by mail-pl1-x629.google.com with SMTP id 20so29483362pll.7 for ; Wed, 28 Apr 2021 12:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vh0kfN5CfXJgIuyczvf+DwPn2SrN7UGjddvSaX9nPq0=; b=UuIAdgLHbb3Kb7qU3A+f+M2tVJ/6JhxlzSzxzerbusJUr5b5s89R5g3eDqZ+Z+ieXW KIeJWR+pbZhviZB3FP5aghJkcIbfd/LUISELu54NoW/Bs+YB1FZGNqxitism6AWFJ3l+ iyvxN6XJdrgiNAr/rq9xkjuHJ/WFDAbm7iA5oVbWtCucVamm0mGcLV/IWkgk3XxoxOg2 Lgdu0j0nYm/R4e7sQSHBsamTvIVsCt07yabVVmx1eCeD+PMiQiB75EuoIRNPYVtDa+ds ep9MhplDOe7YeuHGvduGx4pOpAEp7KJ7iZYrlBUJ1U8C+jEB0DEwsQIXy5sjyPvYcojx wt+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vh0kfN5CfXJgIuyczvf+DwPn2SrN7UGjddvSaX9nPq0=; b=FZGwOZbja9e9JmThTKM1eOEIV8IQ2gp/ufCCrcy98D5M21E8Q14Y4v3fibE4A5Xjxi BhAoAV3Ob/fjIcuB2B1nXiKgW1i4ma51LUWxdcWtZ6x/qBGyqJSbF+nU7mzBhOiRfsuA bU/bmOcdlo/VWnfiu+XWNACidlTUDT9oYhbvwGvqsoWNtGMCpZVLAtjcn9dJUWuawy7s USv+YNXh8v5Gs/UByEF+vW0wkjA7KX3iyLTBr00A8RMf6aot8hF6PnOcORvdw8ePJoVd x5aIslq3IwVg7Jw+jedcTygvTZasyEA89AKN1WX60h/cns3sO788THgz5dETWNICirdE BlmQ== X-Gm-Message-State: AOAM533ccOdaWjl4XlBInQeJAuXSUfW40e+1kF0sHyFLyTrvBRDU83A0 ggR7iWjSXQkHcMAV8Vf9mQIXFgzttHRW/g== X-Received: by 2002:a17:90a:9409:: with SMTP id r9mr34377738pjo.157.1619638456430; Wed, 28 Apr 2021 12:34:16 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/15] linux-user/s390x: Add stub sigframe argument for last_break Date: Wed, 28 Apr 2021 12:34:04 -0700 Message-Id: <20210428193408.233706-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In order to properly present these arguments, we need to add code to target/s390x to record LowCore parameters for user-only. But in the meantime, at least zero the missing last_break argument, and fixup the comment style in the vicinity. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 17f617c655..bc41b01c5d 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -167,13 +167,16 @@ void setup_frame(int sig, struct target_sigaction *ka, | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; - env->regs[2] = sig; //map_signal(sig); + env->regs[2] = sig; env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); - /* We forgot to include these in the sigcontext. - To avoid breaking binary compatibility, they are passed as args. */ - env->regs[4] = 0; // FIXME: no clue... current->thread.trap_no; - env->regs[5] = 0; // FIXME: no clue... current->thread.prot_addr; + /* + * We forgot to include these in the sigcontext. + * To avoid breaking binary compatibility, they are passed as args. + */ + env->regs[4] = 0; /* FIXME: regs->int_code & 127 */ + env->regs[5] = 0; /* FIXME: regs->int_parm_long */ + env->regs[6] = 0; /* FIXME: current->thread.last_break */ /* Place signal number on stack to allow backtrace from handler. */ __put_user(env->regs[2], &frame->signo); @@ -223,9 +226,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, | (env->psw.mask & ~PSW_MASK_ASC); env->psw.addr = ka->_sa_handler; - env->regs[2] = sig; //map_signal(sig); + env->regs[2] = sig; env->regs[3] = frame_addr + offsetof(typeof(*frame), info); env->regs[4] = frame_addr + offsetof(typeof(*frame), uc); + env->regs[5] = 0; /* FIXME: current->thread.last_break */ } static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) From patchwork Wed Apr 28 19:34:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428608 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp922346jao; Wed, 28 Apr 2021 12:35:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPrihEAOktNsTGgwxRI85q7SkzWyzbRqkDMrxn6d7OhJLe6JxuDMxRMoaGR0QCoo4lVRXd X-Received: by 2002:a05:6602:3342:: with SMTP id c2mr25984461ioz.98.1619638512780; Wed, 28 Apr 2021 12:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638512; cv=none; d=google.com; s=arc-20160816; b=PexTyC1QTmYNp51gRQOhoQvCbKkCm8h2SFIoe4fTskBCYY9nw+C1pbxWPJyFbeMpyv 4p9g5TSDC+0d+7yKho9VVPwzcMQORYA+M6xMNFBs8XvRFSjrQLvH/8oA1/n05nR43TOo e2tj8E9yP2eZ5NVsueJMIC55WqNasenYXC+UXbG8OGmphoLc6bDngpI6wvZM7dRM7tBc 0bXy3QEj5m44vmpY4l3Yv+V640N/rrHWPlQjXbqjbOl67h8drzB7XFyKwBcEOWsFLJMA +v+yIn7rw7lchb7bKv0l6FaqgD3GhEsTxYr1nLjcVXWByx7wVl7aSebsPpblDZOWWnYH UKjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PRTcQMn0YPUCpUcreJVsTHoENIvP8EOBxAb8mB7Aw3E=; b=e1lXxsix4wEHwI1reMuF9Dv6gVfpIYACQfXyWhfKo6qvis8EpozmILQcVh8zxspuZf 18Fbj33Sifmo0eEeBIciyKaq9ir8/ZacusTIYsy/kQmkdceZ7cjeiISp2bLUdFZljWJ9 dj+tU4iKdwlPsF/4dqd3et8/INPy97InHka2XEPprM3zcf+TXnMMHDpPERR4Pqkdijev GrZSF6ynh72+3OR6q8RCAD4JIwEUzhVL14O55noqsfVAd+SH75/DuA56YNRTo/C8praB WC9tCO075gnDLT1TyVwSFrP6JqBJh97ql42mNIkeYNtLrHHl/AEYRplhSUuWISGEjoHh 6c/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wwi4WIol; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a12si757912iln.40.2021.04.28.12.35.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wwi4WIol; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbpxo-0006Dx-8b for patch@linaro.org; Wed, 28 Apr 2021 15:35:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpxA-00062e-H7 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:32 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:46691) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpww-0004h0-C7 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:30 -0400 Received: by mail-pl1-x635.google.com with SMTP id s20so17589415plr.13 for ; Wed, 28 Apr 2021 12:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PRTcQMn0YPUCpUcreJVsTHoENIvP8EOBxAb8mB7Aw3E=; b=Wwi4WIolU4dwNPk4HObG5X5wv0In4rWTpOAw992om0JNn+LVUb8RblxunApMSTQE3Z SQDSSSIetrrIP5syZ/EUnZMGndbdlDMtCzeW/LvMHmpniTtmRMM+kPvTAi4i2u/4yQRb IQTzVrQH6DkmGaonzxPgKh8Kx16XbAsTuHBj05fqQ6qyEyfxe+JzOE3KSb7gVuvP9ahO RQqY2R/4VI8UYDMIExkQau0mS7MfDQPyvxTTb7Mx45YwWrftQrMDbfaD3gujJgYKTujR mogpYPYqxZxDiQ4d8c14Qt2M9KxDFwe50HKA0scQnbtsqrdkj17GxK4YVzhLz90Ua+27 ttmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PRTcQMn0YPUCpUcreJVsTHoENIvP8EOBxAb8mB7Aw3E=; b=nT3gr/QX9rDp/eBUQx+AfQ/oNxOJUfdqZgB8WoLJYlmKpiTtFhJNGjrH+FpCH6aPsz yH4MhOzq16b31x4FQ1rmv4MNUkSYa/5pJF/atzBl0eoVwkLRfpU/340PfmlH1bz2XWKC 8mdwOnQLL3B5T/nN/E0KjI7Vl898h4yCQ+3Mm89khnl6KTBm9XXfRyywAt7kbE3P8dvz VY3f3lIHhzS71VLlDKLZEZPnndqqBCmjnk+7JID66JqJiAUFaUwBhdy4pEnMYABLs1tL n1O9wwAXUJWUgB1Ic5hwBwiuRIjrvNNShQDQUjDHqXyfgT80XrTTWtJb2FtFkKeAiLGs oGzg== X-Gm-Message-State: AOAM5303B4bW4okKi10gmsMXmT4+6qJ9UQmhQGpcdO2IZDsiM3Xgr85p /F713c0R/Spjh3tvXD8piAuWFuPm6qaE6A== X-Received: by 2002:a17:90a:8816:: with SMTP id s22mr5384598pjn.25.1619638457028; Wed, 28 Apr 2021 12:34:17 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/15] linux-user/s390x: Fix frame_addr corruption in setup_frame Date: Wed, 28 Apr 2021 12:34:05 -0700 Message-Id: <20210428193408.233706-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The original value of frame_addr is still required for its use in the call to unlock_user_struct below. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index bc41b01c5d..81ba59b46a 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -168,7 +168,7 @@ void setup_frame(int sig, struct target_sigaction *ka, env->psw.addr = ka->_sa_handler; env->regs[2] = sig; - env->regs[3] = frame_addr += offsetof(typeof(*frame), sc); + env->regs[3] = frame_addr + offsetof(typeof(*frame), sc); /* * We forgot to include these in the sigcontext. From patchwork Wed Apr 28 19:34:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428623 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp937617jao; Wed, 28 Apr 2021 12:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPRHOScoim1VHy3vAW2Xkv99FgbYtIRMpvdjo+I0GS/A9TW/NpDsREJWhaIDg+lyzcYR2O X-Received: by 2002:a0c:c590:: with SMTP id a16mr9234321qvj.30.1619639812792; Wed, 28 Apr 2021 12:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639812; cv=none; d=google.com; s=arc-20160816; b=RNKAwLIuDCUtSqHsVOZvhPrp1726wjUmXN2xnlWw1wUvfy2VU3SJjypL942k2M7HMJ 60OfmO7UlBCBQkdC802ci9lB4OdvjLk3WKguIpKRI6cAS02dnOxwArZEIDcYDhDueMXo x5nvWaIqAj1o2yQEUYiwwKTalfDyV1tZQ3BbehlJFV4yfBx5ppFmMUtHMlO9SyC9J01i VMlhY7Zj41OLIoZt4TSvxzuQ3sDKb9NXW/pKGNLsAR8oyaBi53J4+mHgk9Sd0WCcAAl8 hZAFJQTnAmbOPc7VmKmO0kQ/dTfCkANrbItrR4LzdeiFLYXSK6apaWGZdgufF4dyCUhr jj7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=l7ra7tjj6v+dYlp5urbxYkFtecDFMqZC4ZEp4+L75zo=; b=Ddf+5peY/+MBttyA4ic9Sq9FwbFVi/gRbAIpVgh4qVyVQIn3DiMPDQ9leG4YdKfIiG dyu6NQKpJZhD+KNKQwCkew1zgo9TeJKkQbpKu6OaSDSrVHb6ZjXwiOP6rjNwN0i/AcM4 HUnAlpzX5/TNc6d2os4nRObhW73ROfDWeMqcMKDMysCCxNaZGpmHAj4bKIuAw0kqV6zK HOhnuxPzdp5wZQKHT3SVX3GyfsX44xFFWFcEqCLm3TqNlUaRzCSFazh4VV3bsaYDJxDY DSg/qlhq7xWALDMSNmGO9+hIAX1yNgDWR02YSP3M5HOplZSguYROIbbJKg4spLRDCvb+ z9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="jF1o/Cn6"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x3si397199qvd.112.2021.04.28.12.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="jF1o/Cn6"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqIm-0003gV-9s for patch@linaro.org; Wed, 28 Apr 2021 15:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpxA-00062w-KS for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:32 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:38661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwx-0004hn-4h for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:32 -0400 Received: by mail-pl1-x62b.google.com with SMTP id o16so19828288plg.5 for ; Wed, 28 Apr 2021 12:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l7ra7tjj6v+dYlp5urbxYkFtecDFMqZC4ZEp4+L75zo=; b=jF1o/Cn6g8VCzBum5GEST1yVDzKT/3JyK+5/1FysoPwoFvugM7OSwuVPiOyXTeHfTW ZJNctfFFiQ4D/G5bdtpm4j/D80SjdQpiWnOOE/HYxmqfe9LN/MpoF91RbnjsBSQ5n4T0 6EeRqADtjuWSTTX8IuY8nJ3tnw1lbwptEUQFwHkETkkuWcEqkB5tVPFODLngRZoT3pYr /lxesj/1QDEgqtVIKjDeR2HRUIomQEAXkTqXY8RG59XR1E9OpC+aTv/9TpELFA+noAdU lCyPUK80riodLQl1VqU8moLS1Ybf0YU97ayU0IkSNabjS0a8vapMlvY4eVEOI+JCX1IZ aOSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l7ra7tjj6v+dYlp5urbxYkFtecDFMqZC4ZEp4+L75zo=; b=gAwYK6qXDam9o8QSJeknV0aLHlVAfkTD+Nug7Il8n8qJ/uNBbCYYc4ay/FmaTFZWt4 oSS1UlhvAmzkDL5YeWUiXaAc6AQZXYj0EyVhJa9/5zBSZrYlcVaV1rlB6CImrwB2bi20 TU/VqPKMDFzPXfWbzYKA7X9zjD1YiGj2TFRK3vPSxqaX6xaIqaGPonPjGAHLjJoW7pw/ R5e8z/TtLouY/LMLCiycoDrfq9xS4+7J5MG05qdbontosqJBxJorqOQ1x8mOEoxtzf4F /fSuF7m67ryDrb9VAm3fgId33OmkoLM0pCnAwzwFdM4GemgGGw1PJY3f7MlgmIVjZjnw 5owQ== X-Gm-Message-State: AOAM532oXpTMkAZ5B6UPIZt9kFEaKF2nhAnrrUf1QK9A92doHWetsp1b bPvsn0LJpIGTEhB5/30MTQTAUv7bPemq/A== X-Received: by 2002:a17:90a:a60b:: with SMTP id c11mr34329783pjq.125.1619638457786; Wed, 28 Apr 2021 12:34:17 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/15] linux-user/s390x: Add build asserts for sigset sizes Date: Wed, 28 Apr 2021 12:34:06 -0700 Message-Id: <20210428193408.233706-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" At point of usage, it's not immediately obvious that we don't need a loop to copy these arrays. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 81ba59b46a..839a7ae4b3 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -141,6 +141,8 @@ void setup_frame(int sig, struct target_sigaction *ka, return; } + /* Make sure that we're initializing all of oldmask. */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(frame->sc.oldmask) != 1); __put_user(set->sig[0], &frame->sc.oldmask[0]); save_sigregs(env, &frame->sregs); @@ -266,6 +268,9 @@ long do_sigreturn(CPUS390XState *env) force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + + /* Make sure that we're initializing all of target_set. */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(target_set.sig) != 1); __get_user(target_set.sig[0], &frame->sc.oldmask[0]); target_to_host_sigset_internal(&set, &target_set); From patchwork Wed Apr 28 19:34:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428612 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp924597jao; Wed, 28 Apr 2021 12:38:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv2IKkVRx6IWJDDK+r4S9aT8jnOrjoXQpDONA5Y9wZiw88nBHriG0fkekfcM1q4N26lPmC X-Received: by 2002:a67:f791:: with SMTP id j17mr27210020vso.5.1619638695638; Wed, 28 Apr 2021 12:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619638695; cv=none; d=google.com; s=arc-20160816; b=EjKmtkQPyvldQdQB1+H0Vl2oIP6LSdK3uqoruKFpJuCjpgpJ62YZZher538Bxb6HJg 9/eco812o0X6fa1KzMP2fyJsg3ME62GdSJ9GFyNvhBVpHYW5x2ZbeO6Wh5hn0J49nh0J iNuuVhSW4pyuIwMWe2m/LVAJ4qt9psbHl/JhiNyXubLY5cvsVjiC5gN2dqaNKlUx8ec3 K7+hEtNN3yl6YaNWzaLf2w7xoaRxtDqhASerpPAs/lXfVll8/xc4ymnuYqJLciidxkSN SztXfglJIA7OVRsRNK8E4njFSzhfpjorKaAKj5U2vbYNVr1HY4zqoxCkoWWzwZHqHJGi gVcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=98u88U7fkuo5HbNaAbqWqzoS298FvDgsPdHfpqhJggU=; b=fFujsJ0shfUAECxRqCPV03OFrQTrWwEIhEKk2hrRw4ZrQmdN812XLveLwX2cOlntDu R3EVIcmAz6v9GXv5b4AeILLHdKiwCLwSR9T7NpVhelIYbUohdZpNrX2m/BQylzRSIPWK OVxbDXx95lRsov2oDIJgyXip2yNmoWRf+i6s4cAipJApiH9WWmBfYCDvqbd55to9Rc6O Bv0SuKLjPr3tL3lxvWTUFBUcsiE1ITED90HyTYF9uRCur23O+Ef/FUBQps16H/Wo3E12 qzgJnr6Csi7Y6j+fvXo9Sbn5KoIuDWSX9zXLWh5wlE7HuCuRZUcMXuHFzl1AVeWxxlTo hwoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tooRbEfl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e22si660628vsl.285.2021.04.28.12.38.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tooRbEfl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbq0l-00015F-3m for patch@linaro.org; Wed, 28 Apr 2021 15:38:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpxF-000646-H5 for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:37 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:41773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwx-0004is-SH for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:37 -0400 Received: by mail-pj1-x1036.google.com with SMTP id y22-20020a17090a8b16b0290150ae1a6d2bso9699289pjn.0 for ; Wed, 28 Apr 2021 12:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=98u88U7fkuo5HbNaAbqWqzoS298FvDgsPdHfpqhJggU=; b=tooRbEflV/SnoAwrPkX6H9oQ6XmY7jfXKDQSn4IW1yV2RpREdlNTLMX0PA0khfgKRU roR5wWGKdvaX2VFzKzNNGjTSe6J6m2NdSIJXqvhLFz3ScDjTMJLW+tFyiJmcAm8Rdadl Fq46G0EUwhPGxTupSoKCN8YcETih2CKhfhlRKX8zBb+mQbs2HU2tC0cQYwymwWef5u5d KmlxHHuUL76N0Fyru4Ey5/4/IYzY1nIqLtaGsy+rmEEyL8eol6Fj+L75X3jRh/y5+TME IbN99u9RK20W8LuHgv5HKS2iUttA8wY9pOs5l49x0sjwu0URmZjy+w9z9WxZohLl77DJ EG1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=98u88U7fkuo5HbNaAbqWqzoS298FvDgsPdHfpqhJggU=; b=AW0IYxBLFhSwp+Dvr4smWLX0t8fZqsiTg781PaJyRmYYgF4kTeRK990ENKc4ae0kTv kaABtAoamrHs9hCKRerlwRuB0LR9QgvQU2iIDacscAxsxxFkrHRU885rUefL/pTd1Czg vDCU9caPtTAIPZmhjk3MAR+iDestoXBw0OeO67o1QdZORF/D9wLUiZwTx1Z5xOM0rJgJ kwsqJH7AWIC/62GgSS+RS+/SzYodiuCIhX4K8nlAqN0I6EqDp2ntVYOeeQLP7HjBp2UZ rMCKR8OX/lKGsbZv4aEU1C70RbASnLLREV3IwV00KE3SnVOk6nfIWg/8hvg2ReGKtm4e iMtQ== X-Gm-Message-State: AOAM533/1KiZX82s/Twl+J2bZvP5gWRS7/16o+X6quy8ysOk5VkL3Fg3 JTnlBHiBusukfktQ29d9Nm1vxmRGdrd97A== X-Received: by 2002:a17:90a:ad84:: with SMTP id s4mr5650212pjq.162.1619638458475; Wed, 28 Apr 2021 12:34:18 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 14/15] linux-user/s390x: Clean up signal.c Date: Wed, 28 Apr 2021 12:34:07 -0700 Message-Id: <20210428193408.233706-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reorder the function bodies to correspond to the kernel source. Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 67 ++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 26 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 839a7ae4b3..9d470e4ca0 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -133,6 +133,7 @@ void setup_frame(int sig, struct target_sigaction *ka, { sigframe *frame; abi_ulong frame_addr; + abi_ulong restorer; frame_addr = get_sigframe(ka, env, sizeof(*frame)); trace_user_setup_frame(env, frame_addr); @@ -141,28 +142,39 @@ void setup_frame(int sig, struct target_sigaction *ka, return; } + /* Set up backchain. */ + __put_user(env->regs[15], (abi_ulong *) frame); + + /* Create struct sigcontext on the signal stack. */ /* Make sure that we're initializing all of oldmask. */ QEMU_BUILD_BUG_ON(ARRAY_SIZE(frame->sc.oldmask) != 1); __put_user(set->sig[0], &frame->sc.oldmask[0]); - - save_sigregs(env, &frame->sregs); - __put_user(frame_addr + offsetof(sigframe, sregs), &frame->sc.sregs); - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ + /* Create _sigregs on the signal stack */ + save_sigregs(env, &frame->sregs); + + /* + * ??? The kernel uses regs->gprs[2] here, which is not yet the signo. + * Moreover the comment talks about allowing backtrace, which is really + * done by the r15 copy above. + */ + __put_user(sig, &frame->signo); + + /* + * Set up to return from userspace. + * If provided, use a stub already in userspace. + */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer; + restorer = ka->sa_restorer; } else { - env->regs[14] = frame_addr + offsetof(sigframe, retcode); + restorer = frame_addr + offsetof(sigframe, retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &frame->retcode); } - /* Set up backchain. */ - __put_user(env->regs[15], (abi_ulong *) frame); - /* Set up registers for signal handler */ + env->regs[14] = restorer; env->regs[15] = frame_addr; /* Force default amode and default user address space control. */ env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY @@ -180,8 +192,6 @@ void setup_frame(int sig, struct target_sigaction *ka, env->regs[5] = 0; /* FIXME: regs->int_parm_long */ env->regs[6] = 0; /* FIXME: current->thread.last_break */ - /* Place signal number on stack to allow backtrace from handler. */ - __put_user(env->regs[2], &frame->signo); unlock_user_struct(frame, frame_addr, 1); } @@ -191,6 +201,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, { rt_sigframe *frame; abi_ulong frame_addr; + abi_ulong restorer; frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); @@ -199,29 +210,33 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, return; } - tswap_siginfo(&frame->info, info); + /* Set up backchain. */ + __put_user(env->regs[15], (abi_ulong *) frame); - /* Create the ucontext. */ - __put_user(0, &frame->uc.tuc_flags); - __put_user((abi_ulong)0, (abi_ulong *)&frame->uc.tuc_link); - target_save_altstack(&frame->uc.tuc_stack, env); - save_sigregs(env, &frame->uc.tuc_mcontext); - tswap_sigset(&frame->uc.tuc_sigmask, set); - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ + /* + * Set up to return from userspace. + * If provided, use a stub already in userspace. + */ if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[14] = ka->sa_restorer; + restorer = ka->sa_restorer; } else { - env->regs[14] = frame_addr + offsetof(typeof(*frame), retcode); + restorer = frame_addr + offsetof(typeof(*frame), retcode); __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &frame->retcode); } - /* Set up backchain. */ - __put_user(env->regs[15], (abi_ulong *) frame); + /* Create siginfo on the signal stack. */ + tswap_siginfo(&frame->info, info); + + /* Create ucontext on the signal stack. */ + __put_user(0, &frame->uc.tuc_flags); + __put_user(0, &frame->uc.tuc_link); + target_save_altstack(&frame->uc.tuc_stack, env); + save_sigregs(env, &frame->uc.tuc_mcontext); + tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up registers for signal handler */ + env->regs[14] = restorer; env->regs[15] = frame_addr; /* Force default amode and default user address space control. */ env->psw.mask = PSW_MASK_64 | PSW_MASK_32 | PSW_ASC_PRIMARY From patchwork Wed Apr 28 19:34:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428622 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp936543jao; Wed, 28 Apr 2021 12:55:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAJWZatymN4sAaCkc9t0NakPm9dQaebpprswlNjxgD9qDUNcJAjYaIQyDLjqEHio79aR88 X-Received: by 2002:a92:da8a:: with SMTP id u10mr24841639iln.100.1619639719662; Wed, 28 Apr 2021 12:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639719; cv=none; d=google.com; s=arc-20160816; b=kFmj7HENVAQ0qMmWZqUPcSJQ9Q5/ta/Ot2jLueMBt3JMq0kjVQw6yl0nMB3wP7lKWm 6RDfECygTysn8SynBFuWvMY/iBzgNDjf3wy9T9KjVW3CoGZA8rZdeZwBOEZb0oeD8/UI P4rlJPVUHXsdspx1cH6HqeE6QmQu4hWL5elTxPo0CagC+r2Se7kZs0rtN4jzTSkOip6r oTqONaDYOq2+8MJxCyQMr77B4Sb9Jb5jFmdqy+wO4q9H9YWy6Em5OX7d+CtstzoP750P m18pp6f3hSXkZRcSk2jvBa7GqZbkM/tLr1sCxOUeCNDmW5ZtAJ33Q5pcmd23aiznyv49 XuxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ld1aOOPFCTaDlIM4pseMTjUT2N/AiXsA3fl7Bo9Xfu4=; b=EL+CK8ZKJVXaMOlihucCJEGB8CT9jTEw/ZElHi549HTR6FyJjOsfSUHyPDKPXX2KhI 0cYF8tOPvh4rx9vz4fhTo4QsVzmqVQVDmaZRSE0t6y4cdiG+b7OkJDNSsN/YldgnvsQ8 WcKvNWQsfEf6pRVsqxlUR/7x0qV7WxAWVWXtz6LDInwoPqvi6xrf6HoTxDJv3mXYaqOB fHpT282hr6uG/RMdyZMEKxBZ2+XGt0WbNeUksHa9bVNguIqojTUke1idf0oEKiROI2CS etvUrfUk54DyAFh/4kMZ9BVtmg/tmuIp7NipKZTWLbpCFiilSgzAwH3/Bl3n0RQ0OlKW Jy0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PC4rOSN5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d8si1003428ioy.104.2021.04.28.12.55.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PC4rOSN5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqHH-0001Ja-3e for patch@linaro.org; Wed, 28 Apr 2021 15:55:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpxG-00065a-MN for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:38 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:41761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwy-0004j3-Bn for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:38 -0400 Received: by mail-pj1-x1029.google.com with SMTP id y22-20020a17090a8b16b0290150ae1a6d2bso9699299pjn.0 for ; Wed, 28 Apr 2021 12:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ld1aOOPFCTaDlIM4pseMTjUT2N/AiXsA3fl7Bo9Xfu4=; b=PC4rOSN52eqF1IWhTmwsVrG2RyppGJdWOOkCljx/JFXuiJjNaJe8gyJ0n42aLYRYsR 7l9FU1dQaMgj9bbqqBD+oZQUCQ0mIiSqXsIPO9K0GySJe1ZCBrtmPRUNtVk4izBG7m+A QSVSpmN6lGbnmv2nCl+bmil/dR/dY0Q0Q9MKogeXFFrOkJKOgFEaGmjpaFqJ5Q8CrML/ HoA2iuOgK7vfnjyjJivXGu4wWTqo2GfT9YG8SysSLyerkCiLvOwakUNcnKUMcuE0ySUe swsoaZ51jbVgr0aZJ2kcRVocsnpJHIHFbnzfrV9vdO3sRkVd5Xc3FQ63dsD4VO+7Y5ra EWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ld1aOOPFCTaDlIM4pseMTjUT2N/AiXsA3fl7Bo9Xfu4=; b=gpKQPRUUdDjHoF9j/IcsLbj4cLRt9QtlLNwxD9DUD9lb0PLylQO7HbKWkI9EU7IjXt sa1KRGOTa6vIBVesGq/7MM1Z8wjXLM8JrArTr+cFom3oKyvMp8SJ3MiC3tlGVLwCCyg7 7Q4NGxdxcVp1P31g4y3oy/kUs46T3aCHJ1XYjlWmK7Wr2dcyQCV3DlfF/voDSWtmlAM9 8mrY4Fsrf9r+5Lrp+O6yQZNC0t3E7yzPgILsZoTLBuhIFaUumwSNmc2+t673T1ODu/ub X1cSXybRQUf/nR57bwO7SF23zNG+vWhmiE51QoO+BB9P4YBbOzSIcGWis/tLDIiVBjIl FSOQ== X-Gm-Message-State: AOAM53109891gUFMFHibWVwIJCMYTUpS0HAhkxg05gaw/Ms6ygZcu8ZU mMKygnk37S8tLwzOXttl0PVUvOTecbt24w== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr34071344pjq.58.1619638459021; Wed, 28 Apr 2021 12:34:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 15/15] linux-user/s390x: Handle vector regs in signal stack Date: Wed, 28 Apr 2021 12:34:08 -0700 Message-Id: <20210428193408.233706-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 62 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 9d470e4ca0..b537646e60 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -50,6 +50,12 @@ typedef struct { target_s390_fp_regs fpregs; } target_sigregs; +typedef struct { + uint64_t vxrs_low[16]; + uint64_t vxrs_high[16][2]; + uint8_t reserved[128]; +} target_sigregs_ext; + typedef struct { abi_ulong oldmask[_SIGCONTEXT_NSIG_WORDS]; abi_ulong sregs; @@ -60,15 +66,20 @@ typedef struct { target_sigcontext sc; target_sigregs sregs; int signo; + target_sigregs_ext sregs_ext; uint16_t retcode; } sigframe; +#define TARGET_UC_VXRS 2 + struct target_ucontext { abi_ulong tuc_flags; abi_ulong tuc_link; target_stack_t tuc_stack; target_sigregs tuc_mcontext; - target_sigset_t tuc_sigmask; /* mask last for extensibility */ + target_sigset_t tuc_sigmask; + uint8_t reserved[128 - sizeof(target_sigset_t)]; + target_sigregs_ext tuc_mcontext_ext; }; typedef struct { @@ -128,6 +139,24 @@ static void save_sigregs(CPUS390XState *env, target_sigregs *sregs) } } +static void save_sigregs_ext(CPUS390XState *env, target_sigregs_ext *ext) +{ + int i; + + /* + * if (MACHINE_HAS_VX) ... + * That said, we always allocate the stack storage and the + * space is always available in env. + */ + for (i = 0; i < 16; ++i) { + __put_user(env->vregs[i][1], &ext->vxrs_low[i]); + } + for (i = 0; i < 16; ++i) { + __put_user(env->vregs[i + 16][0], &ext->vxrs_high[i][0]); + __put_user(env->vregs[i + 16][1], &ext->vxrs_high[i][1]); + } +} + void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUS390XState *env) { @@ -161,6 +190,9 @@ void setup_frame(int sig, struct target_sigaction *ka, */ __put_user(sig, &frame->signo); + /* Create sigregs_ext on the signal stack. */ + save_sigregs_ext(env, &frame->sregs_ext); + /* * Set up to return from userspace. * If provided, use a stub already in userspace. @@ -202,6 +234,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, rt_sigframe *frame; abi_ulong frame_addr; abi_ulong restorer; + abi_ulong uc_flags; frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); @@ -229,10 +262,15 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, tswap_siginfo(&frame->info, info); /* Create ucontext on the signal stack. */ - __put_user(0, &frame->uc.tuc_flags); + uc_flags = 0; + if (s390_has_feat(S390_FEAT_VECTOR)) { + uc_flags |= TARGET_UC_VXRS; + } + __put_user(uc_flags, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); target_save_altstack(&frame->uc.tuc_stack, env); save_sigregs(env, &frame->uc.tuc_mcontext); + save_sigregs_ext(env, &frame->uc.tuc_mcontext_ext); tswap_sigset(&frame->uc.tuc_sigmask, set); /* Set up registers for signal handler */ @@ -271,6 +309,24 @@ static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) } } +static void restore_sigregs_ext(CPUS390XState *env, target_sigregs_ext *ext) +{ + int i; + + /* + * if (MACHINE_HAS_VX) ... + * That said, we always allocate the stack storage and the + * space is always available in env. + */ + for (i = 0; i < 16; ++i) { + __get_user(env->vregs[i][1], &ext->vxrs_low[i]); + } + for (i = 0; i < 16; ++i) { + __get_user(env->vregs[i + 16][0], &ext->vxrs_high[i][0]); + __get_user(env->vregs[i + 16][1], &ext->vxrs_high[i][1]); + } +} + long do_sigreturn(CPUS390XState *env) { sigframe *frame; @@ -292,6 +348,7 @@ long do_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ restore_sigregs(env, &frame->sregs); + restore_sigregs_ext(env, &frame->sregs_ext); unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; @@ -313,6 +370,7 @@ long do_rt_sigreturn(CPUS390XState *env) set_sigmask(&set); /* ~_BLOCKABLE? */ restore_sigregs(env, &frame->uc.tuc_mcontext); + restore_sigregs_ext(env, &frame->uc.tuc_mcontext_ext); target_restore_altstack(&frame->uc.tuc_stack, env);