0035-gettext-Remove-variables-hooks-on-module-unload.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 69e0cb299c479e01e1c13a032172d29293db8e69 Mon Sep 17 00:00:00 2001
  2. From: B Horn <b@horn.uk>
  3. Date: Fri, 1 Nov 2024 23:52:06 +0000
  4. Subject: [PATCH] gettext: Remove variables hooks on module unload
  5. The gettext module does not entirely cleanup after itself in
  6. its GRUB_MOD_FINI() leaving a few variables hooks in place.
  7. It is not possible to unload gettext module because normal
  8. module depends on it. Though fix the issues for completeness.
  9. Fixes: CVE-2025-0622
  10. Reported-by: B Horn <b@horn.uk>
  11. Signed-off-by: B Horn <b@horn.uk>
  12. Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
  13. Upstream: 7580addfc8c94cedb0cdfd7a1fd65b539215e637
  14. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  15. ---
  16. grub-core/gettext/gettext.c | 4 ++++
  17. 1 file changed, 4 insertions(+)
  18. diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
  19. index 7a1c14e4f..e4f4f8ee6 100644
  20. --- a/grub-core/gettext/gettext.c
  21. +++ b/grub-core/gettext/gettext.c
  22. @@ -535,6 +535,10 @@ GRUB_MOD_INIT (gettext)
  23. GRUB_MOD_FINI (gettext)
  24. {
  25. + grub_register_variable_hook ("locale_dir", NULL, NULL);
  26. + grub_register_variable_hook ("secondary_locale_dir", NULL, NULL);
  27. + grub_register_variable_hook ("lang", NULL, NULL);
  28. +
  29. grub_gettext_delete_list (&main_context);
  30. grub_gettext_delete_list (&secondary_context);
  31. --
  32. 2.50.1