zsh-5.9-relro.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. https://src.fedoraproject.org/rpms/zsh/blob/rawhide/f/0003-zsh-fix-module-loading-problem-with-full-RELRO.patch
  2. https://github.com/zsh-users/zsh/commit/a84fdd7c8f77935ecce99ff2b0bdba738821ed79
  3. From a84fdd7c8f77935ecce99ff2b0bdba738821ed79 Mon Sep 17 00:00:00 2001
  4. From: Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
  5. Date: Mon, 26 Jun 2023 17:13:04 +0900
  6. Subject: [PATCH] 51889: fix module loading problem with full RELRO
  7. If full RELRO (relocation read-only, one of the security enhancement
  8. methods for ELF-based systems) is used when building zsh (as in binary
  9. packages of most Linuxes), loading a module (e.g. zsh/zftp) fails unless
  10. all the modules it depends on are already loaded. With this patch the
  11. necessary modules are automatically loaded.
  12. Upstream-commit: a84fdd7c8f77935ecce99ff2b0bdba738821ed79
  13. Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
  14. ---
  15. Src/Modules/zftp.c | 2 +-
  16. Src/mkbltnmlst.sh | 24 ++++++++++++++++++++++++
  17. 2 files changed, 25 insertions(+), 1 deletion(-)
  18. diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
  19. index 49b3ffa89..47a5e9de9 100644
  20. --- a/Src/Modules/zftp.c
  21. +++ b/Src/Modules/zftp.c
  22. @@ -3172,7 +3172,7 @@ static struct features module_features = {
  23. int
  24. setup_(UNUSED(Module m))
  25. {
  26. - return (require_module("zsh/net/tcp", NULL, 0) == 1);
  27. + return 0;
  28. }
  29. /**/
  30. diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
  31. index c4611d8b3..067ecdaf9 100644
  32. --- a/Src/mkbltnmlst.sh
  33. +++ b/Src/mkbltnmlst.sh
  34. @@ -76,6 +76,30 @@ for x_mod in $x_mods; do
  35. test "x$linked" = xno && echo "#endif"
  36. done
  37. +# if dynamic module 'mod' with load=no has moddeps in its .mdd,
  38. +# then output add_dep(mod, dep) for each 'dep' in moddeps.
  39. +dyn_mods="`grep ' link=dynamic .* load=no ' $CFMOD | \
  40. + sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
  41. +
  42. +for mod in $dyn_mods; do
  43. + modfile="`grep '^name='$mod' ' $CFMOD | \
  44. + sed -e 's/^.* modfile=//' -e 's/ .*//'`"
  45. + if test "x$modfile" = x; then
  46. + echo >&2 "WARNING: no name for \`$mod' in $CFMOD (ignored)"
  47. + continue
  48. + fi
  49. + unset moddeps
  50. + . $srcdir/../$modfile
  51. + if test -n "$moddeps"; then
  52. + echo '#ifdef DYNAMIC'
  53. + echo "/* non-linked-in known module \`$mod' */"
  54. + for dep in $moddeps; do
  55. + echo " add_dep(\"$mod\", \"$dep\");"
  56. + done
  57. + echo '#endif'
  58. + fi
  59. +done
  60. +
  61. echo
  62. done_mods=" "
  63. for bin_mod in $bin_mods; do
  64. --
  65. 2.41.0