grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnulib: Handle aborts in gnulib more gracefully


From: Robbie Harwood
Subject: Re: [PATCH] gnulib: Handle aborts in gnulib more gracefully
Date: Fri, 25 Mar 2022 11:44:42 -0400

Glenn Washburn <development@efficientek.com> writes:

> Gnulib does not define abort(), but expects it to be defined, usually by a
> libc implementation. However, GRUB has no libc and does not have an abort()
> function. Until recently GRUB had patched out abort() in gnulib, effectively
> making it a noop. This changed with a recent update of the version of gnulib
> GRUB uses to be a compiler defined trap. While this is fine for user space
> code where the kernel can be expected to cleanup after a process when this
> happens, the firmware may not be good at doing this.
>
> GRUB does have a grub_abort(), with the same function signature that can be
> used instead. So instead define gnulib's abort() implementation to be
> grub_abort(). This provides consistency of behavior regardless of whether
> the abort happens in gnulib code or in GRUB code.
>
> Because we want to avoid patching gnulib again and gnulib expects that
> abort(), now grub_abort(), is defined externally, we must provide a
> prototype in the config.h. This is complicated by the fact that config.h
> is included in many GRUB compilation units as well as grub/misc.h which
> already declares grub_abort(). A macro, GNULIB, is provided only to
> compilation units using gnulib code, so that the grub_abort() prototype
> is only included in those compilation units where it is lacking.

This approach is nice.

> Also, export grub_abort() so that it can now be used within modules.
>
> Signed-off-by: Glenn Washburn <development@efficientek.com>

Reviewed-by: Robbie Harwood <rharwood@redhat.com>

Be well,
--Robbie

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]