1. 28 May, 2020 2 commits
    • Masahiro Yamada's avatar
      modpost: fix potential segmentation fault for addend_i386_rel() · d2e4d05c
      Masahiro Yamada authored
      This may not be a practical problem, but the second pass of ARCH=i386
      modpost causes segmentation fault if the -s option is not passed.
      
          MODPOST 12 modules
        Segmentation fault (core dumped)
        make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 139
        make[1]: *** [Makefile:1339: modules] Error 2
        make[1]: *** Waiting for unfinished jobs....
      
      The segmentation fault occurs when section_rel() is called for vmlinux,
      which is untested in regular builds. The cause of the problem is
      reloc_location() returning a wrong pointer for ET_EXEC object type.
      In this case, you need to subtract sechdr->sh_addr, otherwise it would
      get access beyond the mmap'ed memory.
      
      Add sym_get_data_by_offset() helper to avoid code duplication.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d2e4d05c
    • Masahiro Yamada's avatar
      kbuild: disallow multi-word in M= or KBUILD_EXTMOD · e9e81b63
      Masahiro Yamada authored
      $(firstword ...) in scripts/Makefile.modpost was added by commit
      3f3fd3c0 ("[PATCH] kbuild: allow multi-word $M in Makefile.modpost")
      to build multiple external module directories.
      
      It was a solution to resolve symbol dependencies when an external
      module depends on another external module.
      
      Commit 0d96fb20 ("kbuild: Add new Kbuild variable
      KBUILD_EXTRA_SYMBOLS") introduced another solution by passing symbol
      info via KBUILD_EXTRA_SYMBOLS, then broke the multi-word M= support.
      
        include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
                     $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
      
      ... does not work if KBUILD_EXTMOD contains multiple words.
      
      This feature has been broken for more than a decade. Remove the
      bitrotten code, and stop parsing if M or KBUILD_EXTMOD contains
      multiple words.
      
      As Documentation/kbuild/modules.rst explains, if your module depends
      on another one, there are two solutions:
        - add a common top-level Kbuild file
        - use KBUILD_EXTRA_SYMBOLS
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e9e81b63
  2. 25 May, 2020 20 commits
  3. 17 May, 2020 17 commits
  4. 12 May, 2020 1 commit
    • Masahiro Yamada's avatar
      kbuild: determine the output format of DTC by the target suffix · 78046fab
      Masahiro Yamada authored
      cmd_dtc takes the additional parameter $(2) to select the target
      format, dtb or yaml. This makes things complicated when it is used
      with cmd_and_fixdep and if_changed_rule. I actually stumbled on this.
      See commit 3d4b2238 ("kbuild: fix DT binding schema rule again to
      avoid needless rebuilds").
      
      Extract the suffix part of the target instead of passing the parameter.
      Fortunately, this works for both $(obj)/%.dtb and $(obj)/%.dt.yaml .
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      78046fab