1. 20 2月, 2023 1 次提交
  2. 13 2月, 2023 1 次提交
  3. 06 2月, 2023 1 次提交
  4. 30 1月, 2023 1 次提交
  5. 22 1月, 2023 1 次提交
  6. 15 1月, 2023 1 次提交
  7. 11 1月, 2023 2 次提交
    • M
      kbuild: fix 'make modules' error when CONFIG_DEBUG_INFO_BTF_MODULES=y · 74d3320f
      Masahiro Yamada 提交于
      When CONFIG_DEBUG_INFO_BTF_MODULES=y, running 'make modules'
      in the clean kernel tree will get the following error.
      
        $ grep CONFIG_DEBUG_INFO_BTF_MODULES .config
        CONFIG_DEBUG_INFO_BTF_MODULES=y
        $ make -s clean
        $ make modules
          [snip]
          AR      vmlinux.a
        ar: ./built-in.a: No such file or directory
        make: *** [Makefile:1241: vmlinux.a] Error 1
      
      'modules' depends on 'vmlinux', but builtin objects are not built.
      
      Define KBUILD_BUILTIN.
      
      Fixes: f73edc89 ("kbuild: unify two modpost invocations")
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      74d3320f
    • M
      kbuild: export top-level LDFLAGS_vmlinux only to scripts/Makefile.vmlinux · 8debed3e
      Masahiro Yamada 提交于
      Nathan Chancellor reports that $(NM) emits an error message when
      GNU Make 4.4 is used to build the ARM zImage.
      
        $ make-4.4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- O=build defconfig zImage
          [snip]
          LD      vmlinux
          NM      System.map
          SORTTAB vmlinux
          OBJCOPY arch/arm/boot/Image
          Kernel: arch/arm/boot/Image is ready
        arm-linux-gnueabi-nm: 'arch/arm/boot/compressed/../../../../vmlinux': No such file
        /bin/sh: 1: arithmetic expression: expecting primary: " "
          LDS     arch/arm/boot/compressed/vmlinux.lds
          AS      arch/arm/boot/compressed/head.o
          GZIP    arch/arm/boot/compressed/piggy_data
          AS      arch/arm/boot/compressed/piggy.o
          CC      arch/arm/boot/compressed/misc.o
      
      This occurs since GNU Make commit 98da874c4303 ("[SV 10593] Export
      variables to $(shell ...) commands"), and the O= option is needed to
      reproduce it. The generated zImage is correct despite the error message.
      
      As the commit description of 98da874c4303 [1] says, exported variables
      are passed down to $(shell ) functions, which means exported recursive
      variables might be expanded earlier than before, in the parse stage.
      
      The following test code demonstrates the change for GNU Make 4.4.
      
      [Test Makefile]
      
        $(shell echo hello > foo)
        export foo = $(shell cat bar/../foo)
        $(shell mkdir bar)
      
        all:
                @echo $(foo)
      
      [GNU Make 4.3]
      
        $ rm -rf bar; make-4.3
        hello
      
      [GNU Make 4.4]
      
        $ rm -rf bar; make-4.4
        cat: bar/../foo: No such file or directory
        hello
      
      The 'foo' is a resursively expanded (i.e. lazily expanded) variable.
      
      GNU Make 4.3 expands 'foo' just before running the recipe '@echo $(foo)',
      at this point, the directory 'bar' exists.
      
      GNU Make 4.4 expands 'foo' to evaluate $(shell mkdir bar) because it is
      exported. At this point, the directory 'bar' does not exit yet. The cat
      command cannot resolve the bar/../foo path, hence the error message.
      
      Let's get back to the kernel Makefile.
      
      In arch/arm/boot/compressed/Makefile, KBSS_SZ is referenced by
      LDFLAGS_vmlinux, which is recursive and also exported by the top
      Makefile.
      
      GNU Make 4.3 expands KBSS_SZ just before running the recipes, so no
      error message.
      
      GNU Make 4.4 expands KBSS_SZ in the parse stage, where the directory
      arm/arm/boot/compressed does not exit yet. When compiled with O=,
      the output directory is created by $(shell mkdir -p $(obj-dirs))
      in scripts/Makefile.build.
      
      There are two ways to fix this particular issue:
      
       - change "$(obj)/../../../../vmlinux" in KBSS_SZ to "vmlinux"
       - unexport LDFLAGS_vmlinux
      
      This commit takes the latter course because it is what I originally
      intended.
      
      Commit 3ec8a5b3 ("kbuild: do not export LDFLAGS_vmlinux")
      unexported LDFLAGS_vmlinux.
      
      Commit 5d4aeffb ("kbuild: rebuild .vmlinux.export.o when its
      prerequisite is updated") accidentally exported it again.
      
      We can clean up arch/arm/boot/compressed/Makefile later.
      
      [1]: https://git.savannah.gnu.org/cgit/make.git/commit/?id=98da874c43035a490cdca81331724f233a3d0c9a
      
      Link: https://lore.kernel.org/all/Y7i8+EjwdnhHtlrr@dev-arch.thelio-3990X/
      Fixes: 5d4aeffb ("kbuild: rebuild .vmlinux.export.o when its prerequisite is updated")
      Reported-by: NNathan Chancellor <nathan@kernel.org>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      Tested-by: NNathan Chancellor <nathan@kernel.org>
      8debed3e
  8. 09 1月, 2023 1 次提交
  9. 05 1月, 2023 1 次提交
  10. 02 1月, 2023 1 次提交
  11. 30 12月, 2022 1 次提交
  12. 26 12月, 2022 1 次提交
  13. 14 12月, 2022 2 次提交
    • M
      kbuild: ensure Make >= 3.82 is used · 87d599fc
      Masahiro Yamada 提交于
      Documentation/process/changes.rst notes the minimal GNU Make version,
      but it is not checked anywhere.
      
      We could check $(MAKE_VERSION), but another simple way is to check
      $(.FEATURES) since the feature list always grows.
      
      GNU Make 3.81 expands $(.FEATURES) to:
        target-specific order-only second-expansion else-if archives jobserver check-symlink
      
      GNU Make 3.82 expands $(.FEATURES) to:
        target-specific order-only second-expansion else-if shortest-stem undefine archives jobserver check-symlink
      
      To ensure Make >= 3.82, you can check either 'shortest-stem' or
      'undefine'.
      
      This way is not always possible. For example, Make 4.0 through 4.2 have
      the same set of $(.FEATURES). At that point, we will need to come up
      with a different approach.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      87d599fc
    • M
      kbuild: change module.order to list *.o instead of *.ko · f65a4868
      Masahiro Yamada 提交于
      scripts/Makefile.build replaces the suffix .o with .ko, then
      scripts/Makefile.modpost calls the sed command to change .ko back
      to the original .o suffix.
      
      Instead of converting the suffixes back-and-forth, store the .o paths
      in modules.order, and replace it with .ko in 'make modules_install'.
      
      This avoids the unneeded sed command.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NLuis Chamberlain <mcgrof@kernel.org>
      f65a4868
  14. 13 12月, 2022 2 次提交
  15. 12 12月, 2022 1 次提交
  16. 11 12月, 2022 1 次提交
  17. 10 12月, 2022 1 次提交
  18. 05 12月, 2022 1 次提交
  19. 28 11月, 2022 1 次提交
  20. 22 11月, 2022 1 次提交
  21. 21 11月, 2022 1 次提交
  22. 19 11月, 2022 2 次提交
  23. 18 11月, 2022 1 次提交
  24. 14 11月, 2022 1 次提交
  25. 10 11月, 2022 1 次提交
  26. 07 11月, 2022 1 次提交
  27. 02 11月, 2022 1 次提交
  28. 31 10月, 2022 1 次提交
  29. 28 10月, 2022 1 次提交
  30. 27 10月, 2022 1 次提交
  31. 24 10月, 2022 1 次提交
  32. 17 10月, 2022 3 次提交
  33. 04 10月, 2022 1 次提交
    • A
      kmsan: add KMSAN runtime core · f80be457
      Alexander Potapenko 提交于
      For each memory location KernelMemorySanitizer maintains two types of
      metadata:
      
      1. The so-called shadow of that location - а byte:byte mapping describing
         whether or not individual bits of memory are initialized (shadow is 0)
         or not (shadow is 1).
      2. The origins of that location - а 4-byte:4-byte mapping containing
         4-byte IDs of the stack traces where uninitialized values were
         created.
      
      Each struct page now contains pointers to two struct pages holding KMSAN
      metadata (shadow and origins) for the original struct page.  Utility
      routines in mm/kmsan/core.c and mm/kmsan/shadow.c handle the metadata
      creation, addressing, copying and checking.  mm/kmsan/report.c performs
      error reporting in the cases an uninitialized value is used in a way that
      leads to undefined behavior.
      
      KMSAN compiler instrumentation is responsible for tracking the metadata
      along with the kernel memory.  mm/kmsan/instrumentation.c provides the
      implementation for instrumentation hooks that are called from files
      compiled with -fsanitize=kernel-memory.
      
      To aid parameter passing (also done at instrumentation level), each
      task_struct now contains a struct kmsan_task_state used to track the
      metadata of function parameters and return values for that task.
      
      Finally, this patch provides CONFIG_KMSAN that enables KMSAN, and declares
      CFLAGS_KMSAN, which are applied to files compiled with KMSAN.  The
      KMSAN_SANITIZE:=n Makefile directive can be used to completely disable
      KMSAN instrumentation for certain files.
      
      Similarly, KMSAN_ENABLE_CHECKS:=n disables KMSAN checks and makes newly
      created stack memory initialized.
      
      Users can also use functions from include/linux/kmsan-checks.h to mark
      certain memory regions as uninitialized or initialized (this is called
      "poisoning" and "unpoisoning") or check that a particular region is
      initialized.
      
      Link: https://lkml.kernel.org/r/20220915150417.722975-12-glider@google.comSigned-off-by: NAlexander Potapenko <glider@google.com>
      Acked-by: NMarco Elver <elver@google.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Eric Biggers <ebiggers@kernel.org>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Vegard Nossum <vegard.nossum@oracle.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      f80be457
  34. 03 10月, 2022 1 次提交