From nobody Mon Apr 6 23:37:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1773752099; cv=none; d=zohomail.com; s=zohoarc; b=f9vpe5tIW0p+WBfHh2xpoXKUmMOtMUSB8x+hL+oDsQsThfebZHzpOg9eMNN8eVNwwrErjqfq1o9gq+t2qi6sLzic0rwHd9dYlVU3GeD7aJ17l97hF2mU8uEweU0qKBcN62r1K0rwEi8+mFzSUzmrh2PTAE1pEmlh7qZ9H036Euw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773752099; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=Jlw99RW3UkKLTOcSlqjoeKWjOUU+02rQzShsT87VfYY=; b=kE00iLf/reJuEJ7WmTkqWH5V1yQ4FvKr7Mko617Hyzr/U7WgrJ127z7Mo5r2d7wuO6uJ045K2bvQJgWfAV46yVVCKrqlrkol2wDhGeKFBTvmxFVPRhZpIxkdOQmjewIDna7ahbqeKji16gMT5+4Hj+XsneBzDo6Gd3G86Z0P4jg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773752099372940.1011424244887; Tue, 17 Mar 2026 05:54:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2TwT-0008UW-Hq; Tue, 17 Mar 2026 08:54:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2R6L-0003jw-7c for qemu-devel@nongnu.org; Tue, 17 Mar 2026 05:52:37 -0400 Received: from relay2.mymailcheap.com ([217.182.113.132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2R6J-0006cV-MH for qemu-devel@nongnu.org; Tue, 17 Mar 2026 05:52:36 -0400 Received: from nf2.mymailcheap.com (nf2.mymailcheap.com [54.39.180.165]) by relay2.mymailcheap.com (Postfix) with ESMTPS id 2E47B3E884; Tue, 17 Mar 2026 09:52:33 +0000 (UTC) Received: from mail20.mymailcheap.com (mail20.mymailcheap.com [51.83.111.147]) by nf2.mymailcheap.com (Postfix) with ESMTPSA id 42E2740080; Tue, 17 Mar 2026 09:52:32 +0000 (UTC) Received: from ArchLinux-desktop (unknown [123.138.183.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail20.mymailcheap.com (Postfix) with ESMTPSA id 09CEC43A8C; Tue, 17 Mar 2026 09:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aosc.io; s=default; t=1773741151; bh=5ySXRkNp8Z3wphpAxxFLP7gGarXi3nfa6zCfq3DzOaE=; h=From:To:Cc:Subject:Date:From; b=r4Te3lfzrGG3YlU8RTZnGfxP0BpdibJSGmWiKbVMBPtRflz2jBV79DT3SQ0Fo1hjY 9DNeTK7W9wKWjVKGvUvyupy/wpYZ2iBoBSO4HVfkS3ysCT/QQzihP4B77USTjNGiP8 /ERcheJB95/t+Y9A0zG1bHFSrNg4mSfhuc/mYC6s= To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, pierrick.bouvier@linaro.org, peter.maydell@linaro.org, Sun Haoyu Subject: [PATCH] linux-user: update ppoll/pselect6 timeout on EINTR Date: Tue, 17 Mar 2026 17:52:16 +0800 Message-ID: <20260317095216.25877-1-shyliuli@aosc.io> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: nf2.mymailcheap.com X-Rspamd-Queue-Id: 42E2740080 X-Spamd-Result: default: False [1.20 / 10.00]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.10)[aosc.io:s=default]; R_SPF_ALLOW(-0.10)[+mx]; MIME_GOOD(-0.10)[text/plain]; LOCAL_OUTBOUND(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; DMARC_POLICY_ALLOW(0.00)[aosc.io,quarantine]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[aosc.io:+]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Action: no action Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=217.182.113.132; envelope-from=shyliuli@aosc.io; helo=relay2.mymailcheap.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 17 Mar 2026 08:54:34 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Sun Haoyu From: Sun Haoyu via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1773752101987158500 Content-Type: text/plain; charset="utf-8" Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3343 Linux kernel writes back the remaining timeout when raw ppoll/pselect6 syscalls are interrupted by signals (-EINTR). However, QEMU keeps the original timeout and loses the remaining time. Both do_ppoll() and do_pselect6() now write back the timeout on -EINTR to match the kernel. Tested with the issue reproducer. Signed-off-by: Sun Haoyu --- linux-user/syscall.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 064bc604c9..f049223772 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1529,16 +1529,18 @@ static abi_long do_pselect6(abi_long arg1, abi_long= arg2, abi_long arg3, if (efd_addr && copy_to_user_fdset(efd_addr, &efds, n)) { return -TARGET_EFAULT; } + } + if (((ret =3D=3D -TARGET_EINTR) || !is_error(ret)) && ts_addr) { if (time64) { - if (ts_addr && host_to_target_timespec64(ts_addr, &ts)) { + if (host_to_target_timespec64(ts_addr, &ts)) { return -TARGET_EFAULT; } } else { - if (ts_addr && host_to_target_timespec(ts_addr, &ts)) { + if (host_to_target_timespec(ts_addr, &ts)) { return -TARGET_EFAULT; } } - } + } return ret; } #endif @@ -1606,7 +1608,7 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2= , abi_long arg3, if (set) { finish_sigsuspend_mask(ret); } - if (!is_error(ret) && arg3) { + if ((ret =3D=3D -TARGET_EINTR || !is_error(ret)) && arg3) { if (time64) { if (host_to_target_timespec64(arg3, timeout_ts)) { return -TARGET_EFAULT; --=20 2.53.0