11474 Commits

Author SHA1 Message Date
Leo Sandoval
b07cc37ca6 SECURITY: Update security team members names/fingerprints
Daniel has stepped down [1] whereas Marta and Leo are joining the security team.

[1] https://lists.gnu.org/archive/html/grub-devel/2026-02/msg00021.html

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Signed-off-by: Marta Lewandowska <mlewando@redhat.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Andrew Hamilton <adhamilt@gmail.com>
2026-03-13 18:15:37 +01:00
Leo Sandoval
14949bbd1f MAINTAINERS: Update GRUB git repository and mailing list addresses
We are announcing the new place where the GRUB repository [1] will be
hosted and its corresponding mailing list [2]. The repository at
freedesktop [1] would become soon the upstream repository, so new
contributions will need to be done through merge-requests.

The decision to migrate to a more modern repository system (freedesktop
is indeed a gitlab instance) is clear and based on several proposed
options, freedesktop turned out to be the best option. More information
about this migration is coming soon.

[1] https://gitlab.freedesktop.org/gnu-grub/grub/
[2] https://lists.freedesktop.org/postorius/lists/grub-devel.lists.freedesktop.org/

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Signed-off-by: Marta Lewandowska <mlewando@redhat.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Andrew Hamilton <adhamilt@gmail.com>
2026-03-13 18:14:10 +01:00
Leo Sandoval
da3675583a MAINTAINERS: Update maintainers list
Based on the recent announcement [1] by Daniel Kiper to step down,
two new maintainers are joining the project to balance the work that
Daniel had (during 10 years!).

[1] https://lists.gnu.org/archive/html/grub-devel/2026-02/msg00021.html

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Signed-off-by: Marta Lewandowska <mlewando@redhat.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Andrew Hamilton <adhamilt@gmail.com>
2026-03-13 18:13:48 +01:00
Nicholas Vinson
3dce38eb19 conf/i386-cygwin-img.lds: Update to use _grub_text_base symbol
This patch updates conf/i386-cygwin-img.lds to use the _grub_text_base
symbol just like conf/i386-pc-kernel.lds. It also updates configure.ac
to account for this change.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 15:08:00 +01:00
Nicholas Vinson
7d0a4c07a8 build: i386-cygwin-img-ld.sc -> i386-cygwin-img.lds
Rename i386-cygwin-img-ld.sc to i386-cygwin-img.lds as "lds" is the
preferred extension for linker scripts.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 15:03:57 +01:00
Nicholas Vinson
ab6f735174 configure: Add --image-base check for non-i386
Configure check grub_PROG_OBJCOPY_ABSOLUTE is run for all non-Apple
targets. With ld.lld-21, the check fails for addresses below image base
address (which ld.lld-21 assumes is 0x200000).

Fix by checking if linker support --image-base flag, and if it does,
include "--image-base 0" to TARGET_IMG_BASE_LDOPT.

The AX_CHECK_LINK_FLAG macro has been added to avoid a dependency on
autoconf-archive.

Note: I tried this approach with i386-pc, but I ended up with a GRUB
image that failed to boot correctly.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:59:22 +01:00
Nicholas Vinson
86283bfd4e configure: Drop -Ttext checks for i386-pc
The i386-pc target now uses a linker script, so -Ttext is no longer
required. However, a new variable TARGET_IMG_BASE_LDOPT_ARG_SEP is
introduced to handle the fact that when using --defsym the argument
separator must be "=". The space character is a syntax error.

Finally, EXTRA_DIST is updated to track the linker script used.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:49:16 +01:00
Nicholas Vinson
935e889ab5 Revert "INSTALL: Add note that the GNU Autoconf Archive may be needed"
This reverts commit a90ccbac6 (INSTALL: Add note that the GNU Autoconf
Archive may be needed).

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:38:55 +01:00
Nicholas Vinson
1dc2986c7e Revert "configure: Check linker for --image-base support"
This reverts commit 1a5417f39 (configure: Check linker for --image-base support).

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:36:54 +01:00
Nicholas Vinson
7b72d6cbd5 Revert "configure: Print a more helpful error if autoconf-archive is not installed"
This reverts commit ac042f3f5 (configure: Print a more helpful error if
autoconf-archive is not installed).

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:34:48 +01:00
Nicholas Vinson
ba2f351145 build/i386-pc: Update kernel image generation
The i386-pc kernel image fails to build because of changes made to
address ld.lld-21 and newer linking issues. Specifically, with
ld.lld-21, if you try to set the text section address below image base
address when linking a non-relocatable binary, ld.lld wil fail to link.

Switching to using a customized linker script solves the issue and is
a more robust solution to supporting multiple linkers than attempting to
find a set of command-line flags that satisfied all supported linkers
and links the kernel properly. In the worst case, continued use of
command-line flags could result in having to create code branches to
support various linkers.

For example, when dealing with just ld.bfd and ld.lld, the behavioral
differences between the two made finding a proper subset of flags that
worked impossible. The previous attempt dropped -Ttext for --image-base,
which has been proven not to work. The simplest correction,
"-Wl,--image-base=0 -Wl,-Ttext", did not work because that option resulted
in a GRUB kernel that entered into a tight infinite refresh loop.

Moreover, ld.lld does not order the sections the same way ld.bfd does,
and that results in object files with gaps or holes when sections are
stripped. I suspect, but did not investigate, that this plays a role in
the infinite refresh loop I mentioned earlier.

The easiest way to resolve all this is to use customized linker scripts.
These scripts, by default, override any default configuration the linker
would otherwise impose, allow for complete control in aligning sections,
and allows GRUB to specify where in the load segment each section goes.

This patch series does require linkers to support the --defsym flag,
which requires its argument to be of the form "sym=address" as
"sym address" is not supported.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:22:49 +01:00
Nicholas Vinson
9922ed133c include/grub/i386/pc/int.h: Move GRUB_MACHINE_PCBIOS ifdef
Modern compilers are becoming more strict and starting to warn when
certain attributes are ignored. The regparam attribute is such an
attribute.

Moreover, the function

  void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno, struct grub_bios_int_registers *regs) __attribute__ ((regparm(3)));

is only defined with the i386-pc target.

Update include/grub/i386/pc/int.h so grub_bios_interrupt() is only
declared when GRUB_MACHINE_PCBIOS is defined. This addresses the issue
of declaring a function that is not defined for non-i386-pc targets and
prevents the "attribute ignored" diagnostic message.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-03-05 14:14:56 +01:00
Nicholas Vinson
ce6f2b57f5 util/resolve: Save str[r]chr() ret val to const data ptr
With glibc-2.43 implementing the C23 standard, strrchr() and strchr()
now return "const char *" when its first argument is "const char *".

The fix is update all pointers receiving strrchr() and strchr()'s return
values so that they are now "const char *" instead of "char *".

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-02-26 15:59:23 +01:00
Nicholas Vinson
9f4a586f12 util/probe: Save strrchr() ret val to const data ptr
With glibc-2.43 implementing the C23 standard, strrchr() now returns
"const char *" when its first argument is "const char *".

The fix is update all pointers receiving strrchr()'s return value so
that they are now "const char *" instead of "char *".

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-02-26 15:54:04 +01:00
Nicholas Vinson
b71ae6db28 osdep/linux/ofpath: Correct path_size calculation
path_size is computed in part by taking the size of the format string.
However, the format string contains conversion specifiers. These
conversion specifiers are included in the size calculation resulting in
a size calculation that is larger than it needs to be. This patch
corrects that error by removing the conversion specifiers when computing
path_size.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-02-26 15:51:56 +01:00
Nicholas Vinson
675d858103 osdep/linux/ofpath: Update strstr() calls
With C23, strstr() returns a "const char *" if its first argument is
"const char *", and these changes are implemented in glibc-2.43.

As a result, the first strstr() call in check_sas() now returns a "const
char *" instead of "char *" because sysfs_path is a "const char *". This
triggers a "discards qualifiers" warning, that is later promoted to an
error and ultimately causes the build to fail.

To fix the issue, this patch converts "ed", the pointer that stores
strstr()'s return value, to a "const char *". Removes the xstrdup()
call and cleans up the rest of the function by updating the *printf()
calls and using pointer arithmetic to compute lengths instead of strlen().

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-02-26 15:43:11 +01:00
Wanda Phinode
170221b355 mmap/mmap: Fix integer overflow in binary search
The integer overflow triggered for simple masks in the "badram"
command, such as "badram 0x0000000012340000,0xfffffffffffffff8".
This resulted in an infinite loop, locking up the machine.

Signed-off-by: Wanda Phinode <wanda@phinode.net>
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-02-11 17:24:34 +01:00
Daniel Kiper
eaa3b8f0f9 Bump version to 2.15
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-14 20:05:13 +01:00
Daniel Kiper
d38d6a1a9b Release 2.14
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-2.14
2026-01-14 16:46:57 +01:00
Daniel Kiper
35bfd6c478 build: Add grub-core/tests/crypto_cipher_mode_vectors.h file to EXTRA_DIST
This file was not added to EXTRA_DIST during test creation.

Fixes: 51ebc6f67 (tests: Add functional tests for ecb/cbc helpers)

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
2026-01-14 14:28:37 +01:00
Radoslav Kolev
ac042f3f58 configure: Print a more helpful error if autoconf-archive is not installed
... because an undefined macro receives another macro as parameter and
autoconf is not smart enough to produce a useful error message.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-13 15:37:09 +01:00
Avnish Chouhan
e37d021583 kern/ieee1275/openfw: Add a check for invalid partition number
The grub_strtoul() may fail in several scenarios like invalid input,
overflow, etc. Lack of proper check may lead to unexpected failures
in the code further.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-13 15:35:23 +01:00
Sudhakar Kuppusamy
f94eae0f8d grub-mkimage: Do not generate empty SBAT metadata
When creating core.elf with SBAT the grub-mkimage does not check if
an SBAT metadata file contains at least an SBAT header or not. It leads to
adding an empty SBAT ELF note for PowerPC and the .sbat section for EFI.
Fix this by checking the SBAT metadata file size against the SBAT header
size before adding SBAT contents to the ELF note or .sbat section.

Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-08 19:51:29 +01:00
Yao Zi
1aa0dd0c04 configure: Defer check for -mcmodel=large until PIC/PIE checks are done
On RISC-V, large code model is only compatible with position-depedent
code. However, the configure script checks availability of -mcmodel=large
before determining whether PIC/PIE is enabled, and disable them.

This is problematic with toolchains that enable PIE by default, where
check for -mcmodel=large will always fail with,

  cc1: sorry, unimplemented: code model 'large' with '-fPIC'

and -mcmodel=medany will be silently used instead, causing relocation
failures at runtime with some memory layouts since -mcmodel=medany
requires all data and code to stay within a contiguous 4 GiB range.

Let's defer the check for -mcmodel=large until PIC/PIE is ensured disabled.

Fixes: f1957dc8a3 (RISC-V: Add to build system)

Reported-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Yao Zi <me@ziyao.cc>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-08 19:48:59 +01:00
Sudhakar Kuppusamy
ff1edd9752 util/grub-mkimagexx: Stop generating unaligned appended signatures
When creating the core image with an unaligned appended signature size,
e.g. 479, for PowerPC, the grub-mkimage aligns the appended signature
size to a multiple of 4 bytes, but it does not add a padding needed to
align to multiple of 4 bytes appended signature size in the appended
signature ELF note. Therefore, after signing and installing this core
image, the firmware tries to read the magic string "~Module signature
appended~" from the appended signature ELF note but gets the partial
magic string like "Module signature appended~". It leads to the appended
signature magic string match failure.

Example:
  grub-mkimage -O powerpc-ieee1275 -o core.elf -p /grub -x \
    kernel.der --appended-signature-size 479 ...

  sign-file SHA256 ./grub.key ./grub.pem ./core.elf ./core.elf.signed

Without padding: hexdump -C ./core.elf.signed
  ...
  00383550  00 00 00 13 00 00 01 e0  41 53 69 67 41 70 70 65  |........ASigAppe|
  00383560  6e 64 65 64 2d 53 69 67  6e 61 74 75 72 65 00 00  |nded-Signature..|
  ...
  003836f0  dd 47 cd ed 02 8e 15 af  5b 09 2e 44 6f da 67 88  |.G......[..Do.g.|
  00383700  4d 94 17 31 26 9d 47 95  d8 7c ad 36 00 d2 9c 53  |M..1&.G..|.6...S|
  00383710  20 e0 af 60 78 cd 22 e6  ed 45 1e b1 e7 7e cf b5  | ..`x."..E...~..|
  00383720  fc 58 ec df 1b ab 7a 00  00 02 00 00 00 00 00 00  |.X....z.........|
  00383730  00 01 b7 7e 4d 6f 64 75  6c 65 20 73 69 67 6e 61  |...~Module signa|
  00383740  74 75 72 65 20 61 70 70  65 6e 64 65 64 7e 0a     |ture appended~.|

Fix this by adding a padding required to align appended signature size in the
appended signature ELF note to multiple of 4 bytes.

Example:
  grub-mkimage -O powerpc-ieee1275 -o core.elf -p /grub -x \
    kernel.der --appended-signature-size 479 ...

  sign-file SHA256 ./grub.key ./grub.pem ./core.elf ./core.elf.signed

With padding: hexdump -C ./core.elf.signed
  ...
  00137460  62 00 00 00 00 00 00 13  00 00 01 ec 41 53 69 67  |b...........ASig|
  00137470  41 70 70 65 6e 64 65 64  2d 53 69 67 6e 61 74 75  |Appended-Signatu|
  ...
  00137610  b7 07 cd b6 c8 ca 9a 5b  7c 13 8c 75 1d 1c 54 81  |.......[|..u..T.|
  00137620  7f c4 9a 8b bd d7 73 8d  2f 7d d2 e6 d1 3c 52 a9  |......s./}...<R.|
  00137630  4e 0b e5 24 ba 0a 82 aa  8e c5 86 fa e1 19 50 ec  |N..$..........P.|
  00137640  9f a7 9a ed e5 ed 13 35  00 00 02 00 00 00 00 00  |.......5........|
  00137650  00 00 01 c2 7e 4d 6f 64  75 6c 65 20 73 69 67 6e  |....~Module sign|
  00137660  61 74 75 72 65 20 61 70  70 65 6e 64 65 64 7e 0a  |ature appended~.|

Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-08 19:31:37 +01:00
Srish Srinivasan
51ebc6f677 tests: Add functional tests for ecb/cbc helpers
Test the following helper functions using AES with 128, 192, and
256 bit keys:
  - grub_crypto_ecb_encrypt(),
  - grub_crypto_ecb_decrypt(),
  - grub_crypto_cbc_encrypt(),
  - grub_crypto_cbc_decrypt().

Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Glenn Washburn <development@efficientek.com>
2026-01-08 19:28:50 +01:00
Srish Srinivasan
caaf50b9af osdep/aros/hostdisk: Fix use-after-free bug during MsgPort deletion
... in function grub_util_fd_open() when creation of an I/O request or
opening a device fails. The "ret", the file descriptor, will be freed
before its associated MsgPort is deleted resulting in a use-after-free
condition.

Fix this issue by freeing "ret" after its associated MsgPort has been
deleted.

Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2026-01-08 19:12:20 +01:00
Ingo Breßler
18f08826f9 kern/efi/sb: Enable loading GRUB_FILE_TYPE_CRYPTODISK_ENCRYPTION_KEY and GRUB_FILE_TYPE_CRYPTODISK_DETACHED_HEADER
... file types when UEFI Secure Boot is enabled. Otherwise it is not
possible to load cryptodisk encryption key or detached header.

Fixes: https://savannah.gnu.org/bugs/?65889

Signed-off-by: Ingo Breßler <dev@ingobressler.net>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
2026-01-08 19:09:26 +01:00
Radoslav Kolev
25b7f6b934 blsuki: Error out if unexpected arguments are supplied
This can be especially helpful, as the Fedora version of the blscfg
actually made use of positional arguments, but current implementation
switched to parameters. For example what used to be "blscfg (hd0,gpt2)/..."
now should be "blscfg --path (hd0,gpt2)/...)". In case of old configs/scripts
still supplying positional arguments we will now error out instead of just
ignoring them and falling back to defaults silently.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:47 +01:00
Radoslav Kolev
cfeff5e071 blsuki: Fix default location in comment to /loader/entries
Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:47 +01:00
Radoslav Kolev
d19a74a17f blsuki: Use specified device in case of fallback
Currently if the fallback option is enabled and no files are found in
the specified directory it searches the default (loader/conf) directory
but always in the device set by the root environment variable. It makes
more sense and also the comment in the code implies, that the default
directory on the current device should be searched.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Radoslav Kolev
242816e93f blsuki: Fix position of DIR parameter in blscfg command summary
The DIR parameter in the example should be specified after the -p|--path option
instead of after -f|fallback.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Radoslav Kolev
b733d9d6dc blsuki: Fix typo in entry parameter description
Change "specificUKII entries" to "specific UKI entries".

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Khalid Ali
0f0899c329 efi: Fix several memory leaks of UEFI handles
Fix possible and absolute memory leaks of "handles"
returned by grub_efi_locate_handle() using grub_malloc().

Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Andreas K. Hüttel
c477a95519 util/grub-install: Allow recursive copying of theme dirs
grub-install allows to pass a parameter to install a theme in the boot partition.
This works fine for the default starfield theme. However, in general themes can
contain subdirectories, as, e.g. "icons", and these are not copied by grub-install.
As a result, the icons are missing on the screen.

Fix this by simple recursive copying.

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Heinrich Schuchardt
f551d3de24 commands/efi/lsefisystab: Recognize EFI_MEMORY_ATTRIBUTES_TABLE_GUID and EFI_TCG2_FINAL_EVENTS_TABLE_GUID
Let the lsefisystab command recognize the following table GUIDs:
  - EFI_MEMORY_ATTRIBUTES_TABLE_GUID,
  - EFI_TCG2_FINAL_EVENTS_TABLE_GUID.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Glenn Washburn
ee283b14ae tests/util/grub-fs-tester: Use CSMACINTOSH encoding instead of macroman
From Debian 12 to 13, recode had a major overhaul and now does not support
the macroman encoding. Its unclear if this is a bug or intentional.
Regardless, use the CSMACINTOSH encoding instead as MacRoman and it are
aliases and CSMACINTOSH is supported on both Debian 12 and 13.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Luca Boccassi
9b2c8ae5d2 commands/bli: Set UINT32_MAX in LoaderTpm2ActivePcrBanks if TPM2 present but no banks protocol
The implementation in sd-boot was changed to return UINT32_MAX when
the EFI environment detects a working TPM2, but with an older firmware
that doesn't implement the protocol to get the list of active banks.
This allows distinguishing with the case where there is no working TPM2,
in which case userspace just gives up, and instead lets userspace try to
figure it out later.

Fixes: f326c5c47 (commands/bli: Set LoaderTpm2ActivePcrBanks runtime variable)

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Sridhar Markonda
c0669af6a8 script/execute: Add a NULL check after grub_calloc() call
... in gettext_append() to handle allocation errors. This prevents NULL
pointer dereference and stops crashes during string translation.

Signed-off-by: Sridhar Markonda <sridharm@linux.ibm.com>
Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Avnish Chouhan
02cae1a357 disk/ieee1275/ofdisk: Fix memory leaks
In case of an overflow "p" and "p->grub_devpath" will not be freed.
Fix both issues.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
2025-12-21 16:41:46 +01:00
Avnish Chouhan
09c512b8fa efiemu/loadcore: Add grub_calloc() failure check
Add a failure check after grub_calloc() call. If grub_calloc()
fails, e.g., due to memory allocation failure, it returns NULL.
Then using grub_efiemu_elfsyms, which will be NULL, later will
result in a NULL pointer dereference.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
George Hu
641646376b lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding
Switch from "xorq %rax, %rax" to "xorl %eax, %eax". In 64-bit mode
zeroing EAX implicitly clears RAX and the 32-bit form encodes are one
byte smaller while keeping identical semantics.

Signed-off-by: George Hu <integral@archlinux.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:46 +01:00
Glenn Washburn
d07ebd11d6 tests: Fix nonnative tests labeled as native
The tests asn1_test and tpm2_key_protector_test should be labelled as
nonnative tests because they run tests on the target. A clue that
indicates a nonnative test is the usage of the grub-shell script.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:45 +01:00
Glenn Washburn
a90ccbac67 INSTALL: Add note that the GNU Autoconf Archive may be needed
As of 1a5417f39a (configure: Check linker for --image-base support),
the GNU Autoconf Archive is now required to bootstrap GRUB.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-12-21 16:41:45 +01:00
Glenn Washburn
29f3131a36 INSTALL: Fix a grammatical error
Also, add more documentation mentioning that the tests require
a "specially crafted environment" to run. Just running as root
is not enough.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-21 20:35:13 +01:00
Glenn Washburn
0a31df119d bootstrap: Condense and simplify LINGUAS generation
Remove unnecessary subshells. Loop over autogenerated po files only once.
Use existing LINGUAS created by bootstrap instead of finding po files
again.

Add wget as a soft requirement now that we are using bootstrap's code
for updating translation files. This should only be needed if updated
translations are desired, which is the default. There should be older
translation files already, and wget is not necessary if those will
suffice.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-21 20:31:55 +01:00
Glenn Washburn
0dfec2945a bootstrap: Migrate linguas.sh into bootstrap.conf
Bootstrap has infrastructure for downloading/updating project po files
and generating the LINGUAS file. It uses wget instead of rsync, but
provides the same functionality, namely that only po files that have
a modification date before the corresponding one on the server will get
redownloaded. Bootstrap creates a pristine copy of the po files in
po/.reference, so update .gitignore to ignore that directory.

Bootstrap also creates the po/LINGUAS file, but it does not know to add
in GRUB's autogenerated po files. So move that code from linguas.sh into
the bootstrap epilogue.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-21 20:30:11 +01:00
Glenn Washburn
8a6ea7ab7b bootstrap: Run linguas.sh in bootstrap epilogue
Heretofore, linguas.sh had to be run by the user and a common mistake
made when building GRUB was to not run the command. By adding it to
the bootstrap epilogue it will by default get run at the end of the
bootstrap script. The user no longer needs to remember to run it.
If the --skip-po option is passed to bootstrap, do not run linguas.sh.
This allows for bootstrap to be run without updating the translations,
which might be desired in the future if we track po files so that
translations can be used as they were at time of release.

Update INSTALL file to reflect that it is no longer necessary to run
linguas.sh. Also, fix a list numbering error.

Fixes: 9f73ebd49b (* INSTALL: Document linguas.sh.)

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-21 20:27:25 +01:00
Avnish Chouhan
cb811bdf05 normal/cmdline: Add grub_calloc() failure check and fix hist_lines state loss
If grub_calloc() fails hist_lines becomes NULL. It means we loose the
reference to the previously allocated hist_lines and leak memory. With
this change on failure hist_lines still points to the old memory. So,
no leak, no state corruption.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-21 20:15:38 +01:00
Michael Chang
8a850f47d0 blsuki: Fix grub_errno leakage in blsuki_is_default_entry()
The grub_strtol() call in blsuki_is_default_entry() can set grub_errno
to either GRUB_ERR_BAD_NUMBER or GRUB_ERR_OUT_OF_RANGE if the input
string is invalid or out of range.

This grub_errno value is currently left uncleared, which can lead to
unexpected behavior in subsequent functions that rely on checking
current state of grub_errno.

Clear grub_errno unconditionally when grub_strtol() reports error so
that we can plug the leak.

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-20 17:46:08 +01:00