From patchwork Thu Mar 24 08:20:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 553900 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp4187341mag; Thu, 24 Mar 2022 01:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWZYy+uEes52l6RWg4HOIQetMti/+VUduSYcdwVamDkVW1ZEHGJ9rKRFBfr0aE2OTAQ2j8 X-Received: by 2002:a05:622a:1305:b0:2e1:e697:31e7 with SMTP id v5-20020a05622a130500b002e1e69731e7mr3454672qtk.97.1648110441988; Thu, 24 Mar 2022 01:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648110441; cv=none; d=google.com; s=arc-20160816; b=f+3BVJNVQN4TYla5oqlZh8N0Kyaj77cFI8cpWEynJKPv6k/qkb3oNLTD3EkwOn473k RkKuZQgcH3LXgAaMq2840r4NJo1RM0mmTbN2fcPrnQqFo6bGOuc0mhFP72cq4bjaXNoP EYTCMKMgznVa5A4sX0UM6UJEv1h3MJ0ezv1ANvf7F97nWNrMUzMrV1yByIUS2R6NMOi8 UteqUqfgvnbHyognhy9nqTdLTMQajVRfdoZXEHsXDhihxLmh/KGzR+8cDqKrBW6PGyOc K3Bb3dqRey17G345k9mMxm8dA0NfAkD0S/+gM6VEkyvDeEeHO7yr/szTBstymgOoE78a D6Lw== 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; bh=2SA4mxlLKGwCthdQAz/eA1rhYocJhomRJT6mF9J+sNY=; b=tdOjmxdEK2kYqzxqTaZ6aU43bXBi6fpRPdf4n1zIA1QeJrXD8h2SUBcOQtFnEiaP3d t+1hYjNWXcT8yJYppzhs7y23UX/RJ/+vweOaAT6qQgMI7uLwnrhvRjUXzCNVV/+tCo27 Ayr0bqUJGKnSbL8Oq+SOWCV4p338E9IX5u8CwdAk2qhrXtnWzMW1UGFW8Vn+5oIMDihj uW9/hckpWmT7CowdR6fcem51NBev1SIPrDUAHx7JARQvtaKqHaqZ6U7kFkVlhDaDhjAk k/rOSS4xGVjqg5ZumdJdLPlIf7qFpc19sdd9u8iVhZngNr55a5Cv+JHUz2pIuvhoyzFR GpwA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o15-20020a05620a2a0f00b0067e67999d4bsi6107999qkp.653.2022.03.24.01.27.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Mar 2022 01:27:21 -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; 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" Received: from localhost ([::1]:37098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXIoT-0003Q7-KL for patch@linaro.org; Thu, 24 Mar 2022 04:27:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXIhm-0005wo-UL for qemu-devel@nongnu.org; Thu, 24 Mar 2022 04:20:27 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:42009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXIhk-0003Ov-D5 for qemu-devel@nongnu.org; Thu, 24 Mar 2022 04:20:26 -0400 Received: from quad ([82.142.12.150]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MTi9N-1nd6WR0H8v-00U5V1; Thu, 24 Mar 2022 09:20:22 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 05/10] linux-user: Properly handle sigset arg to epoll_pwait Date: Thu, 24 Mar 2022 09:20:11 +0100 Message-Id: <20220324082016.3463521-6-laurent@vivier.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220324082016.3463521-1-laurent@vivier.eu> References: <20220324082016.3463521-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:v2D7+tvf13oh60xk8WP5a54Aq2Ag0XesnjnpCQnlE84OKqPPW2P Z9oOu5HCdhO33syVBaDqaiLIEPt6tvxefn75XXxfp2uvQm5DjYb7UBwJt4o4H6Qi7hnzGHh RUJlpHP1zhH/YUF5zV3mv+turQpE4kHov+wjQbFQoXKjRCjHoIftsgb8nDLYaqxoSgqeVNc ryBGzUWWilo2FfMbFoPxA== X-UI-Out-Filterresults: notjunk:1;V03:K0:2mnjocTbFFw=:JdZptCg3aeanSe9c6vNYX8 oj2PXYKQ997yF4dVBzFauOnSxL4enzx1zjIQM/vNq8y7uVO+Fl1CllTaXJdMf62yZdD8Dx44S Uzzklkd/9m5l6fnZVhYbv/i3KAz7VV1xJIzrGNGfDd4P6tvkU8ofHq3zhV9/APM2dDPayUfr2 bLVmwEJ+Sf8EbGZVXDFHq1Ucil3gXcvGFN01vE82y+PjonK5xgj4hUog5mtuLDuKddg+Dsgl8 QReoVM4ECc5N2HHZpVQt7z/CEGY3KFESXDGx3LNXBY6h5fpZ8Vr9hoNkFXoloM1PDtFHxTYr4 cDQihkO6hyJgYF5ip099OQJ6h1anwgdPKlhiu4JoTImwFHrrdyMeidauU4WFevaKij4FePk5L kaEePSXhoKTQqpZZWrAwRlxzqpJG4WKwSk5c1aqd5q98u5HqDD7pqg//VsB88TAuYi+F2ADyE iS1WaYZoZAVO6KQTbvpHy3h/S5e0ZY/qvlTf7AgH5PUReja0c/kPpMGvjEX3spNaB8gPKOVY0 nzzpqr7IrwyvMbEDY6PPScFhA3R0/9ZIPUdfpKd+RJV9WcPaYpsh9pIvLGaJPEToBXsPKiIVf wR31wfqm9pp9LesExumhCzapIlzm+b14+K4B8LGd1Ah8KN0bVn7fcp9i7Y8r50vG7taMF26fS yVptMAjTomlvnrQI6QG1E73Urei+/hv2E8LTxlA9TgIjwIJ3ntlF2dIrf8bWbIJDi134= Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-Id: <20220315084308.433109-5-richard.henderson@linaro.org> Signed-off-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 ffd4cefc8b7a..67af40deac07 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; - break; - } - - target_set = lock_user(VERIFY_READ, arg5, - sizeof(target_sigset_t), 1); - if (!target_set) { - ret = -TARGET_EFAULT; + ret = process_sigsuspend_mask(&set, arg5, arg6); + if (ret != 0) { 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