diff --git a/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch b/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch new file mode 100644 index 0000000..61ffbdc --- /dev/null +++ b/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch @@ -0,0 +1,495 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 29 Aug 2024 12:11:11 -0600 +Subject: [PATCH] efi/api.h: include missing __grub_efi_api macros on EFI + functions + +Signed-off-by: Peter Jones +Signed-off-by: Leo Sandoval +--- + grub-core/loader/efi/chainloader.c | 2 +- + include/grub/efi/api.h | 34 +++++++++++++------------- + include/grub/efi/dhcp.h | 42 ++++++++++++++++---------------- + include/grub/efi/edid.h | 2 +- + include/grub/efi/http.h | 12 ++++----- + include/grub/efi/pci.h | 50 +++++++++++++++++++------------------- + 6 files changed, 71 insertions(+), 71 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 5cd6f6a59..460a44041 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -555,7 +555,7 @@ handle_image (struct grub_secureboot_chainloader_context *load_context) + grub_uint32_t buffer_size; + int found_entry_point = 0; + int rc; +- grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); ++ grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); + + b = grub_efi_system_table->boot_services; + +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 2376182d7..5047ecf28 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -1094,11 +1094,11 @@ typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; + struct grub_efi_service_binding; + + typedef grub_efi_status_t +-(*grub_efi_service_binding_create_child) (struct grub_efi_service_binding *this, ++(__grub_efi_api *grub_efi_service_binding_create_child) (struct grub_efi_service_binding *this, + grub_efi_handle_t *child_handle); + + typedef grub_efi_status_t +-(*grub_efi_service_binding_destroy_child) (struct grub_efi_service_binding *this, ++(__grub_efi_api *grub_efi_service_binding_destroy_child) (struct grub_efi_service_binding *this, + grub_efi_handle_t *child_handle); + + typedef struct grub_efi_service_binding +@@ -1754,12 +1754,12 @@ typedef struct grub_efi_pxe_mode + typedef struct grub_efi_pxe + { + grub_uint64_t rev; +- grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); ++ grub_efi_status_t (__grub_efi_api *start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); + void (*stop) (void); +- grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *dhcp) (struct grub_efi_pxe *this, + grub_efi_boolean_t sort_offers); + void (*discover) (void); +- grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *mtftp) (struct grub_efi_pxe *this, + grub_efi_pxe_base_code_tftp_opcode_t operation, + void *buffer_ptr, + grub_efi_boolean_t overwrite, +@@ -1775,7 +1775,7 @@ typedef struct grub_efi_pxe + void (*setipfilter) (void); + void (*arp) (void); + void (*setparams) (void); +- grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *set_station_ip) (struct grub_efi_pxe *this, + grub_efi_pxe_ip_address_t *new_station_ip, + grub_efi_pxe_ip_address_t *new_subnet_mask); + void (*setpackets) (void); +@@ -2054,21 +2054,21 @@ typedef enum grub_efi_ip4_config2_data_type grub_efi_ip4_config2_data_type_t; + + struct grub_efi_ip4_config2_protocol + { +- grub_efi_status_t (*set_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *set_data) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_uintn_t data_size, + void *data); + +- grub_efi_status_t (*get_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *get_data) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_uintn_t *data_size, + void *data); + +- grub_efi_status_t (*register_data_notify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *register_data_notify) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_event_t event); + +- grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_event_t event); + }; +@@ -2126,21 +2126,21 @@ typedef enum grub_efi_ip6_config_data_type grub_efi_ip6_config_data_type_t; + + struct grub_efi_ip6_config_protocol + { +- grub_efi_status_t (*set_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *set_data) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_uintn_t data_size, + void *data); + +- grub_efi_status_t (*get_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *get_data) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_uintn_t *data_size, + void *data); + +- grub_efi_status_t (*register_data_notify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *register_data_notify) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_event_t event); + +- grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_event_t event); + }; +@@ -2191,17 +2191,17 @@ typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_add + + struct grub_efi_memory_attribute_protocol + { +- grub_efi_status_t (*get_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *get_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, + grub_efi_uint64_t *attributes); +- grub_efi_status_t (*set_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *set_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, + grub_efi_uint64_t attributes); +- grub_efi_status_t (*clear_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *clear_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, +diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h +index fdb88eb81..d996716e4 100644 +--- a/include/grub/efi/dhcp.h ++++ b/include/grub/efi/dhcp.h +@@ -123,7 +123,7 @@ struct grub_efi_dhcp4_config_data { + grub_efi_uint32_t request_try_count; + grub_efi_uint32_t *request_timeout; + grub_efi_ipv4_address_t client_address; +- grub_efi_status_t (*dhcp4_callback) ( ++ grub_efi_status_t (__grub_efi_api *dhcp4_callback) ( + grub_efi_dhcp4_protocol_t *this, + void *context, + grub_efi_dhcp4_state_t current_state, +@@ -153,27 +153,27 @@ struct grub_efi_dhcp4_mode_data { + typedef struct grub_efi_dhcp4_mode_data grub_efi_dhcp4_mode_data_t; + + struct grub_efi_dhcp4_protocol { +- grub_efi_status_t (*get_mode_data) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *get_mode_data) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_mode_data_t *dhcp4_mode_data); +- grub_efi_status_t (*configure) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *configure) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_config_data_t *dhcp4_cfg_data); +- grub_efi_status_t (*start) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *start) (grub_efi_dhcp4_protocol_t *this, + grub_efi_event_t completion_event); +- grub_efi_status_t (*renew_rebind) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *renew_rebind) (grub_efi_dhcp4_protocol_t *this, + grub_efi_boolean_t rebind_request, + grub_efi_event_t completion_event); +- grub_efi_status_t (*release) (grub_efi_dhcp4_protocol_t *this); +- grub_efi_status_t (*stop) (grub_efi_dhcp4_protocol_t *this); +- grub_efi_status_t (*build) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *release) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *stop) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *build) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_packet_t *seed_packet, + grub_efi_uint32_t delete_count, + grub_efi_uint8_t *delete_list, + grub_efi_uint32_t append_count, + grub_efi_dhcp4_packet_option_t *append_list[], + grub_efi_dhcp4_packet_t **new_packet); +- grub_efi_status_t (*transmit_receive) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *transmit_receive) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_transmit_receive_token_t *token); +- grub_efi_status_t (*parse) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *parse) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_packet_t *packet, + grub_efi_uint32_t *option_count, + grub_efi_dhcp4_packet_option_t *packet_option_list[]); +@@ -289,7 +289,7 @@ struct grub_efi_dhcp6_mode_data { + typedef struct grub_efi_dhcp6_mode_data grub_efi_dhcp6_mode_data_t; + + struct grub_efi_dhcp6_config_data { +- grub_efi_status_t (*dhcp6_callback) (grub_efi_dhcp6_protocol_t this, ++ grub_efi_status_t (__grub_efi_api *dhcp6_callback) (grub_efi_dhcp6_protocol_t this, + void *context, + grub_efi_dhcp6_state_t current_state, + grub_efi_dhcp6_event_t dhcp6_event, +@@ -308,33 +308,33 @@ struct grub_efi_dhcp6_config_data { + typedef struct grub_efi_dhcp6_config_data grub_efi_dhcp6_config_data_t; + + struct grub_efi_dhcp6_protocol { +- grub_efi_status_t (*get_mode_data) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *get_mode_data) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_mode_data_t *dhcp6_mode_data, + grub_efi_dhcp6_config_data_t *dhcp6_config_data); +- grub_efi_status_t (*configure) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *configure) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_config_data_t *dhcp6_cfg_data); +- grub_efi_status_t (*start) (grub_efi_dhcp6_protocol_t *this); +- grub_efi_status_t (*info_request) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *start) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *info_request) (grub_efi_dhcp6_protocol_t *this, + grub_efi_boolean_t send_client_id, + grub_efi_dhcp6_packet_option_t *option_request, + grub_efi_uint32_t option_count, + grub_efi_dhcp6_packet_option_t *option_list[], + grub_efi_dhcp6_retransmission_t *retransmission, + grub_efi_event_t timeout_event, +- grub_efi_status_t (*reply_callback) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *reply_callback) (grub_efi_dhcp6_protocol_t *this, + void *context, + grub_efi_dhcp6_packet_t *packet), + void *callback_context); +- grub_efi_status_t (*renew_rebind) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *renew_rebind) (grub_efi_dhcp6_protocol_t *this, + grub_efi_boolean_t rebind_request); +- grub_efi_status_t (*decline) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *decline) (grub_efi_dhcp6_protocol_t *this, + grub_efi_uint32_t address_count, + grub_efi_ipv6_address_t *addresses); +- grub_efi_status_t (*release) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *release) (grub_efi_dhcp6_protocol_t *this, + grub_efi_uint32_t address_count, + grub_efi_ipv6_address_t *addresses); +- grub_efi_status_t (*stop) (grub_efi_dhcp6_protocol_t *this); +- grub_efi_status_t (*parse) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *stop) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *parse) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_packet_t *packet, + grub_efi_uint32_t *option_count, + grub_efi_dhcp6_packet_option_t *packet_option_list[]); +diff --git a/include/grub/efi/edid.h b/include/grub/efi/edid.h +index 43c0c4372..ac1b8e2fd 100644 +--- a/include/grub/efi/edid.h ++++ b/include/grub/efi/edid.h +@@ -33,7 +33,7 @@ + struct grub_efi_edid_override; + + typedef grub_efi_status_t +-(*grub_efi_edid_override_get_edid) (struct grub_efi_edid_override *this, ++(__grub_efi_api *grub_efi_edid_override_get_edid) (struct grub_efi_edid_override *this, + grub_efi_handle_t *childhandle, + grub_efi_uint32_t *attributes, + grub_efi_uintn_t *edidsize, +diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h +index ad164ba19..242d001b6 100644 +--- a/include/grub/efi/http.h ++++ b/include/grub/efi/http.h +@@ -188,27 +188,27 @@ typedef struct { + + struct grub_efi_http { + grub_efi_status_t +- (*get_mode_data) (struct grub_efi_http *this, ++ (__grub_efi_api *get_mode_data) (struct grub_efi_http *this, + grub_efi_http_config_data_t *http_config_data); + + grub_efi_status_t +- (*configure) (struct grub_efi_http *this, ++ (__grub_efi_api *configure) (struct grub_efi_http *this, + grub_efi_http_config_data_t *http_config_data); + + grub_efi_status_t +- (*request) (struct grub_efi_http *this, ++ (__grub_efi_api *request) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*cancel) (struct grub_efi_http *this, ++ (__grub_efi_api *cancel) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*response) (struct grub_efi_http *this, ++ (__grub_efi_api *response) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*poll) (struct grub_efi_http *this); ++ (__grub_efi_api *poll) (struct grub_efi_http *this); + }; + typedef struct grub_efi_http grub_efi_http_t; + +diff --git a/include/grub/efi/pci.h b/include/grub/efi/pci.h +index b17245549..a90f61042 100644 +--- a/include/grub/efi/pci.h ++++ b/include/grub/efi/pci.h +@@ -48,7 +48,7 @@ typedef enum + struct grub_efi_pci_io; + + typedef grub_efi_status_t +-(*grub_efi_pci_io_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t offset, +@@ -56,7 +56,7 @@ typedef grub_efi_status_t + void *buffer); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_config_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_config_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint32_t offset, + grub_efi_uintn_t count, +@@ -113,7 +113,7 @@ typedef enum + grub_efi_pci_io_attribute_operation_t; + + typedef grub_efi_status_t +-(*grub_efi_pci_io_poll_io_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_poll_io_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t bar_ndex, + grub_efi_uint64_t offset, +@@ -123,7 +123,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_copy_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_copy_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t dest_bar_index, + grub_efi_uint64_t dest_offset, +@@ -132,7 +132,7 @@ typedef grub_efi_status_t + grub_efi_uintn_t count); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_map_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_map_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_operation_t operation, + void *host_address, + grub_efi_uintn_t *number_of_bytes, +@@ -140,11 +140,11 @@ typedef grub_efi_status_t + void **mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_unmap_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_unmap_t) (struct grub_efi_pci_io *this, + void *mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_allocate_buffer_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_allocate_buffer_t) (struct grub_efi_pci_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -152,7 +152,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_free_buffer_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_free_buffer_t) (struct grub_efi_pci_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -160,29 +160,29 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_flush_t) (struct grub_efi_pci_io *this); ++(__grub_efi_api *grub_efi_pci_io_flush_t) (struct grub_efi_pci_io *this); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_get_location_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_get_location_t) (struct grub_efi_pci_io *this, + grub_efi_uintn_t *segment_number, + grub_efi_uintn_t *bus_number, + grub_efi_uintn_t *device_number, + grub_efi_uintn_t *function_number); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_attribute_operation_t operation, + grub_efi_uint64_t attributes, + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_get_bar_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_get_bar_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t *supports, + void **resources); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_set_bar_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_set_bar_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_uint64_t attributes, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t *offset, +@@ -212,12 +212,12 @@ struct grub_efi_pci_root_io; + + typedef struct + { +- grub_efi_status_t(*read) (struct grub_efi_pci_root_io *this, ++ grub_efi_status_t(__grub_efi_api *read) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uintn_t count, + void *buffer); +- grub_efi_status_t(*write) (struct grub_efi_pci_root_io *this, ++ grub_efi_status_t(__grub_efi_api *write) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uintn_t count, +@@ -237,7 +237,7 @@ typedef enum + grub_efi_pci_root_io_operation_t; + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_poll_io_mem_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_poll_io_mem_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uint64_t mask, +@@ -246,7 +246,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_copy_mem_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_copy_mem_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t dest_offset, + grub_efi_uint64_t src_offset, +@@ -254,7 +254,7 @@ typedef grub_efi_status_t + + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_map_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_map_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_root_io_operation_t operation, + void *host_address, + grub_efi_uintn_t *number_of_bytes, +@@ -262,11 +262,11 @@ typedef grub_efi_status_t + void **mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_unmap_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_unmap_t) (struct grub_efi_pci_root_io *this, + void *mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_allocate_buffer_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_allocate_buffer_t) (struct grub_efi_pci_root_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -274,26 +274,26 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_free_buffer_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_free_buffer_t) (struct grub_efi_pci_root_io *this, + grub_efi_uintn_t pages, + void **host_address); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_flush_t) (struct grub_efi_pci_root_io *this); ++(__grub_efi_api *grub_efi_pci_root_io_flush_t) (struct grub_efi_pci_root_io *this); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_get_attributes_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_get_attributes_t) (struct grub_efi_pci_root_io *this, + grub_efi_uint64_t *supports, + void **resources); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_set_attributes_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_set_attributes_t) (struct grub_efi_pci_root_io *this, + grub_efi_uint64_t attributes, + grub_efi_uint64_t *offset, + grub_efi_uint64_t *length); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_configuration_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_configuration_t) (struct grub_efi_pci_root_io *this, + void **resources); + + struct grub_efi_pci_root_io { diff --git a/0274-grub-core-net-arp.c-fix-variable-name.patch b/0274-grub-core-net-arp.c-fix-variable-name.patch new file mode 100644 index 0000000..a94167c --- /dev/null +++ b/0274-grub-core-net-arp.c-fix-variable-name.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 28 Aug 2024 13:37:42 -0600 +Subject: [PATCH] grub-core/net/arp.c: fix variable name + +Signed-off-by: Leo Sandoval +--- + grub-core/net/arp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c +index 8bf0a06e1..7adeb7447 100644 +--- a/grub-core/net/arp.c ++++ b/grub-core/net/arp.c +@@ -159,7 +159,7 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, + sender_addr.option = 0; + target_addr.option = 0; + +- grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); ++ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln); + tmp_ptr += pln; + + grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); diff --git a/0275-load-EFI-commands-inside-test-expressions.patch b/0275-load-EFI-commands-inside-test-expressions.patch new file mode 100644 index 0000000..137890e --- /dev/null +++ b/0275-load-EFI-commands-inside-test-expressions.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 4 Sep 2024 13:25:23 -0600 +Subject: [PATCH] load EFI commands inside test expressions + +These two commands may fail interrumping the normal boot process, +so placing these inside test expressions is a safer approach. + +Resolves: #2305291 +Suggested-by: Kan-Ru Chen: +Signed-off-by: Leo Sandoval +--- + util/grub.d/25_bli.in | 4 +++- + util/grub.d/30_uefi-firmware.in | 3 +-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/util/grub.d/25_bli.in b/util/grub.d/25_bli.in +index 26e27a019..00a8d7159 100644 +--- a/util/grub.d/25_bli.in ++++ b/util/grub.d/25_bli.in +@@ -19,6 +19,8 @@ set -e + + cat << EOF + if [ "\$grub_platform" = "efi" ]; then +- insmod bli ++ if [ ! insmod bli ]; then ++ echo "bli module not available" ++ fi + fi + EOF +diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in +index 1c2365ddb..1ef31e08f 100644 +--- a/util/grub.d/30_uefi-firmware.in ++++ b/util/grub.d/30_uefi-firmware.in +@@ -32,8 +32,7 @@ gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 + + cat << EOF + if [ "\$grub_platform" = "efi" ]; then +- fwsetup --is-supported +- if [ "\$?" = 0 ]; then ++ if [ fwsetup --is-supported ]; then + menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { + fwsetup + } diff --git a/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch b/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch new file mode 100644 index 0000000..0942ea4 --- /dev/null +++ b/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 25 Sep 2024 17:23:33 +0200 +Subject: [PATCH] efi/loader: Check if NX is required in grub_efi_linux_boot() + +Call grub_efi_check_nx_required() passing it nx_required to +assign the correct value + +Signed-off-by: Nicolas Frayer +--- + grub-core/loader/efi/linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 0d1804b602da..5889e3f36f89 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -236,6 +236,7 @@ grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, + grub_dprintf ("linux", "kernel_address: %p handover_offset: %p params: %p\n", + (void *)k_address, (void *)h_offset, k_params); + ++ grub_efi_check_nx_required(&nx_required); + + if (nx_required && !nx_supported) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel does not support NX loading required by policy")); diff --git a/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch b/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch new file mode 100644 index 0000000..02a6417 --- /dev/null +++ b/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 3 Oct 2024 12:26:07 +0200 +Subject: [PATCH] Stop grub.efi from always printing "dynamic_load_symbols + %p\n" during boot + +Commit 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.") +added some debug prints to help with running gdb against grub. + +Besides adding a new grub_dl_print_gdb_info () function which uses +`grub_qdprintf ("gdb", ...);` it also adds a new grub_efi_print_gdb_info () +call to grub_efi_init (). + +grub_efi_print_gdb_info () is intended for the gdbinfo command and uses +a non debug grub_printf () call leading to grub now always printing this +message during boot breaking flicker-free boot. + +Add a new "debug" parameter to grub_efi_print_gdb_info () and use +`grub_qdprintf ("gdb", ...);` when this is set to silence the printing +done from grub_efi_init () when debugging is not enabled. + +Fixes: 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.") +Signed-off-by: Hans de Goede +--- + grub-core/kern/efi/debug.c | 2 +- + grub-core/kern/efi/init.c | 2 +- + include/grub/efi/debug.h | 7 +++++-- + 3 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/efi/debug.c b/grub-core/kern/efi/debug.c +index 5d2ab1a36ff4..5ac194fc8f46 100644 +--- a/grub-core/kern/efi/debug.c ++++ b/grub-core/kern/efi/debug.c +@@ -26,7 +26,7 @@ grub_cmd_gdbinfo (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) + { +- grub_efi_print_gdb_info (); ++ grub_efi_print_gdb_info (false); + return 0; + } + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index d35d69747342..ce8a7fe7122f 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -157,7 +157,7 @@ grub_efi_init (void) + grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL); + + grub_efi_env_init (); +- grub_efi_print_gdb_info (); ++ grub_efi_print_gdb_info (true); + grub_efidisk_init (); + + grub_efi_register_debug_commands (); +diff --git a/include/grub/efi/debug.h b/include/grub/efi/debug.h +index c2d2a03b06f1..961e591afa3e 100644 +--- a/include/grub/efi/debug.h ++++ b/include/grub/efi/debug.h +@@ -27,7 +27,7 @@ + void grub_efi_register_debug_commands (void); + + static inline void +-grub_efi_print_gdb_info (void) ++grub_efi_print_gdb_info (bool debug) + { + grub_addr_t text; + +@@ -35,7 +35,10 @@ grub_efi_print_gdb_info (void) + if (!text) + return; + +- grub_printf ("dynamic_load_symbols %p\n", (void *)text); ++ if (debug) ++ grub_qdprintf ("gdb", "dynamic_load_symbols %p\n", (void *)text); ++ else ++ grub_printf ("dynamic_load_symbols %p\n", (void *)text); + } + + #endif /* ! GRUB_EFI_DEBUG_HEADER */ diff --git a/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch b/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch new file mode 100644 index 0000000..20d2de3 --- /dev/null +++ b/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Herrenschmidt +Date: Wed, 16 Oct 2024 16:20:24 +1100 +Subject: [PATCH] acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() + +The calculation of the size of the table was incorrect (copy/pasta from +grub_acpi_rsdt_find_table() I assume...). The entries are 64-bit long. + +This causes us to access beyond the end of the table which is causing +crashes during boot on some systems. Typically this is causing a crash +on VMWare when using UEFI and enabling serial autodetection, as + +grub_acpi_find_table (GRUB_ACPI_SPCR_SIGNATURE); + +Will goes past the end of the table (the SPCR table doesn't exits) + +Signed-off-by: Benjamin Herrenschmidt +--- + grub-core/kern/acpi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/acpi.c b/grub-core/kern/acpi.c +index 48ded4e2ea6e..8ff0835d501f 100644 +--- a/grub-core/kern/acpi.c ++++ b/grub-core/kern/acpi.c +@@ -75,7 +75,7 @@ grub_acpi_xsdt_find_table (struct grub_acpi_table_header *xsdt, const char *sig) + return 0; + + ptr = (grub_unaligned_uint64_t *) (xsdt + 1); +- s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint32_t); ++ s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint64_t); + for (; s; s--, ptr++) + { + struct grub_acpi_table_header *tbl; diff --git a/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch b/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch new file mode 100644 index 0000000..7da6e10 --- /dev/null +++ b/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 16 Oct 2024 15:50:32 +0200 +Subject: [PATCH] cmd/search: Fix a possible NULL ptr dereference + +When querying about a partition UUID, we're not checking +for get_device_uuid() return value, which can possibly +result in dereferencing a NULL pointer. + +Signed-off-by: Nicolas Frayer +Co-authored-by: Chuong Tran +--- + grub-core/commands/search.c | 28 +++++++++++++++------------- + 1 file changed, 15 insertions(+), 13 deletions(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 9dd937e6df4e..d538b36219fb 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -212,24 +212,26 @@ iterate_device (const char *name, void *data) + struct uuid_context uuid_ctx; + int ret = 0; + +- get_device_uuid(name, &quid_name); +- if (!grub_strcmp(quid_name, ctx->key)) ++ if (get_device_uuid(name, &quid_name)) + { +- uuid_ctx.name = name; +- uuid_ctx.uuid = quid_name; ++ if (!grub_strcmp(quid_name, ctx->key)) ++ { ++ uuid_ctx.name = name; ++ uuid_ctx.uuid = quid_name; + +- ret = grub_device_iterate (check_for_duplicate, &uuid_ctx); ++ ret = grub_device_iterate (check_for_duplicate, &uuid_ctx); + +- if (ret) +- { +- grub_printf("Duplicated media UUID found, rebooting ...\n"); +- grub_sleep(10); +- grub_reboot(); +- } +- } ++ if (ret) ++ { ++ grub_printf("Duplicated media UUID found, rebooting ...\n"); ++ grub_sleep(10); ++ grub_reboot(); ++ } ++ } + +- if (quid_name) grub_free (quid_name); ++ if (quid_name) grub_free (quid_name); + ++ } + } + } + } diff --git a/grub.macros b/grub.macros index 061c778..77be76d 100644 --- a/grub.macros +++ b/grub.macros @@ -15,7 +15,12 @@ %endif # gnulib actively ignores CFLAGS because it's terrible +# build aarch64 gnulib with branch protection +%ifarch aarch64 +%global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack -Wl,--no-warn-rwx-segments -mbranch-protection=standard" +%else %global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack -Wl,--no-warn-rwx-segments" +%endif %global cflags_sed \\\ sed \\\ diff --git a/grub.patches b/grub.patches index ecde23d..23f1ac1 100644 --- a/grub.patches +++ b/grub.patches @@ -270,3 +270,10 @@ Patch0269: 0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch Patch0270: 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch +Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch +Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch +Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch +Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch +Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch +Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch +Patch0279: 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch diff --git a/grub2.spec b/grub2.spec index ae49392..fdfe73b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 4%{?dist} +Release: 11%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,31 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 23 2024 Nicolas Frayer 2.12-11 +- cmd/search: Fix a possible NULL ptr dereference + +* Thu Oct 17 2024 Nicolas Frayer 2.12-10 +- acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() +- Resolves: #2317048 + +* Thu Oct 3 2024 Nicolas Frayer 2.12-9 +- Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot +- Resolves: #2316279 + +* Wed Sep 25 2024 Nicolas Frayer 2.12-8 +- NX: efi/loader, add a call to grub_efi_check_nx_required() + +* Tue Sep 17 2024 Nicolas Frayer - 2.12-7 +- aarch64/macros: Build gnulib with -mbranch-protection=standard + +* Thu Sep 5 2024 Leo Sandoval - 2.12-6 +- load EFI commands inside test expressions +- Resolves: #2305291 + +* Thu Aug 29 2024 Leo Sandoval - 2.12-5 +- Fix netbooting regressions introduced at 2.12-1 +- Resolves: #2303727 + * Thu Aug 08 2024 Peter Robinson 2.12-4 - Build using fuse3