From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nPomW-00074o-Fz for mharc-grub-devel@gnu.org; Thu, 03 Mar 2022 11:58:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPomU-0006x3-GC for grub-devel@gnu.org; Thu, 03 Mar 2022 11:58:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPomR-0002yy-5t for grub-devel@gnu.org; Thu, 03 Mar 2022 11:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646326698; 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=0iL/ndRs4HAuMWQYCERVzEVkyf+jfVHEL6T4YoCYAm4=; b=aDNQObY9+XYs9ST2lh/pXxet9lhfGxSBl/MKN/65Epu3DFWhUjBAGlv3V6ga+tZn3WgZhx b8dfIe3hnCLaEHO7OZ4DudpWOFAMZXylVW+NTMENOF9BdYtwJsxt4EV9JmNu7YabngOdVr yuvjE/cHHAPlLXeRRlEUgu5P7WV6ie4= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-uysGiJuHPDm4mdwZVhSbmg-1; Thu, 03 Mar 2022 11:58:17 -0500 X-MC-Unique: uysGiJuHPDm4mdwZVhSbmg-1 Received: by mail-qv1-f70.google.com with SMTP id m19-20020a056214159300b004352bebfd8bso3506167qvw.6 for ; Thu, 03 Mar 2022 08:58:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=0iL/ndRs4HAuMWQYCERVzEVkyf+jfVHEL6T4YoCYAm4=; b=iQiRydqKIWRXKX2Anqlbo4tZKrp1jWYquO5nG1xYS/rBnckiYT9Dk60ZPYc8HcLHih e0n2l4OYkRe0xlS1VTvYC35RiqVQp08d1DtM+F8wVwpv0hyQ4ctgzHtR8OzKAFtx3wRM LUyTU3jHg/rnV7uOmKAS9StSfzCX//X+ZWERs1M8ZL2Fd84iA/n441v+HN8KdF59NAPP e/7JE8Wt80OgIM6cInegSzLqbdSDV4rj07NkEmsSwdXFnNcN3fhpNO3xfOAW8jkyESqG iP4Yozf91fpbhbjU+8aOKV7LKhzFocECIdmq24bHQrkbwga6VCig4qb0uSD4ENdbKY7+ QXpg== X-Gm-Message-State: AOAM531fcsDOOvXDLKodP8HXBRyEG9kgY+53a6dYVqniDk0x21aQh4m0 dBoI2TgnoVhrMyMnIamkhbRBWw8MC2YNXAvz7rGbJKHk+leNySzpyJvSJLKJDoeoU5gxa36PQAN OrxcrhcKuJ28= X-Received: by 2002:ae9:ef02:0:b0:476:2f28:d1b2 with SMTP id d2-20020ae9ef02000000b004762f28d1b2mr86855qkg.188.1646326696125; Thu, 03 Mar 2022 08:58:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7l3hLwxfMqXsTmZOzS7aHWIVx7Ts0THYKdzj4gjM2OhlvoHyTKC5DG8UsgtKYBusfjGF0rg== X-Received: by 2002:ae9:ef02:0:b0:476:2f28:d1b2 with SMTP id d2-20020ae9ef02000000b004762f28d1b2mr86823qkg.188.1646326695138; Thu, 03 Mar 2022 08:58:15 -0800 (PST) Received: from localhost ([2601:184:4181:74c0:862e:5809:ed9e:e10e]) by smtp.gmail.com with ESMTPSA id h14-20020ac8584e000000b002ddf8b971b2sm1894637qth.87.2022.03.03.08.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 08:58:14 -0800 (PST) From: Robbie Harwood To: development@efficientek.com Cc: The development of GNU GRUB , dkiper@net-space.pl Subject: Re: [PATCH v8 4/6] Drop gnulib no-abort.patch In-Reply-To: <20220302182209.7244939c@crass-HP-ZBook-15-G2> References: <20220302190829.195337-1-rharwood@redhat.com> <20220302190829.195337-5-rharwood@redhat.com> <20220302182209.7244939c@crass-HP-ZBook-15-G2> Date: Thu, 03 Mar 2022 11:58:11 -0500 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.133.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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, 03 Mar 2022 16:58:22 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Glenn Washburn writes: > On Wed, 2 Mar 2022 14:08:27 -0500 > Robbie Harwood wrote: > >> Originally added in db7337a3d353a817ffe9eb4a3702120527100be9, this >> patched out all relevant invocations of abort() in gnulib. While it was >> not documented why at the time, testing suggests that there's no abort() >> implementation available for gnulib to use. >>=20 >> gnulib's position is that the use of abort() is correct here, since it >> happens when input violates a "shall" from POSIX. Additionally, the >> code in question is probably not reachable. Since abort() is more >> friendly to user-space, they prefer to make no change, so we can just >> carry a define instead. (Suggested by Paul Eggert.) >>=20 >> Signed-off-by: Robbie Harwood >> --- >> bootstrap.conf | 2 +- >> conf/Makefile.extra-dist | 1 - >> config.h.in | 10 ++++++++ >> grub-core/lib/gnulib-patches/no-abort.patch | 26 --------------------- >> 4 files changed, 11 insertions(+), 28 deletions(-) >> delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch >>=20 >> diff --git a/bootstrap.conf b/bootstrap.conf >> index 21a8cf15d..71acbeeb1 100644 >> --- a/bootstrap.conf >> +++ b/bootstrap.conf >> @@ -82,7 +82,7 @@ cp -a INSTALL INSTALL.grub >> bootstrap_post_import_hook () { >> set -e >> for patchname in fix-null-deref fix-null-state-deref fix-regcomp-unin= it-token \ >> - fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-= width no-abort; do >> + fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-= width; do >> patch -d grub-core/lib/gnulib -p2 \ >> < "grub-core/lib/gnulib-patches/$patchname.patch" >> done >> diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist >> index 15a9b74e9..4ddc3c8f7 100644 >> --- a/conf/Makefile.extra-dist >> +++ b/conf/Makefile.extra-dist >> @@ -35,7 +35,6 @@ EXTRA_DIST +=3D grub-core/lib/gnulib-patches/fix-regex= ec-null-deref.patch >> EXTRA_DIST +=3D grub-core/lib/gnulib-patches/fix-uninit-structure.patch >> EXTRA_DIST +=3D grub-core/lib/gnulib-patches/fix-unused-value.patch >> EXTRA_DIST +=3D grub-core/lib/gnulib-patches/fix-width.patch >> -EXTRA_DIST +=3D grub-core/lib/gnulib-patches/no-abort.patch >>=20=20 >> EXTRA_DIST +=3D grub-core/lib/libgcrypt >> EXTRA_DIST +=3D grub-core/lib/libgcrypt-grub/mpi/generic >> diff --git a/config.h.in b/config.h.in >> index 965eaffce..209e27449 100644 >> --- a/config.h.in >> +++ b/config.h.in >> @@ -66,6 +66,16 @@ >>=20=20 >> # ifndef _GL_INLINE_HEADER_BEGIN >> # define _GL_ATTRIBUTE_CONST __attribute__ ((const)) >> + >> +/* >> + * We don't have an abort() for gnulib to call in regexp. Because gnul= ib is >> + * built as a separate object that is then linked with, it doesn't have= any >> + * of our headers or functions around to use - so we unfortunately can't >> + * print anything. Builds of emu include the system's stdlib, which in= cludes >> + * a prototype for abort(), so leave this as a macro that doesn't take >> + * arguments. >> + */ >> +# define abort __builtin_trap > > I asked earlier if we couldn't use grub_abort for gnulib's abort and > Daniel referred me to subsequent patch series. I suppose this is the > relevant section he was thinking of, however, its still not clear to me > why we can't use grub_abort(). And actually looking more into it, its > seems to me that using grub_abort() is probably what we should do > because it has platform specific cleanup code. It appears that > __builtin_trap is target dependent[1], but I do not believe that it is > or can be platform dependent. > > Is the problem with grub_abort() that it provides some exit > guarantees[2] and we're looking for the equivalent of a machine crash? > That doesn't seem right to me. It is true that grub_abort calls > grub_exit which is platform specific. So for instance for x86_64-efi, > this will not call EFI boot_services->exit. Not being an EFI expert, > I'm not sure of the implications of that. If my suspicion is correct > and an abort in gnulib with this patch would not properly exit the EFI > app and not allow returning control to another EFI app, then I would > consider this patch undesirable. And I notice that other platforms have > special code run on grub_exit. I suspect that GCC's __builtin_trap is > more geared toward user-space programs and not for our use case. > > If the problem is that gnulib, as stated above, is built as a separate > object and then linked to GRUB, which does not have an abort symbol > (thus causing a link failure). Then I think the right solution is to > create a symbol in the GRUB kernel named abort that has the same info as > grub_abort. > > I have a patch I've been meaning to send which solves this problem for > GDB which in some cases look for symbols free() and malloc(). When > building the GRUB kernel add "-Wl,--defsym=3Dabort=3Dgrub_abort" to the > LDFLAGS_KERNEL variable in conf/Makefile.common. > > I haven't tested this, so I'm interested in hearing why this won't work > or isn't a good solution. I believe this should work for user-space > platforms like emu because of the platform specific grub_exit(). The one > problem I see is that for the emu platform exit guarantees may be > undesirable. This this case, perhaps grub_abort() should call libc's > abort(). If you have a patch that makes this work, I don't have a problem with it. However, I was unable to make that work in practice. Be well, =2D-Robbie --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEA5qc6hnelQjDaHWqJTL5F2qVpEIFAmIg86MUHHJoYXJ3b29k QHJlZGhhdC5jb20ACgkQJTL5F2qVpEJqJBAAkbm3yfgIC0hbJQLr3a/QGita3x7L /CxOm7S7ByJ0TtsHbIAPAYDJXnWQQw7oMfgfowBprbNpxjZRegfpF2A+S6nXkD8R njil/9qMYMOuxVvyavu3w5u8URwlft1nh8GdK0+bwof2+C6acwS83R7ZnWuwBcWw Vl6ak+L2BSr8CC7kbrqLUC5AA0T2gCGY47rSgnjleOU0WtNT9BAjCgSLZrCShwQl yQy5cfiWHSq4LQQ29BrniAVJMEi5pPgDEgN2DyYmg5hiRNT6v0IaRgHhZvJzYi0b J4SerLKkfut0H7vL7DgilcbttAhMXeiXtyIIs6IFvHPRQh0D/n8CHVwl8VmyGGSy ++wmm3PSq3W0jM1MCOBxTwJObvc9Gm7CmhQm/Jm23nxN448uixMKHu7H0yLvupCS Bv7IXg2C6rGEyNEHejuqBEYFcjWCt6Y/9WqhnDWo2NNWsmw2gespjq/1XL9YHjUP Yf3WqmpCk4122fpenjcUCLlhHjrFfVezE5TvU87mA5dop8GlazvDKTzIlTJTE8pY P/pf2KK39yQxUkjE7fqnp548CPWTWTOwfFOkbAfbIPdtEbG/CdEHX/1vhbZxgHPg sp8t7nB85XKMT7xkqOsJ2jw13mco6THrTJhRhW8QFCAtLhagK+ybCVGdVB9X4Msj 0S+RIt9m1szq+58= =ISY+ -----END PGP SIGNATURE----- --=-=-=--