From nobody Mon Feb 9 15:48:01 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=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1646402462; cv=none; d=zohomail.com; s=zohoarc; b=eQxrtJFMYwtMc2l3qBgZ/fp6Tslu+ekzaBUsbF0+KjoJ2UZpcF43u2NiocM4zeES3OreKOu6xfCWb3Awdez7zlGhJ0u2rFqu7YFmCQMaXuh2GCOioiAXfp3y/AMHULhmXLSsD6UxpAbQNuSbcycSrdwzFMDILDaof3Q3rb0l6XI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646402462; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=E9U8f+CE/a5/AN3TPLs6/9FG2x5Jkw+GdC7Z0ig5vNY=; b=gQP8DnDa2/+A1Dp7IIu5T99Qcn0U+t3XwQiRwJXSRu7wPGiumGhEnMQmUhyQlVNwlK5lRs3bSzzjg1PD8G46kCsvqe1ZgzxcRFhZctJMZOAY2kdLBBlFkHm5ZzgXZp+IFYRhVl+ykBZ6xOeUuBxosgO/2zZOSzOFvCnL32imH8Y= 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 1646402462194578.2198066317333; Fri, 4 Mar 2022 06:01:02 -0800 (PST) Received: from localhost ([::1]:45270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQ8UO-0001Dx-PA for importer@patchew.org; Fri, 04 Mar 2022 09:01:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6053caf8bf8aa5544b14ec55d9b1518187b909df@lizzy.crudebyte.com>) id 1nQ7yQ-0003Zo-VT for qemu-devel@nongnu.org; Fri, 04 Mar 2022 08:27:59 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:40475) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6053caf8bf8aa5544b14ec55d9b1518187b909df@lizzy.crudebyte.com>) id 1nQ7yP-0006zR-JS for qemu-devel@nongnu.org; Fri, 04 Mar 2022 08:27:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=E9U8f+CE/a5/AN3TPLs6/9FG2x5Jkw+GdC7Z0ig5vNY=; b=FmVFB /TCTXWlq9nIv5skFibbI+WDUqp6hoCjfzzfIzYBBH2UF4PhAiv/ilbbqXgbl6sf7XjwTOHKMd2pZr TILl6zlwsZawV+9lHkcavZS0owDqlTlaUlFnQhpoRt9tpAzq/mFcX7wiOT0lVv1YNTrAp272i8cug cxNU64AMANbYuNhlVDIoIabpZQA2vLgC8dXzQZH5Bu0pLxa/jsVjbGhUrpy++tqoSJu+OLX3Mh+66 J+lMaPehjpbdjhwcEtLoX1+OnG1JrmVGXbskTuIMo7S3GuAcVc+gurTohYXtr13wTs3E66PNktCNW rVmiPo9CZ27pPdMEsA++vbefr63xw==; Message-Id: <6053caf8bf8aa5544b14ec55d9b1518187b909df.1646396869.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 04 Mar 2022 13:27:49 +0100 Subject: [PULL 06/19] 9p: darwin: Move XATTR_SIZE_MAX->P9_XATTR_SIZE_MAX To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz 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: none client-ip=91.194.90.13; envelope-from=6053caf8bf8aa5544b14ec55d9b1518187b909df@lizzy.crudebyte.com; helo=lizzy.crudebyte.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, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1646402463627100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Keno Fischer Signed-off-by: Keno Fischer Signed-off-by: Michael Roitzsch Because XATTR_SIZE_MAX is not defined on Darwin, create a cross-platform P9_XATTR_SIZE_MAX instead. [Will Cohen: - Adjust coding style - Lower XATTR_SIZE_MAX to 64k - Add explanatory context related to XATTR_SIZE_MAX] [Fabian Franz: - Move XATTR_SIZE_MAX reference from 9p.c to P9_XATTR_SIZE_MAX in 9p.h] Signed-off-by: Will Cohen Signed-off-by: Fabian Franz [Will Cohen: - For P9_XATTR_MAX, ensure that Linux uses XATTR_SIZE_MAX, Darwin uses 64k, and error out for undefined hosts] Signed-off-by: Will Cohen Message-Id: <20220227223522.91937-7-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck Reviewed-by: Christian Schoenebeck --- hw/9pfs/9p.c | 2 +- hw/9pfs/9p.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 14e84c3bcf..7405352c37 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3949,7 +3949,7 @@ static void coroutine_fn v9fs_xattrcreate(void *opaqu= e) rflags |=3D XATTR_REPLACE; } =20 - if (size > XATTR_SIZE_MAX) { + if (size > P9_XATTR_SIZE_MAX) { err =3D -E2BIG; goto out_nofid; } diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 1567b67841..94b273b3d0 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -479,4 +479,22 @@ struct V9fsTransport { void (*push_and_notify)(V9fsPDU *pdu); }; =20 +#if defined(XATTR_SIZE_MAX) +/* Linux */ +#define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX +#elif defined(CONFIG_DARWIN) +/* + * Darwin doesn't seem to define a maximum xattr size in its user + * space header, so manually configure it across platforms as 64k. + * + * Having no limit at all can lead to QEMU crashing during large g_malloc() + * calls. Because QEMU does not currently support macOS guests, the below + * preliminary solution only works due to its being a reflection of the li= mit of + * Linux guests. + */ +#define P9_XATTR_SIZE_MAX 65536 +#else +#error Missing definition for P9_XATTR_SIZE_MAX for this host system +#endif + #endif --=20 2.20.1