From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pcumn-0001ve-KT for mharc-grub-devel@gnu.org; Thu, 16 Mar 2023 17:05:22 -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 1pcumf-0001vF-An for grub-devel@gnu.org; Thu, 16 Mar 2023 17:05:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcumd-0007rH-5P for grub-devel@gnu.org; Thu, 16 Mar 2023 17:05:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679000708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oPzAn+HIWmn9cxGOPBcdufBA4jF6+1YtwbNsCagDnVM=; b=DRiTLiMUQ1jrJ7F9DnEDGcvg+G+BHQjmpm+dklcCgk4/56eRbcgiPFKb5B2/dV+RheWDFj X5fqsc9L0QY+/3dGtye/R6a7aUMBmHbPcfGFuOv21Bf4RUEFzpIEqJLzIdtpev4Dtlcfgt Tg1Cegd52tIoBoMswNICpp5pBTNHTGI= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-94d5I-4TP7KZBZ-kLKcQjg-1; Thu, 16 Mar 2023 17:05:07 -0400 X-MC-Unique: 94d5I-4TP7KZBZ-kLKcQjg-1 Received: by mail-qv1-f71.google.com with SMTP id a15-20020a0562140c2f00b005ad28a23cffso1745482qvd.6 for ; Thu, 16 Mar 2023 14:05:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679000706; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oPzAn+HIWmn9cxGOPBcdufBA4jF6+1YtwbNsCagDnVM=; b=u3yBl+x+pBmI9+5pJ6V1MVzHZLd+zRKHX5c1mtDdUhmkpu2e1A0C21qDHDpfBeFcSj oJRZQop9V+rneOugDAfmkjogaoMtLvMLjf1HiRCl05T0YH00/sNoEBvntnT5AOwUy7tL SwP4HvuoODoP0Fs4OhrX/f6Q5NpvnSUu9ADQ7a7787+oivTsGwEc+6yp/S7KfQBY4G93 Vr0gQJX/cc+GKdTSc67zsW9cqVA0jZ+Wy/lfC+2Vy8pS488wDcJ6PAPn2m71PjMkAPGT c4O1g/qG24z2i+LzcjHjuFJj6pgYu1TmlsKNqFIFhbTfcI6Frg59Zp5TPrFW08iJQqRm 0FpA== X-Gm-Message-State: AO0yUKX2PICj5vBVeIT3PnKcwTtfMK7mikEXI86Mq1GsLlYPup4DB1I2 oTmKf9iwtLkYs5tQMn/8YQ+LRU7gvT/Rn6uvfKuorHmwPA/1F0EZgd85FulRp41t+KOx9G44lpG xqLKr6yGEl6c= X-Received: by 2002:a05:6214:1241:b0:5a7:a434:c300 with SMTP id r1-20020a056214124100b005a7a434c300mr25695942qvv.15.1679000706375; Thu, 16 Mar 2023 14:05:06 -0700 (PDT) X-Google-Smtp-Source: AK7set+yQeWin1rk3adXDTt9masGEF4rUMt3fSIVEzowoq6c5Z1tOYHepQRQXowyK55FaeqHxmBLKg== X-Received: by 2002:a05:6214:1241:b0:5a7:a434:c300 with SMTP id r1-20020a056214124100b005a7a434c300mr25695904qvv.15.1679000705965; Thu, 16 Mar 2023 14:05:05 -0700 (PDT) Received: from localhost ([2600:4040:5204:6800:da7c:a2cd:3b13:a673]) by smtp.gmail.com with ESMTPSA id e12-20020a05620a014c00b0073b27323c6dsm251039qkn.136.2023.03.16.14.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 14:05:05 -0700 (PDT) From: Robbie Harwood To: Glenn Washburn , grub-devel@gnu.org, Daniel Kiper Cc: Peter Jones Subject: Re: [RFC PATCH] gdb: Add more support for debugging on EFI platforms In-Reply-To: References: <20230227213526.2379718-1-development@efficientek.com> Date: Thu, 16 Mar 2023 17:05:02 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: , X-List-Received-Date: Thu, 16 Mar 2023 21:05:15 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Glenn Washburn writes: > On 3/9/23 23:00, Robbie Harwood wrote: >> Glenn Washburn writes: >>=20 >>> If the configure option --enable-efi-debug is given, then enable the >>> printing early in EFI startup of the command needed to load symbols for >>> the GRUB EFI kernel. This is needed because EFI firmware determines whe= re >>> to load the GRUB EFI at runtime, and so the relevant addresses are not >>> known ahead of time. This is not printed when secure boot is enabled. >>> >>> The command is a custom command defined in the gdb_grub GDB script. So >>> GDB should be started with the script as an argument to the -x option or >>> sourced into an active GDB session before running the outputted command. >>> >>> Also a command named "gdbinfo" is enabled which allows the user to print >>> the gdb command string on-demand, which can be valuable as the printing >>> early in EFI startup is quickly replaced by other text. So if using a >>> physical screen it may appear too briefly to be registered. >>> >>> Co-developed-by: Peter Jones >>> Signed-off-by: Glenn Washburn >>> --- >>> This is patch 9 from the v6 "GDB script fixes and improvements" series,= with >>> one modification. Now the gdbinfo command will print the gdb load comma= nd >>> even when the configure option is not enabled (though still not when lo= ckdown >>> is enabled). >>> >>> Robbie had 2 concerns with the last patch. >>> >>> 1. Does this need to be configurable? >>> * I responded that this was requested by Daniel because of concerns= about >>> it breaking silent boot and it seemed reasonable to me, but that = I don't >>> have a strong opinion. I've left it configurable until Dnaiel wei= ghs in. >>=20 >> Yeah, I think these concerns are valid. The version in the rhboot >> tree gates printing on an env var. Right now, it seems to me that: >>=20 >> - we want it to be default-off because silent boot > > I understand you to be talking about a default-off at runtime, not > built time. Right now there is a configure option which defaults to > off, is this acceptable? Indeed, I'm talking about runtime configurability. Build-time configurability means it's either always on (bad) or we have to rebuild in order to debug (annoying, interacts poorly with scureboot). >> - we want to have the ability to reenable without rebuilding because >> secureboot, convenience, etc. > > This would be great, but how do you propose that this would work? This=20 > patch will print very early in EFI init. We can't use GRUB variables. We= =20 > probably could use EFI variables, but this needs to be well defined (and= =20 > not by me, since I don't have this requirement). I'm not sure if the=20 > GRUB env block is available at this point, but that might be an option. > > Can you point me to RH's patch you've referred to? Does it meet this=20 > requirement, and if so how? I thought you were basing your work off it, given the "Co-developed-by" and your review on v1: https://lists.gnu.org/archive/html/grub-devel/2021-10/msg00076.html (v2 was https://lists.gnu.org/archive/html/grub-devel/2021-11/msg00006.html and the versions we're shipping are https://github.com/rhboot/grub2/commit/93803e83135e074ed5a3e7f67af22538896d= befe and https://github.com/rhboot/grub2/commit/c314270222b4adffa16840e3ca764d793e93= a0e8 ) As you say, the grub env block isn't available (module loading happens before filesystems). We have an additional patch that allows the use of an EFI variable for setting grubenv: https://github.com/rhboot/grub2/commit/22a11bfa59ff8f239cfe8698274281bc9196= 73dc which lets one do e.g. grub2-editenv ./grubenv set debug=3Dgdb,modules,dl { printf '\x07\x00\x00\x00' ; cat ./grubenv ; } > GRUB_ENV-91376aff-cba= 6-42be-949d-06fde81128e8 cp GRUB_ENV-91376aff-cba6-42be-949d-06fde81128e8 /sys/firmware/efi/efiv= ars/ and then have configuration for the next boot. Javier informally proposed this to the list a few years ago for ZFS-related things: https://lists.gnu.org/archive/html/grub-devel/2020-02/msg00045.html but I don't think it was ever followed up on, possibly because ZFS is not one of our use cases :) I'm happy to formally propose it, or feel free to include/adapt it if it's helpful to you, etc.. Be well, =2D-Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmQThH4UHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpEIIhQ/7B2CckhwUJ/5eqgSA8wx1ck6OCQwu Prw5JI4ba+lnDnTVSr182+rMUWFcqAMYh9AZn2iUaUH8pGE9yNnoKttsVOOkp1/0 0mTB+BfwSassl3kZi0O+KAa7DjqJc6bTnWTbY+DZq93zIl6lJPHx7bWKqQFM8HsX IFyHAQOPlTu/PsXAQsmY+9AZmMDObh/CiDzjdxQpWVS7JkIvz2kgGmSM0ycNlhcd +wPeH/2FlfFdNa+S95jBM12o9LffQAUeRMk2Qr73NYyv/3P3dg2uImAo/BS6sAYc HAqVHDhGRf5ov6xQ1JNuHy1Xvbv1sNIcV1GhHOPkdH5MUsWoUZOBDjB6exJFAKu7 EQQ14mosHPHstNwHNqNZ/8mPeSO087tsjvRj+VciheqlipySBH3w6F3x8e+v2RaC ikM9UCcSonrluDsvgQCXExcL8zc0OgtE0GDIl1NEqwjHnVJiCZpJbYhd0cr5ygZ7 PjAlK4b10qYe5EEIprmlfij16OULyWvXVK1m63swbSqOVUqW5nodapaF0E7E1v6D gRLlCLS69OheOY4kfm46/Xq3lC1y2PK2UNGpx5jyxbVq29L0rgpcJ9RVrFDXf7Od oHUe69sOdKQEWktOUXFwXG7MDkNHnYDp2zE7lACMpZflmFQsqAcSq5HdMnPOW8+y J7nwzefbEhPyXyk= =//Xt -----END PGP SIGNATURE----- --=-=-=--