]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-boot: don't always log NX_COMPAT info
authorFelix Pehla <29adc1fd92@gmail.com>
Thu, 21 Aug 2025 17:06:07 +0000 (19:06 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 25 Aug 2025 12:40:54 +0000 (13:40 +0100)
Commit 70b7e03 introduced 3 calls to log_debug() about the presence or
absence of NX_COMPAT support. Since sd-boot does not yet have the
ability to only print messages above a certain loglevel, these will
always be printed, even on top of the configured splash screen. This
commit removes the log_debug() call after a success and only prints
those for missing firmware support if the UEFI should support them in
the first place (i.e. starting with version 2.10).

src/boot/linux.c

index f18d91e9e42622aedc959efe5d3ed5f31fb02a4c..92a2b0afc5ce6aa57e31013937f652778e8d6f82 100644 (file)
@@ -132,7 +132,10 @@ static EFI_STATUS kernel_set_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) {
 
         err = BS->LocateProtocol(MAKE_GUID_PTR(EFI_MEMORY_ATTRIBUTE_PROTOCOL), NULL, (void **) &memory_proto);
         if (err != EFI_SUCCESS) {
-                log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support.");
+                /* only log if the UEFI should have support in the first place (version >=2.10) */
+                if (ST->Hdr.Revision >= ((2U << 16) | 100U))
+                        log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support.");
+
                 return EFI_SUCCESS; /* ignore if firmware lacks support */
         }
 
@@ -144,8 +147,6 @@ static EFI_STATUS kernel_set_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) {
         if (err != EFI_SUCCESS)
                 return log_error_status(err, "Cannot make kernel image executable: %m");
 
-        log_debug("Changed kernel image to read-only for NX_COMPAT support.");
-
         return EFI_SUCCESS;
 }
 
@@ -155,7 +156,10 @@ static EFI_STATUS kernel_clear_nx(EFI_PHYSICAL_ADDRESS addr, uint64_t length) {
 
         err = BS->LocateProtocol(MAKE_GUID_PTR(EFI_MEMORY_ATTRIBUTE_PROTOCOL), NULL, (void **) &memory_proto);
         if (err != EFI_SUCCESS) {
-                log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support.");
+                /* only log if the UEFI should have support in the first place (version >=2.10) */
+                if (ST->Hdr.Revision >= ((2U << 16) | 100U))
+                        log_debug("No EFI_MEMORY_ATTRIBUTE_PROTOCOL found, skipping NX_COMPAT support.");
+
                 return EFI_SUCCESS; /* ignore if firmware lacks support */
         }