Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Dec 12, 2021
  2. Nov 10, 2021
  3. Nov 09, 2021
  4. Nov 06, 2021
  5. Nov 01, 2021
  6. Oct 29, 2021
    • Rob Herring's avatar
      scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8 · a77725a9
      Rob Herring authored
      This adds the following commits from upstream:
      
      0a3a9d3449c8 checks: Add an interrupt-map check
      8fd24744e361 checks: Ensure '#interrupt-cells' only exists in interrupt providers
      d8d1a9a77863 checks: Drop interrupt provider '#address-cells' check
      52a16fd72824 checks: Make interrupt_provider check dependent on interrupts_extended_is_cell
      37fd700685da treesource: Maintain phandle label/path on output
      e33ce1d6a8c7 flattree: Use '\n', not ';' to separate asm pseudo-ops
      d24cc189dca6 asm: Use assembler macros instead of cpp macros
      ff3a30c115ad asm: Use .asciz and .ascii instead of .string
      5eb5927d81ee fdtdump: fix -Werror=int-to-pointer-cast
      0869f8269161 libfdt: Add ALIGNMENT error string
      69595a167f06 checks: Fix bus-range check
      72d09e2682a4 Makefile: add -Wsign-compare to warning options
      b587787ef388 checks: Fix signedness comparisons warnings
      69bed6c2418f dtc: Wrap phandle validity check
      910221185560 fdtget: Fix signedness comparisons warnings
      d96...
      a77725a9
  7. Oct 26, 2021
  8. Oct 24, 2021
  9. Oct 21, 2021
  10. Oct 18, 2021
    • Kees Cook's avatar
      stddef: Introduce DECLARE_FLEX_ARRAY() helper · 3080ea55
      Kees Cook authored
      There are many places where kernel code wants to have several different
      typed trailing flexible arrays. This would normally be done with multiple
      flexible arrays in a union, but since GCC and Clang don't (on the surface)
      allow this, there have been many open-coded workarounds, usually involving
      neighboring 0-element arrays at the end of a structure. For example,
      instead of something like this:
      
      struct thing {
      	...
      	union {
      		struct type1 foo[];
      		struct type2 bar[];
      	};
      };
      
      code works around the compiler with:
      
      struct thing {
      	...
      	struct type1 foo[0];
      	struct type2 bar[];
      };
      
      Another case is when a flexible array is wanted as the single member
      within a struct (which itself is usually in a union). For example, this
      would be worked around as:
      
      union many {
      	...
      	struct {
      		struct type3 baz[0];
      	};
      };
      
      These kinds of work-arounds cause problems with size checks against such
      zero-element arrays (for example when building with -Warray-bounds and
      -Wzero-length-bounds, and with the coming FORTIFY_SOURCE improvements),
      so they must all be converted to "real" flexible arrays, avoiding warnings
      like this:
      
      fs/hpfs/anode.c: In function 'hpfs_add_sector_to_btree':
      fs/hpfs/anode.c:209:27: warning: array subscript 0 is outside the bounds of an interior zero-length array 'struct bplus_internal_node[0]' [-Wzero-length-bounds]
        209 |    anode->btree.u.internal[0].down = cpu_to_le32(a);
            |    ~~~~~~~~~~~~~~~~~~~~~~~^~~
      In file included from fs/hpfs/hpfs_fn.h:26,
                       from fs/hpfs/anode.c:10:
      fs/hpfs/hpfs.h:412:32: note: while referencing 'internal'
        412 |     struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving
            |                                ^~~~~~~~
      
      drivers/net/can/usb/etas_es58x/es58x_fd.c: In function 'es58x_fd_tx_can_msg':
      drivers/net/can/usb/etas_es58x/es58x_fd.c:360:35: warning: array subscript 65535 is outside the bounds of an interior zero-length array 'u8[0]' {aka 'unsigned char[]'} [-Wzero-length-bounds]
        360 |  tx_can_msg = (typeof(tx_can_msg))&es58x_fd_urb_cmd->raw_msg[msg_len];
            |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from drivers/net/can/usb/etas_es58x/es58x_core.h:22,
                       from drivers/net/can/usb/etas_es58x/es58x_fd.c:17:
      drivers/net/can/usb/etas_es58x/es58x_fd.h:231:6: note: while referencing 'raw_msg'
        231 |   u8 raw_msg[0];
            |      ^~~~~~~
      
      However, it _is_ entirely possible to have one or more flexible arrays
      in a struct or union: it just has to be in another struct. And since it
      cannot be alone in a struct, such a struct must have at least 1 other
      named member -- but that member can be zero sized. Wrap all this nonsense
      into the new DECLARE_FLEX_ARRAY() in support of having flexible arrays
      in unions (or alone in a struct).
      
      As with struct_group(), since this is needed in UAPI headers as well,
      implement the core there, with a non-UAPI wrapper.
      
      Additionally update kernel-doc to understand its existence.
      
      https://github.com/KSPP/linux/issues/137
      
      
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      3080ea55
    • Kees Cook's avatar
      fortify: Add compile-time FORTIFY_SOURCE tests · be58f710
      Kees Cook authored
      
      While the run-time testing of FORTIFY_SOURCE is already present in
      LKDTM, there is no testing of the expected compile-time detections. In
      preparation for correctly supporting FORTIFY_SOURCE under Clang, adding
      additional FORTIFY_SOURCE defenses, and making sure FORTIFY_SOURCE
      doesn't silently regress with GCC, introduce a build-time test suite that
      checks each expected compile-time failure condition.
      
      As this is relatively backwards from standard build rules in the
      sense that a successful test is actually a compile _failure_, create
      a wrapper script to check for the correct errors, and wire it up as
      a dummy dependency to lib/string.o, collecting the results into a log
      file artifact.
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      be58f710
  11. Oct 15, 2021
    • Steven Rostedt's avatar
      nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^' · be358af1
      Steven Rostedt authored
      I received a build failure for a new patch I'm working on the nds32
      architecture, and when I went to test it, I couldn't get to my build error,
      because it failed to build with a bunch of:
      
        Error: invalid operands (*UND* and *UND* sections) for `^'
      
      issues with various files. Those files were temporary asm files that looked
      like:  kernel/.tmp_mc_fork.s
      
      I decided to look deeper, and found that the "mc" portion of that name
      stood for "mcount", and was created by the recordmcount.pl script. One that
      I wrote over a decade ago. Once I knew the source of the problem, I was
      able to investigate it further.
      
      The way the recordmcount.pl script works (BTW, there's a C version that
      simply modifies the ELF object) is by doing an "objdump" on the object
      file. Looks for all the calls to "mcount", and creates an offset of those
      locations from some global variable it can use (usually a global function
      name, found with <.*>:). Creates a asm file that is a table of references
      to these locations, using the found variable/function. Compiles it and
      links it back into the original object file. This asm file is called
      ".tmp_mc_<object_base_name>.s".
      
      The problem here is that the objdump produced by the nds32 object file,
      contains things that look like:
      
       0000159a <.L3^B1>:
          159a:       c6 00           beqz38 $r6, 159a <.L3^B1>
                              159a: R_NDS32_9_PCREL_RELA      .text+0x159e
          159c:       84 d2           movi55 $r6, #-14
          159e:       80 06           mov55 $r0, $r6
          15a0:       ec 3c           addi10.sp #0x3c
      
      Where ".L3^B1 is somehow selected as the "global" variable to index off of.
      
      Then the assembly file that holds the mcount locations looks like this:
      
              .section __mcount_loc,"a",@progbits
              .align 2
              .long .L3^B1 + -5522
              .long .L3^B1 + -5384
              .long .L3^B1 + -5270
              .long .L3^B1 + -5098
              .long .L3^B1 + -4970
              .long .L3^B1 + -4758
              .long .L3^B1 + -4122
              [...]
      
      And when it is compiled back to an object to link to the original object,
      the compile fails on the "^" symbol.
      
      Simple solution for now, is to have the perl script ignore using function
      symbols that have an "^" in the name.
      
      Link: https://lkml.kernel.org/r/20211014143507.4ad2c0f7@gandalf.local.home
      
      
      
      Cc: stable@vger.kernel.org
      Acked-by: default avatarGreentime Hu <green.hu@gmail.com>
      Fixes: fbf58a52
      
       ("nds32/ftrace: Add RECORD_MCOUNT support")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      be358af1
    • Kees Cook's avatar
      leaking_addresses: Always print a trailing newline · cf2a85ef
      Kees Cook authored
      For files that lack trailing newlines and match a leaking address (e.g.
      wchan[1]), the leaking_addresses.pl report would run together with the
      next line, making things look corrupted.
      
      Unconditionally remove the newline on input, and write it back out on
      output.
      
      [1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/
      
      
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20211008111626.151570317@infradead.org
      cf2a85ef
  12. Oct 12, 2021
  13. Oct 11, 2021
  14. Oct 07, 2021
  15. Oct 06, 2021
  16. Oct 05, 2021