From patchwork Tue Nov 21 20:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDE67C61D85 for ; Tue, 21 Nov 2023 20:16:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638180.994509 (Exim 4.92) (envelope-from ) id 1r5XA6-0007CJ-F2; Tue, 21 Nov 2023 20:15:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638180.994509; Tue, 21 Nov 2023 20:15:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA6-0007CC-Bs; Tue, 21 Nov 2023 20:15:58 +0000 Received: by outflank-mailman (input) for mailman id 638180; Tue, 21 Nov 2023 20:15:57 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA5-0007Bx-BF for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:15:57 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c5e7804c-88aa-11ee-9b0e-b553b5be7939; Tue, 21 Nov 2023 21:15:55 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c5e7804c-88aa-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597755; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SMthb4NtkNO2RAGaFUKKyekiWRpIMs0yeackPSSJ3Nc=; b=VfD5t2hsDMSClkAICzWKTQf08hWf3LOSUF/vVy0p7chzOJTqhf3iZ9RO 41yZWjkIkJ9MYsgj6Ns3bQQ9iLcvmjJuxlgkCDJnmsri4j/6VCxnbEY5l y6kZ3h026+VzlvetAG25Gl5430LIgHaIrOTEdOx9vScq7GPMcrxKSKkDV w=; X-CSE-ConnectionGUID: +GZ+UsK9SGatMSUbv7Cxvg== X-CSE-MsgGUID: eEvee9pQQCazgXO2Vt1ohA== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464600 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:IFo2MKN8Rs/+wvfvrR1Dl8FynXyQoLVcMsEvi/4bfWQNrUpw0jxSm mMXXmiPO/beYGX8KthzOo2x/UoOsJ7RndYxTwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CQ6jefQAOOkVIYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGjxSs/7rRC9H5qyo42pB5AVmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0qVYMyJz7 t9JEx8EcjW4uuion5mrVOY506zPLOGzVG8eknRpzD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SyHhneQ6Kf3Fhie0lM/Xlp0sP0f2F mAvQzlw62p98i60xPY12jeq69bl7Lau5Z+Lf3JpMgJDz3mzj+pfYhlW7qP+AopqPyy8j8R4Z XxiiZlEcRvznvbOlivpxjg0RSI6kdm11bSjXGZnF7qqojBXzQ4B8BdwaJVGyGpo3YIjZVT0L 9v12ncjoFQDh/LgWDF78XIPisa3XackD4DlvIWhHoacaZ2Us4rkWRWlHklbavpVkrBmfwaOd grKt3A6/NfdlHfS3jYu21mx7WXNEgOIg== X-Talos-CUID: 9a23:2riqdmjCpUro7ISMMsq7mXSuKjJuMVLvj0rLAB6DJm91bYaoQ0HP07N6nJ87 X-Talos-MUID: 9a23:vLR/9guwDWOE0LzpB82niRx8Oco5+52XI0kfnqUh4feYbCtwEmLI X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464600" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 1/5] x86/setup: Clean up cmdline handling in create_dom0() Date: Tue, 21 Nov 2023 20:15:36 +0000 Message-ID: <20231121201540.1528161-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 There's a confusing mix of variables; a static dom0_cmdline[], and a cmdline pointer which points to image->string before being pointed at the static buffer in order to be passed into construct_dom0(). cmdline being a mutable pointer falls over -Wwrite-strings builds. Delete the cmdline pointer, and rename dom0_cmdline[] to cmdline extending it to have full function scope. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Roberto Bagnara CC: Nicola Vetrini v2: * New. This unravelled a bit, so I pulled it into a separate patch, but the end result is much clearer to follow IMO. --- xen/arch/x86/setup.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c41dfdb2bdf8..c0302c6bdd62 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -873,6 +873,8 @@ static struct domain *__init create_dom0(const module_t *image, module_t *initrd, const char *kextra, const char *loader) { + static char __initdata cmdline[MAX_GUEST_CMDLINE]; + struct xen_domctl_createdomain dom0_cfg = { .flags = IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity : 0, .max_evtchn_port = -1, @@ -885,7 +887,6 @@ static struct domain *__init create_dom0(const module_t *image, }, }; struct domain *d; - char *cmdline; domid_t domid; if ( opt_dom0_pvh ) @@ -913,33 +914,30 @@ static struct domain *__init create_dom0(const module_t *image, panic("Error creating d%uv0\n", domid); /* Grab the DOM0 command line. */ - cmdline = image->string ? __va(image->string) : NULL; - if ( cmdline || kextra ) + if ( image->string || kextra ) { - static char __initdata dom0_cmdline[MAX_GUEST_CMDLINE]; - - cmdline = cmdline_cook(cmdline, loader); - safe_strcpy(dom0_cmdline, cmdline); + if ( image->string ) + safe_strcpy(cmdline, cmdline_cook(__va(image->string), loader)); if ( kextra ) /* kextra always includes exactly one leading space. */ - safe_strcat(dom0_cmdline, kextra); + safe_strcat(cmdline, kextra); /* Append any extra parameters. */ - if ( skip_ioapic_setup && !strstr(dom0_cmdline, "noapic") ) - safe_strcat(dom0_cmdline, " noapic"); + if ( skip_ioapic_setup && !strstr(cmdline, "noapic") ) + safe_strcat(cmdline, " noapic"); + if ( (strlen(acpi_param) == 0) && acpi_disabled ) { printk("ACPI is disabled, notifying Domain 0 (acpi=off)\n"); safe_strcpy(acpi_param, "off"); } - if ( (strlen(acpi_param) != 0) && !strstr(dom0_cmdline, "acpi=") ) + + if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") ) { - safe_strcat(dom0_cmdline, " acpi="); - safe_strcat(dom0_cmdline, acpi_param); + safe_strcat(cmdline, " acpi="); + safe_strcat(cmdline, acpi_param); } - - cmdline = dom0_cmdline; } /* From patchwork Tue Nov 21 20:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21B77C61D85 for ; Tue, 21 Nov 2023 20:16:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638183.994539 (Exim 4.92) (envelope-from ) id 1r5XAA-0007zR-8S; Tue, 21 Nov 2023 20:16:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638183.994539; Tue, 21 Nov 2023 20:16:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XAA-0007zE-4h; Tue, 21 Nov 2023 20:16:02 +0000 Received: by outflank-mailman (input) for mailman id 638183; Tue, 21 Nov 2023 20:16:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA9-0007Bx-0j for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:16:01 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c8d1d8ff-88aa-11ee-9b0e-b553b5be7939; Tue, 21 Nov 2023 21:15:59 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8d1d8ff-88aa-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nNPFHrgxp9pbQ7IeeSDyd3YSSCnHXwpkDDz03xLZZ0Y=; b=eszsf461HSGmtNP+BXu+7/JC0U6e1ftnH+KNlIYDk5NOQfcSjk70uRpf lRb2/NE/OiaQmRkrXWIkYFhdJgBeCn+kbHouusn4Iqes1En2crjemE8nl GF8d+2M1IKXjO6dtPnFJHsbQm9e8v/S/7F9nXSMtMOvWJzlMChgXXGQws 4=; X-CSE-ConnectionGUID: BxdPn14FSKGZsTscOECGPg== X-CSE-MsgGUID: mpsQ+mzbStynQezYRkbRFQ== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464603 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:GBbuEq2dKvZbLGtYufbD5TVxkn2cJEfYwER7XKvMYLTBsI5bpzACy mocD2+HP/uDamT2fdt1aozn9UMO7JXUx9RhQQc+pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliOfQAOK6UbaYUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8teTb9HuDgNyo4GlD5wVkPKgR1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQR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eTXfBfBaWL+UyGJ8TVzJ8+6U 9YG5IObOEZ5zBB/KDHCXCDYrMdKbu8gdKVbJblvgNQpFpRGtldBm5CY27xfyEYKmgnOXNeLu vt2iNpnUveRZ19VLXPOpBqZZmxmzTjruOpXfbGbyRXizWmvHeH6KPeGxPd5xcGXzZOxrtn0W WtqX2y2oyT99+61zrV3Cvr741bndvnxp95CMPksLlZFhzcziipeaFoUPm6vCk4peGp5BIRjd HQvw1IBbU+11rhOk+0vD7k0E3YyzAs53X+oGXoyEfLkIjWRC8eA8EEvJlecRfS9g4BsbhHoe p29lPcmZpLKBvK2B3n4dvFXQwvr0KooBMZ4KUupk0acYwDbLRW6awzlXkla6vpVErBmf0a+K MHNrCh2N9mNXWHcn/dtm5shPilXnE2FhDueCI/hvA= X-Talos-CUID: 9a23:CErM2G914nEtJqSshCSVv2QEFvgjKyHz91T/EVSEEm1OZZa6cVDFrQ== X-Talos-MUID: 9a23:jOKeQQuah1bq4WNNzc2ngSl5DYRt8a6VFFELqJgUivOHPxZeAmLI X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464603" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 2/5] x86/setup: Rework cmdline_cook() to be compatible with -Wwrite-strings Date: Tue, 21 Nov 2023 20:15:37 +0000 Message-ID: <20231121201540.1528161-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Rework the logic in __start_xen() to not potentially pass NULL into cmdline_cook(). This makes the logic easier to follow too, and the rest of __start_xen() is safe when initialising cmdline to the empty string. Update cmdline_cook() to take and return const pointers, and write a description of what it does. It now requires a non-NULL input and guarentees to return a pointer somewhere in the 'p' string. Note this only compiles because strstr() launders the const off the pointer when assigning to the mutable kextra, but that logic only mutates the mbi->cmdline buffer. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Roberto Bagnara CC: Nicola Vetrini v2: * create_dom0() changes split out into a previous patch * Remove the logic for a NULL input, now that all callers have been adjusted --- xen/arch/x86/setup.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c0302c6bdd62..b171a8f4cf84 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -837,10 +837,15 @@ static bool __init loader_is_grub2(const char *loader_name) return (p != NULL) && (p[5] != '0'); } -static char * __init cmdline_cook(char *p, const char *loader_name) +/* + * Clean up a command line string passed to us by a bootloader. Strip leading + * whitespace, and optionally strip the first parameter if our divination of + * the bootloader suggests that it prepended the image name. + * + * Always returns a pointer within @p. + */ +static const char *__init cmdline_cook(const char *p, const char *loader_name) { - p = p ? : ""; - /* Strip leading whitespace. */ while ( *p == ' ' ) p++; @@ -969,8 +974,8 @@ static struct domain *__init create_dom0(const module_t *image, /* SAF-1-safe */ void __init noreturn __start_xen(unsigned long mbi_p) { - const char *memmap_type = NULL, *loader; - char *cmdline, *kextra; + const char *memmap_type = NULL, *loader, *cmdline = ""; + char *kextra; void *bsp_stack; struct cpu_info *info = get_cpu_info(), *bsp_info; unsigned int initrdidx, num_parked = 0; @@ -1025,9 +1030,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) : "unknown"; /* Parse the command-line options. */ - cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ? - __va(mbi->cmdline) : NULL, - loader); + if ( mbi->flags & MBI_CMDLINE ) + cmdline = cmdline_cook(__va(mbi->cmdline), loader); + if ( (kextra = strstr(cmdline, " -- ")) != NULL ) { /* From patchwork Tue Nov 21 20:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54CF9C61D97 for ; Tue, 21 Nov 2023 20:16:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638182.994529 (Exim 4.92) (envelope-from ) id 1r5XA9-0007hX-0Y; Tue, 21 Nov 2023 20:16:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638182.994529; Tue, 21 Nov 2023 20:16:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA8-0007hK-Te; Tue, 21 Nov 2023 20:16:00 +0000 Received: by outflank-mailman (input) for mailman id 638182; Tue, 21 Nov 2023 20:15:59 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA7-0007Bx-1G for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:15:59 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c7a0f2a2-88aa-11ee-9b0e-b553b5be7939; Tue, 21 Nov 2023 21:15:57 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7a0f2a2-88aa-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597757; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zhFqeBE6+dVJCflG9ZGRRYk/WpALPCbVG60q2etK4II=; b=BW7A2YyFmjWN24+UDkmP12zTh8dNbOAI6w/AEURezRjJ3e5dJ6PERoY9 jomYta76/Qt9kB15yUCaI8AtSVO/t2PA8ZgeXsX6lcLwtUzDmQ2ULzefs ++nSSYaArZczJ2w4WlrdEJzrwFhY+iFHIDrjhTrwfyIa7OMRx1MHATHVX I=; X-CSE-ConnectionGUID: +GZ+UsK9SGatMSUbv7Cxvg== X-CSE-MsgGUID: H2Ia19A2RQmFFwSxh4AdHQ== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464601 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:/FnTPKuUYR9imAmGJy+qrLoIpufnVLBeMUV32f8akzHdYApBsoF/q tZmKW2GafuMMTfye94gbo+080sE7JXUm9RnHgZu/31mH3gS+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVaicfHg3HFc4IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4rKq5Fv0gnRkPaoQ5QaEziFPZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwax8/LS2Y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XLu vi2iMtnUvURZ14VLXJOpAtZZmMmzUL/KiWAiIuNloI6BSqhTjt0b7iHx2Z2Rtbcz4n+8ZpzU H11yL4+4CquLWDygbR0m/V49BslNSJ8KoPOOW8zuYUNxDlgUKQZJ1sXr2EsHQOvemz9ExCqq iBnz4Qe+py9lbYdSWNuh3v1wP8uQxeokPK+Bu3gWbHqce8fSk9CMZKmMZ4f3LimgIdleA5/q JX+mqT86NNCxDNljm43tDUVnhR5wGJiEtnsekOi3dYFasyAYUh1rD2tCtuYeo99GiT0vFaLM BeSOfB+flSeVSZK1TQvmxqyNvEZB4OIis= X-Talos-CUID: 9a23:og0zG2mjVcoHell2OC0bblIbR6TXOT7y/jTtOGzpMklgVJiudFWOp4h0jcU7zg== X-Talos-MUID: 9a23:D141jAnqhRS0Xh9Kjj1adnpCbuZhuvWHUno0lLsopPKUNXBZNxek2WE= X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464601" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 3/5] x86/efi: Simplify efi_arch_handle_cmdline() Date: Tue, 21 Nov 2023 20:15:38 +0000 Message-ID: <20231121201540.1528161-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 -Wwrite-strings is unhappy with assigning "xen" to a mutable pointer, but all this work is useless; it's making a memory allocation just to prepend the image name which cmdline_cook() intentionally strips back out. Simply forgo the work and identify EFI_LOADER as one of the loaders which doesn't prepend the image name. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Roberto Bagnara CC: Nicola Vetrini v2: * Brand new. I can't find anything which cares about the image name in the slightest. This logic is from bf6501a62e80 ("x86-64: EFI boot code") when EFI was introduced, at whcih point GRUB2 was the only excluded loader in cmdline_cook(). --- xen/arch/x86/efi/efi-boot.h | 10 +--------- xen/arch/x86/setup.c | 7 +++++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index eebc54180bf7..1a2a2dd83c9b 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -309,6 +309,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, { union string name; + /* NB place_string() prepends, so call in reverse order. */ if ( cmdline_options ) { name.w = cmdline_options; @@ -317,15 +318,6 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, } if ( cfgfile_options ) place_string(&mbi.cmdline, cfgfile_options); - /* Insert image name last, as it gets prefixed to the other options. */ - if ( image_name ) - { - name.w = image_name; - w2s(&name); - } - else - name.s = "xen"; - place_string(&mbi.cmdline, name.s); if ( mbi.cmdline ) mbi.flags |= MBI_CMDLINE; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index b171a8f4cf84..200520392481 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -850,8 +850,11 @@ static const char *__init cmdline_cook(const char *p, const char *loader_name) while ( *p == ' ' ) p++; - /* GRUB2 and PVH don't not include image name as first item on command line. */ - if ( xen_guest || loader_is_grub2(loader_name) ) + /* + * PVH, our EFI loader, and GRUB2 don't not include image name as first + * item on command line. + */ + if ( xen_guest || efi_enabled(EFI_LOADER) || loader_is_grub2(loader_name) ) return p; /* Strip image name plus whitespace. */ From patchwork Tue Nov 21 20:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2D96C61D85 for ; Tue, 21 Nov 2023 20:26:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638208.994548 (Exim 4.92) (envelope-from ) id 1r5XKW-00035k-9w; Tue, 21 Nov 2023 20:26:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638208.994548; Tue, 21 Nov 2023 20:26:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XKW-00035d-7P; Tue, 21 Nov 2023 20:26:44 +0000 Received: by outflank-mailman (input) for mailman id 638208; Tue, 21 Nov 2023 20:26:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA8-0006aW-D0 for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:16:00 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c8f4c279-88aa-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 21:15:59 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8f4c279-88aa-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h72RGL0wBeTp69VGUdWNFI72/Va5/mOVad612sj0U0Y=; b=UXLJgQO4VsJYfcf8NLXV7gwqw3mFiLVsbWJHJqscvaRiuQNnpB3RK3lm gjNCQMBElgAI/sVfwOH4IJ05ZSMcWLUSiJvREotZcPaqNn4TRS0tP47kZ VEmwkTdiNCpvwBDnZaemk55ZsBLl7mnbm0HxMz8jTiJmX8AlRC3a5liAc 8=; X-CSE-ConnectionGUID: BxdPn14FSKGZsTscOECGPg== X-CSE-MsgGUID: KCcTuWliSAmd0KYlcd8jzQ== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464604 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:2DIThqqwhsqCBxbA7XebtHi81kNeBmL+ZRIvgKrLsJaIsI4StFCzt garIBmFPPjbYDbxf4hzad6+8U0FupLTy9JgHVNvpCpmEiwb95uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbOCYmYpA1Y8FE/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04G9wUmAWP6gR5waHzSBNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXABodYiiF3r6Y+5GUePJQnc8EAeLEBIxK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSaxFIUPrSn8/x7pX7WxRepEiYuuwc5G/LwRYq+LPsLMDU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2asDU0p+3q0ksjjc XXyi1Qc/hb2jf+fnyRqRCo4hLn0zol9hbZuBalqEqmj8zlYTowT/Nbg4FUeAacy0dIhqA17I t7m0yYqr9eBlf4hyL/69LUEyhji0vcmwtorccjy1xZTY8UbvtwgOUkjTho+N9pJlOG1GhseN MecP301bJxbU6UanjfvC1KyNyoWnw1dy3tfnQ/ X-Talos-CUID: 9a23:cfEDrGssQNguq/RYovAvZDMy6IsPYnHlyi6MDXSbJlRydKaebnK715trxp8= X-Talos-MUID: 9a23:ZBJCTwhp+fBEYwUQ+LWh2sMpF+xj37mRDEE2uJAK4+q1MSd8azWPtWHi X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464604" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 4/5] arm/efi: Simplify efi_arch_handle_cmdline() Date: Tue, 21 Nov 2023 20:15:39 +0000 Message-ID: <20231121201540.1528161-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 -Wwrite-strings is unhappy with assigning "xen" to a mutable pointer, but this logic looks incorrect. It was inherited from the x86 side, where the logic was redundant and has now been removed. In the ARM case it inserts the image name into "xen,xen-bootargs" and there is no logic at all to strip this before parsing it as the command line. The absence of any logic to strip an image name suggests that it shouldn't exist there, or having a Xen image named e.g. "hmp-unsafe" in the filesystem is going to lead to some unexpected behaviour on boot. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu Reviewed-by: Stefano Stabellini Tested-by: Henry Wang Reviewed-by: Julien Grall --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Roberto Bagnara CC: Nicola Vetrini v2: * New. I'm afraid that all of this reasoning is based on reading the source code. I don't have any way to try this out in a real ARM UEFI environment. --- xen/arch/arm/efi/efi-boot.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 1c3640bb65fd..59d217667ff3 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -461,7 +461,7 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, union string name; char *buf; EFI_STATUS status; - int prop_len; + int prop_len = 0; int chosen; /* locate chosen node, which is where we add Xen module info. */ @@ -473,20 +473,6 @@ static void __init efi_arch_handle_cmdline(CHAR16 *image_name, if ( EFI_ERROR(status) ) PrintErrMesg(L"Unable to allocate string buffer", status); - if ( image_name ) - { - name.w = image_name; - w2s(&name); - } - else - name.s = "xen"; - - prop_len = 0; - prop_len += snprintf(buf + prop_len, - EFI_PAGE_SIZE - prop_len, "%s", name.s); - if ( prop_len >= EFI_PAGE_SIZE ) - blexit(L"FDT string overflow"); - if ( cfgfile_options ) { PrintMessage(L"Using bootargs from Xen configuration file."); From patchwork Tue Nov 21 20:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13463540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73944C61D90 for ; Tue, 21 Nov 2023 20:27:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.638215.994559 (Exim 4.92) (envelope-from ) id 1r5XKv-0003dE-Hm; Tue, 21 Nov 2023 20:27:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 638215.994559; Tue, 21 Nov 2023 20:27:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XKv-0003d5-FA; Tue, 21 Nov 2023 20:27:09 +0000 Received: by outflank-mailman (input) for mailman id 638215; Tue, 21 Nov 2023 20:27:08 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5XA7-0006aW-86 for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 20:15:59 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c7b7f944-88aa-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 21:15:58 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7b7f944-88aa-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1700597758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5uiIRow6rh0vRvX5ViEOdcJuUhRBpUj5Jr2b1aBEl6g=; b=GlMeY4vTxkb18wvHkPmJQo4J/xW606ppGZLetB/Gbakda79v44z920ZO o4p5uamRLj1ruHCpj2tvtc4DmeJjTdFyvfMa87TGqj6XNrapBH2+ya+UO XkTKQWJV1i6Xg7wu9lm40jR6wInsF4PyZIa4T8sYI76ZalH4Apat3ZaEf c=; X-CSE-ConnectionGUID: +GZ+UsK9SGatMSUbv7Cxvg== X-CSE-MsgGUID: CqveYOQkQuCdJAkr8aVIhg== Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 127464602 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.159.70 X-Policy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:+k3rQaAFvWjUHBVW/9Xjw5YqxClBgxIJ4kV8jS/XYbTApG5w3jZUz TYXC26EaPmIYGv9fIogPYmzoEIC7J/XyYVrQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48D8kk/nOH+KgYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbCRMt8pvlDs15K6p4WpC5wRkDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIwuclFQlxV1 q0jBzkRSyu+jfzp66KlRbw57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdIL2U3BPjDS0Qn1lM/IZQyhuq3wFL4dCVVsgm9rqsr+WnDigd21dABNfKMIIPWG5kLxhzwS mTu1H3nDyA9Dd+m1BGJ0FuvnL/GowL7V9dHfFG/3qEz2wDCroAJMzUGWF3+rfSnh0qWX9NEN 1dS6icotbI19kGgUp/6RRLQiGWfohcWVt5UEus7wAKA0KzZ50CeHGdsZhxrZcEitcQ2bSc3z VLPlNTsbRRwtJWFRHTb8a2bxRuwJCwUIGkqdSICCwwf7LHLnoY3iR7eS8d5J4S8hNb1BDLYz iiDqW41gLB7pcQGzbmh9FbLxTelvIHUTxUd7x/SGGmi62tRYY+uZ4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xp8= X-Talos-MUID: 9a23:lI9pJgYfkKies+BTnCbyiQBFDcRR/o+iKmkOi8UPheiEOnkl X-IronPort-AV: E=Sophos;i="6.04,216,1695700800"; d="scan'208";a="127464602" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Stefano Stabellini , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Roberto Bagnara , Nicola Vetrini Subject: [PATCH v2 5/5] xen: Enable -Wwrite-strings Date: Tue, 21 Nov 2023 20:15:40 +0000 Message-ID: <20231121201540.1528161-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231121201540.1528161-1-andrew.cooper3@citrix.com> References: <20231121201540.1528161-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The codebase is now -Wwrite-strings clean. Activate the option to cause string literals to have a const type, and prevent any violations of MISRA Rule 7.4 being reintroduced. Signed-off-by: Andrew Cooper Acked-by: Stefano Stabellini --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Roberto Bagnara CC: Nicola Vetrini --- xen/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/Makefile b/xen/Makefile index 7b869f4b3037..ca571103c868 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -392,7 +392,7 @@ endif CFLAGS-$(CONFIG_CC_SPLIT_SECTIONS) += -ffunction-sections -fdata-sections CFLAGS += -nostdinc -fno-builtin -fno-common -CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith +CFLAGS += -Werror -Wredundant-decls -Wwrite-strings -Wno-pointer-arith $(call cc-option-add,CFLAGS,CC,-Wvla) CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h CFLAGS-$(CONFIG_DEBUG_INFO) += -g