From nobody Sat Apr 11 23:02:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1772991118; cv=none; d=zohomail.com; s=zohoarc; b=j/RxSryDm4tWHY1XWKd4bN2yrUg8303nZFBqXeV0K4kMMhh+MJSs9AuBDUTSoXrTNtX6F/jkZ2oVVySYP3HeQ4pHWWKB87Ea+GQDC9yyYTtmjltTFz9IP0lqNCJ/Sm5zo21wqftqZSwsbNMaLpZMJ3+x9LkOhl3o6G3ZKKXKMY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772991118; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OiWqY4jx9zgepgcKQ3oVVPBV7ndNOo28jF8CZifChgM=; b=bGHl12GgDwjMZ73APlfB9wrNohnl2y4WGQO0J+M0EgAJSvBPye7iuTHR6J9WO15SuIbIqMg2zSztuGeG0rzD6F3jPaXu1SaUZlQV3T7K4w26NpxLQ6ds34LhzL3owGpVg6A09h9VN/iQFXuomasXgIjYjG1j4rlVbg9mDmvuuM4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772991118390105.12902425624827; Sun, 8 Mar 2026 10:31:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzHxA-0003m1-UV; Sun, 08 Mar 2026 13:30:14 -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 1vzHwy-0003fo-Iv for qemu-devel@nongnu.org; Sun, 08 Mar 2026 13:29:59 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzHwu-0003nt-Be for qemu-devel@nongnu.org; Sun, 08 Mar 2026 13:29:53 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id C7D7B4393D; Sun, 8 Mar 2026 17:29:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735DDC116C6; Sun, 8 Mar 2026 17:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772990990; bh=Q/dSbHczdz4sFIvaB36AMEBCEZDprQsZ7Vlhqrv2Nk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsqpkA9cXFOWjC4PcmumM1GIYw8lPrZJ9DBewAyQqhmtlLazLRRzP3RZMcnymYr6C pNbPo3mTliUT+ku6io7h5u6WHnBp7G0cSC3Vdx0DuE4hwTWE8WMo7GRXYCXPPMHpdU +EbmYDTPqwlAHA+KLnrwy0g3uxS3CBmOTr8aQO/UjYyLxlCejww9eSZrw0wIZy4rBG ni27FUheeALEwgNSP3StQinHUDhkMfKqZHWOcBHPa5oH/XxNKbZSkr+gwuEig3gATb 1k3Mvm9FuUAFVOBGo4ldO63qO17cwRzlrNgzLJSIhAkhspv45vnMuq/019dKgt6PPZ DnJrEV7EoY2gA== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Kyle Evans , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Warner Losh , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , deller@gmx.de, Richard Henderson , Pierrick Bouvier Subject: [PULL 04/12] linux-user: properly check flags in openat2 Date: Sun, 8 Mar 2026 18:29:28 +0100 Message-ID: <20260308172936.2835-5-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260308172936.2835-1-deller@kernel.org> References: <20260308172936.2835-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org 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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1772991119588154100 Content-Type: text/plain; charset="utf-8" From: Andreas Schwab target_to_host_bitmask truncates the bitmask to int. Check that the upper half of the flags do not have any bits set. Signed-off-by: Andreas Schwab Reviewed-by: Helge Deller Signed-off-by: Helge Deller --- linux-user/syscall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 99e1ed97d9..064bc604c9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8831,6 +8831,10 @@ static int do_openat2(CPUArchState *cpu_env, abi_lon= g dirfd, } return ret; } + if (tswap64(how.flags) >> 32) { + return -TARGET_EINVAL; + } + pathname =3D lock_user_string(guest_pathname); if (!pathname) { return -TARGET_EFAULT; --=20 2.53.0