Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 02, 2022
  2. Apr 01, 2022
  3. Mar 30, 2022
    • Masahiro Yamada's avatar
      fixdep: use fflush() and ferror() to ensure successful write to files · 69304379
      Masahiro Yamada authored
      Currently, fixdep checks the return value from (v)printf(), but it does
      not ensure the complete write to the .cmd file.
      
      printf() just writes data to the internal buffer, which usually succeeds.
      (Of course, it may fail for another reason, for example when the file
      descriptor is closed, but that is another story.)
      
      When the buffer (4k?) is full, an actual write occurs, and printf() may
      really fail. One of typical cases is "No space left on device" when the
      disk is full.
      
      The data remaining in the buffer will be pushed out to the file when
      the program exits, but we never know if it is successful.
      
      One straight-forward fix would be to add the following code at the end
      of the program.
      
         ret = fflush(stdout);
         if (ret < 0) {
                /* error handling */
         }
      
      However, it is tedious to check the return code in all the call sites
      of printf(), fflush(), fclose(), and whatever can cause actual writes
      to the end device. Doing that lets the ...
      69304379
  4. Mar 28, 2022
  5. Mar 23, 2022
  6. Mar 22, 2022
  7. Mar 21, 2022
    • Kees Cook's avatar
      um: Allow builds with Clang · c7500c1b
      Kees Cook authored
      Add SUBARCH target for Clang+um (which must go last, not alphabetically,
      so the other SUBARCHes are assigned). Remove open-coded "DEFINE"
      macro, instead using linux/kbuild.h's version which was updated to use
      Clang-friendly assembly in commit cf0c3e68 ("kbuild: fix asm-offset
      generation to work with clang"). Redefine "DEFINE_LONGS" in terms of
      "COMMENT" and "DEFINE" so that the intended coment actually has useful
      content. Add a missed "break" to avoid implicit fall-through warnings.
      
      This lets me run KUnit tests with Clang:
      
      $ ./tools/testing/kunit/kunit.py run --make_options LLVM=1
      ...
      
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: David Gow <davidgow@google.com>
      Cc: linux-um@lists.infradead.org
      Cc: linux-kbuild@vger.kernel.org
      Cc: linux-kselftest@vger.kernel.or...
      c7500c1b
  8. Mar 18, 2022
  9. Mar 15, 2022
  10. Mar 13, 2022
  11. Mar 11, 2022
  12. Mar 10, 2022
    • Vasily Gorbik's avatar
      s390/nospec: add an option to use thunk-extern · 1d2ad084
      Vasily Gorbik authored
      
      Currently with -mindirect-branch=thunk and -mfunction-return=thunk compiler
      options expoline thunks are put into individual COMDAT group sections. s390
      is the only architecture which has group sections and it has implications
      for kpatch and objtool tools support.
      
      Using -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern
      is an alternative, which comes with a need to generate all required
      expoline thunks manually. Unfortunately modules area is too far away from
      the kernel image, and expolines from the kernel image cannon be used.
      But since all new distributions (except Debian) build kernels for machine
      generations newer than z10, where "exrl" instruction is available, that
      leaves only 16 expolines thunks possible.
      
      Provide an option to build the kernel with
      -mindirect-branch=thunk-extern and -mfunction-return=thunk-extern for
      z10 or newer. This also requires to postlink expoline thunks into all
      modules explicitly. Currently modules already contain most expolines
      anyhow.
      
      Unfortunately -mindirect-branch=thunk-extern and
      -mfunction-return=thunk-extern options support is broken in gcc <= 11.2.
      Additional compile test is required to verify proper gcc support.
      
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Co-developed-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      1d2ad084
  13. Mar 07, 2022
  14. Feb 28, 2022
    • Frank Rowand's avatar
      of: unittest: add program to process EXPECT messages · 8e4296c2
      Frank Rowand authored
      
      If unittest detects a problem it will print a warning or error message
      to the console.  Unittest also triggers warning and error messages from
      other kernel code as a result of intentionally bad unittest data.  This
      has led to confusion as to whether the triggered messages are an
      expected result of a test or whether there is a real problem that is
      independent of unittest.
      
      EXPECT messages were added to unittest to report each triggered message
      that is expected, resulting in verbose console output.
      
      scripts/dtc/of_unittest is a new program that processes the EXPECT
      messages to determine whether the triggered messages occurred and
      also removes the excess verbosity of the EXPECT messages.  More
      information is available from 'scripts/dtc/of_unittest_expect --help'.
      
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20220201181413.2719955-1-frowand.list@gmail.com
      8e4296c2
  15. Feb 24, 2022
  16. Feb 22, 2022
  17. Feb 21, 2022
    • Changbin Du's avatar
      kallsyms: ignore all local labels prefixed by '.L' · d4c85864
      Changbin Du authored
      
      The llvm compiler can generate lots of local labels ('.LBB', '.Ltmpxxx',
      '.L__unnamed_xx', etc.). These symbols usually are useless for debugging.
      And they might overlap with handwritten symbols.
      
      Before this change, a dumpstack shows a local symbol for epc:
      [    0.040341][    T0] Hardware name: riscv-virtio,qemu (DT)
      [    0.040376][    T0] epc : .LBB6_14+0x22/0x6a
      [    0.040452][    T0]  ra : restore_all+0x12/0x6e
      
      The simple solution is that we can ignore all local labels prefixed by '.L'.
      For handwritten symbols which need to be preserved should drop the '.L'
      prefix.
      
      After this change, the C defined symbol is shown so we can locate the
      problematical code immediately:
      [    0.035795][    T0] Hardware name: riscv-virtio,qemu (DT)
      [    0.036332][    T0] epc : trace_hardirqs_on+0x54/0x13c
      [    0.036567][    T0]  ra : restore_all+0x12/0x6e
      
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d4c85864