From patchwork Tue Mar 15 08:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 551431 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp3291471mag; Tue, 15 Mar 2022 02:28:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/0Eq6w4+bF/KNkuKbUZVAMr2e93BlPWTiAtIDy8cpSTdjBQa8V2h3N50L9QjmM0DNPuCG X-Received: by 2002:a05:622a:1807:b0:2e1:c220:887b with SMTP id t7-20020a05622a180700b002e1c220887bmr14336520qtc.620.1647336486635; Tue, 15 Mar 2022 02:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647336486; cv=none; d=google.com; s=arc-20160816; b=piJuUgIFZ/i3ZtmmE6Hf+aCW5of5XL8UPZMVvDt4x53uoZV7ZAHuSWL3kUqWzHsZJu 7WMX9ggGHNnlPdQi7Q3FSq8jnPuAd3bvyXzjtMtDg5Hg6hLC3AM5dekRs3u67fOXwTF5 sIF8i69ep2PyH78mCvYI+eV10WlrM/1coUQaH3LrjPxYfrjOFSzyfxAv+dG+nVYGH21w 6ZnZ4DT25fI+5k1d/Z6IM2yEoM+/iqRarx/DuA+Oxv8/564b8A61x8J3tOL40+G7pEPw ctqJAB9W+k04LWprQYW3599EBAADNddLMfswidWU5QQ9FX7UfFx6j3FSEMm8BVvOU8dr m2nA== 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=DEJtNZJacym7P3D55T00OdkxyEJk/tkTx1LWRg3rxNs=; b=l7MaEeRn1Ge2fBwIvHfGqnZSfAaEGuQACW2KYTCg+a/JxRxoblKchaSNVgJ0ad2VBP RvNgjYuGj1c4oD12QQPFsSQFyXj2Urz2jer3SdW/p0Wuoft07vkby0tCor81WFknfFEQ f+5oJK2nRt08w1BPK6prWovhz81YbuI0cfBib2kP9pKBqeLc4Ov+b1XiW5i+/OCbkAcT +xx0EyP1AJh4Yt3PCeJKstDtUq+SfSyFzBxkQiVlrNOcu0H6FTZ1514okdeSWv+YHlSO ooPB8ostBC9ltpNwThMuJ+4xA/MpFai4bick3cGbqtTS5QpJlVFPBZ/oCgz613Xok3KA d97g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uI9ItgBW; 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=pass (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 p11-20020a05620a112b00b0067b325e72d2si7071869qkk.460.2022.03.15.02.28.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Mar 2022 02:28: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=pass header.i=@linaro.org header.s=google header.b=uI9ItgBW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU3TK-0005k5-7s for patch@linaro.org; Tue, 15 Mar 2022 05:28:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU2lx-0008Sw-0y for qemu-devel@nongnu.org; Tue, 15 Mar 2022 04:43:19 -0400 Received: from [2607:f8b0:4864:20::102c] (port=56227 helo=mail-pj1-x102c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nU2lu-000545-1l for qemu-devel@nongnu.org; Tue, 15 Mar 2022 04:43:15 -0400 Received: by mail-pj1-x102c.google.com with SMTP id e3so17031698pjm.5 for ; Tue, 15 Mar 2022 01:43: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=DEJtNZJacym7P3D55T00OdkxyEJk/tkTx1LWRg3rxNs=; b=uI9ItgBWvpWSsUBoL2AvQnXiyn1z3DmL+NHB+QW5SVNdAoA9LyITt8p28bvbiHr0s3 QefmGlCK+HfFvxL9YAIFFnQUIlRlOVzOXuHcKM2wqEgpDKK4RO+o1JYKNbnbclQqNzju 07bu7Uh2QfBrdGAFABtP69KXD5l7Ny79J6n5YAiA+Zov9AXRpezHxIwMB4GdSYuP5I3S nMV6+jrsLHS3toxT+2UhL0PuIInco/wgaRI3BdMKFEdwUaKEjhkG3KcCnm6TD3NxhDm7 rcyLLyt0WFbbkmKZPMZEvvMcmIfln3Z2caDltnzvZxAckZ2ksExlZtYPCHZGH7Nrjcmi G5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DEJtNZJacym7P3D55T00OdkxyEJk/tkTx1LWRg3rxNs=; b=XLgB2q4dtmxyYD7AIHpdSZIlk39ToWvm7goADls8ZEflWguj26jPh4C+LuC0h8o2og EbEDbpOXuvlXXzoMB33J3zE8lZc42Vbnu3PuxhgReZ68kLDmV5KMQT4rD+VPyORewqNL ZDLpco1NvM1loOafmUUPmdmAnKi55owBUitEX925yAkuWRVnP2h5hgCaZ659xr7Rc2YM wnKx4xLVH+zvnx6Su6O4CyUreoQaUeuPutlFOBB/vVg2dpYeAbGImf5Abky+AHsSN4+3 dbbTwHV37mAerDagaphDLHVmJ3dWfNSm4EALog6ghFziiAi9W+7PbpbMydSRXXhoHORl 3gXA== X-Gm-Message-State: AOAM531JXcetTNhXo0oslFQhtwKHclprGHsN383N1uEtoSjL3494RCQv CQUVF5Hpom38dE9yyiWSVMqxkzBrrCNYoA== X-Received: by 2002:a17:902:cec2:b0:151:b337:a699 with SMTP id d2-20020a170902cec200b00151b337a699mr27885786plg.59.1647333792820; Tue, 15 Mar 2022 01:43:12 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id ob13-20020a17090b390d00b001becfd7c6f3sm2233762pjb.27.2022.03.15.01.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 01:43:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/5] linux-user: Properly handle sigset arg to epoll_pwait Date: Tue, 15 Mar 2022 01:43:07 -0700 Message-Id: <20220315084308.433109-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220315084308.433109-1-richard.henderson@linaro.org> References: <20220315084308.433109-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102c (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Unblocked signals are never delivered, because we didn't record the new mask for process_pending_signals. Handle this with the same mechanism as sigsuspend. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8071a5191d..85de4e1bc7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12694,29 +12694,21 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #if defined(TARGET_NR_epoll_pwait) case TARGET_NR_epoll_pwait: { - target_sigset_t *target_set; - sigset_t _set, *set = &_set; + sigset_t *set = NULL; if (arg5) { - if (arg6 != sizeof(target_sigset_t)) { - ret = -TARGET_EINVAL; + ret = process_sigsuspend_mask(&set, arg5, arg6); + if (ret != 0) { break; } - - target_set = lock_user(VERIFY_READ, arg5, - sizeof(target_sigset_t), 1); - if (!target_set) { - ret = -TARGET_EFAULT; - break; - } - target_to_host_sigset(set, target_set); - unlock_user(target_set, arg5, 0); - } else { - set = NULL; } ret = get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeout, set, SIGSET_T_SIZE)); + + if (set) { + finish_sigsuspend_mask(ret); + } break; } #endif