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.gnu.org (lists.gnu.org [209.51.188.17]) (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 EE1F5C3ABB2 for ; Wed, 28 May 2025 16:05:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKJHH-0001uc-6w; Wed, 28 May 2025 12:05:19 -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 1uKJH7-0001s9-Sv for grub-devel@gnu.org; Wed, 28 May 2025 12:05:07 -0400 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKJH4-00028q-F6 for grub-devel@gnu.org; Wed, 28 May 2025 12:05:04 -0400 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3dd755bc266so1902705ab.3 for ; Wed, 28 May 2025 09:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748448299; x=1749053099; darn=gnu.org; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=iKuc98uuu9Wf7Rdv5MVIRxWsTu+n9bgdGg2W0tYJ1lg=; b=Q5xM6UWOOlAtXLBu3z1+kgAbdvqb6xUO/AZX90h6zysVmpSTWUEhA7r/xziGf9FqDK WqXyPdE4Ob1q/VeVxr0MTrzWqmx+KlxLlYt5SacvpBFnmVjIU6BCwTOyxDzy3XhP4tMK +zqMreRihjWGPEvxeI9ugsdm16NPNajjBNXwl5bfulfrD+6IRAdpar+waxxlxMmatH4p A3oDjqnTuX/IFMb1LY57SHsQle6n4tOoOLZWesLoqf0TVpa9AKZYwbU+y2y5DLD0iwpO PmUO6JG5wLhDYtfW5xwQjUONX0JV/Ofq3J2zQ3dha5GpIIraK/urXwOn8eisREP2oNZN EGRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748448299; x=1749053099; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iKuc98uuu9Wf7Rdv5MVIRxWsTu+n9bgdGg2W0tYJ1lg=; b=LdtV2WAwZUxqD9kTXieBJwENwfXc6+aIj/T0Iqv+QHxgQTilgw46xa6R7mikVojhhG eKPDkCrWq5UI/mdHu+QujYgO5dPTIDYvIxDsAy5+RpjKf7I3Us+9CGD80NAIS2Pxci6S iGyF4cCbTRhFNe8e4n4U+i1Nw0eNfKg/ePh/zGpsOqlYbct3hmuE61W53fSHAA7SITXl cWF6GCRwDlcNlXTZAZoMg/EhPyE5SfZPI2t4oY3rgAe0ecyXcAEh6w0CqEBFpgR6VBxb 9fB5OQ4nZhZfCZDbxfO4T2bIHbY57nDaRrvzs/DV0VXc7zKyNwJiKn2Qw/9PTT6PmBsy m/7w== X-Gm-Message-State: AOJu0Yxt+GoHCQ4uDbTPl2yUeAJSlr4xg+HjlEq4jNK5gekyTnkAjsos Rw+muPdziNswKff8u3rRsC6LaZrdYqA8HaOoYTIAv3cHQsb7AG5OQ11F X-Gm-Gg: ASbGnctF2C/njYK6hyclnm4Qg2cpC0sinvAs9hJp1BaM6smv2Iu3DaDRJthkF00Z66l cB2FmRSmig1WrT6zHiRihpToP1wgTo4unGyRdEEznuJJSZRC500baYX8ARZAyHYN47j3XQhWRw7 N96HfWcY8TEkv/EPgf+oferEaHu1RLacQXCMR6QSe+2+dspSPIbncsqYIMvTvshMTqXkkic68DO maK/S0ZPFGU1X1vhm+WpQGoy8iCSsz0YSmRGB8r9u229/NNN13wibtqqv8Xn0IdTw06SSqlNr2t AgMutCMNl4d2orVGpfxCn/aeKD9GntGn8GCdVdWK51QHLKnraw== X-Google-Smtp-Source: AGHT+IHVlT/76TWRpaUp8fhMI+CtEBPvmX5FY+2Jg37OkycZ3f2cEucMMlmKE8SzP78ZBU26u/JWEA== X-Received: by 2002:a92:c244:0:b0:3d4:6d6f:6e1f with SMTP id e9e14a558f8ab-3dd89d4705bmr9181505ab.6.1748448298640; Wed, 28 May 2025 09:04:58 -0700 (PDT) Received: from kf-m2g5 ([2607:fb90:6d88:4020:e7d0:b732:e526:6ec1]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4fdbd5c3b11sm285808173.137.2025.05.28.09.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 May 2025 09:04:58 -0700 (PDT) Date: Wed, 28 May 2025 11:04:55 -0500 From: Aaron Rainbolt To: "Vladimir 'phcoder' Serbinenko" Cc: The development of GNU GRUB Subject: Re: [PATCH 0/1] Add Xen command line parsing Message-ID: <20250528110455.1cb51770@kf-m2g5> In-Reply-To: References: <20250423214615.23d46d47@kf-m2g5> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::133; envelope-from=arraybolt3@gmail.com; helo=mail-il1-x133.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Content-Type: multipart/mixed; boundary="===============0047916542275635132==" Errors-To: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org Sender: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org --===============0047916542275635132== Content-Type: multipart/signed; boundary="Sig_/maS0i_1ar.V24HpCbi=gWoz"; protocol="application/pgp-signature"; micalg=pgp-sha512 --Sig_/maS0i_1ar.V24HpCbi=gWoz Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 28 May 2025 18:19:20 +0300 "Vladimir 'phcoder' Serbinenko" wrote: > I'm unsure about exporting all random parameters to env namespace. > PHP went down this road and result was bunch of bad vulnerabilities. > Maybe instead of blindly exporting it have some kind of export or > query command? Or at least add some prefix to exported vars to > identify them as such? There is a prefix, `xen_grub_env_`. I documented it in the first paragraph of the patch cover letter and in a code comment. I'll document it in the commit message as well though. > Regards > Vladimir 'phcoder' Serbinenko >=20 > Le jeu. 24 avr. 2025, 05:47, Aaron Rainbolt a > =C3=A9crit : >=20 > > The purpose of this patch is to allow the Xen hypervisor to pass > > extra data to GRUB in the form of a kernel command line, allowing > > the host to customize the boot process of the guest. The command > > line from Xen is parsed, and any variables within that start with > > the string `xen_grub_env_` are exposed as environment variables. > > The grub.cfg script can then use those environment variables as it > > sees fit. > > > > The main reason for doing this is to allow implementing boot modes > > in Qubes OS while also using in-VM kernels. For more context on > > Qubes boot modes, see [1]. In order for this to work with in-VM > > kernels, it is necessary for dom0 to pass kernel parameters to the > > guest without modifying the guest's grub.cfg manually. This patch > > allows this to be done, by allowing dom0 to pass kernel parameters > > to GRUB, which then provides them to grub.cfg as an environment > > variable. The grub.cfg script within the VM can then append those > > variables to the kernel command line. > > > > This is a significantly more robust version of the Xen command line > > parsing draft sent previously [2]. The patch has been tested with > > both PV and PVH virtual machines, using an otherwise unpatched GRUB > > source tree, building the patch on top of the tip of git master at > > the time of this writing (commit 4abac0a). My testing environment > > is a fully updated Arch Linux system with Xen built from the > > stable-4.20 branch. > > > > Some changes from the initial draft sent previously: > > > > * Only parameters starting with `xen_grub_env_` are exposed as > > environment variables. This solves two of the previous patch's > > issues > > - dom0 can no longer clobber arbitrary variables within grub.cfg > > (as it cannot define variables with names that don't start with > > `xen_grub_env`), and API breakage won't occur if in the future > > more features are added to GRUB that use the Xen-provided kernel > > command line. > > * Testing has been done as described above. > > > > [1] https://github.com/QubesOS/qubes-linux-pvgrub2/pull/16 > > [2] > > https://lists.gnu.org/archive/html/grub-devel/2025-04/msg00050.html > > > > Aaron Rainbolt (1): > > Add Xen command line parsing > > > > grub-core/Makefile.core.def | 2 + > > grub-core/kern/i386/xen/pvh.c | 16 ++ > > grub-core/kern/main.c | 12 ++ > > grub-core/kern/xen/cmdline.c | 270 > > ++++++++++++++++++++++++++++++++++ include/grub/xen.h | > > 2 + 5 files changed, 302 insertions(+) > > create mode 100644 grub-core/kern/xen/cmdline.c > > > > -- > > 2.49.0 > > > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > > =20 --Sig_/maS0i_1ar.V24HpCbi=gWoz Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEudh48PFXwyPDa0wGpwkWDXPHkQkFAmg3NCcACgkQpwkWDXPH kQmLQQ/+OXgRn8Zr7VBfYryT9VxdznFnzdSq7zl/8Omnj9iAqHI8v6rVlW7Gdld9 riOdDTo6s54NPjmi0gtA4K1176DLMpzTbDymNOsfqF5U0g88HsRAPLj38I/7iDCn B3cNQ01CSNO4iekLenHFL6NZWTxA8oPYwJB1RfR40O+5dMui3hvQev7nO+V14LsL e3yqOBcuN3ngZ9dWuAr4iNkxiRpSaNebPBu83EnbTKxrvmAbay9qKP/qQVYdOjyP kRp/JNEhZWVGq2PQ6TSu1MaI6CFMekihoGZkw1Rs0Zl8XVWbzEqkWwZz084+j/ZB RC9GOVVEyxedjxwptbJoNyAPrgZWteP4FsUn4H3wn+kVbySUppclDniURvQUOyL0 cbhbjmLaePGCoVlZXnKBwqHRwN1/wc7VvlS6aH/5fy69NWn4JtbOKPvvOsej5f6h CB4MfTvF+xO7JAa0Iw9vKJuHFehJgv5tkM7SDCNMhglxWF/MTq1SAgDCz+XYqIfR gjGwSOA3ndTfzGCTDnHYJDSItO9Xf6btNQfDpK5OnCb55+psH4c9+mE/EZi7Jcw8 KmWg8zGmoneF5qwFT2hnoVjIqXFzzW7h0ZhOIwqrK2TvtJ+9XTAalS/sq58cHE8J aeLY8W+POpY0dGQ+DMA1J7Ecrl+PPlCutYz0/Y1MxfJ6Eai3NYo= =M3MV -----END PGP SIGNATURE----- --Sig_/maS0i_1ar.V24HpCbi=gWoz-- --===============0047916542275635132== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KR3J1Yi1kZXZl bCBtYWlsaW5nIGxpc3QKR3J1Yi1kZXZlbEBnbnUub3JnCmh0dHBzOi8vbGlzdHMuZ251Lm9yZy9t YWlsbWFuL2xpc3RpbmZvL2dydWItZGV2ZWwK --===============0047916542275635132==--