Skip to content
Snippets Groups Projects
  1. Sep 27, 2024
    • Al Viro's avatar
      [tree-wide] finally take no_llseek out · cb787f4a
      Al Viro authored
      
      no_llseek had been defined to NULL two years ago, in commit 868941b1
      ("fs: remove no_llseek")
      
      To quote that commit,
      
        At -rc1 we'll need do a mechanical removal of no_llseek -
      
        git grep -l -w no_llseek | grep -v porting.rst | while read i; do
      	sed -i '/\<no_llseek\>/d' $i
        done
      
        would do it.
      
      Unfortunately, that hadn't been done.  Linus, could you do that now, so
      that we could finally put that thing to rest? All instances are of the
      form
      	.llseek = no_llseek,
      so it's obviously safe.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb787f4a
  2. Sep 16, 2024
  3. Sep 04, 2024
  4. Sep 02, 2024
    • Pavel Tikhomirov's avatar
      kmemleak-test: add percpu leak · e0b2fdb3
      Pavel Tikhomirov authored
      Add a per-CPU memory leak, which will be reported like:
      
      unreferenced object 0x3efa840195f8 (size 64):
        comm "modprobe", pid 4667, jiffies 4294688677
        hex dump (first 32 bytes on cpu 0):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace (crc 0):
          [<ffffffffa7fa87af>] pcpu_alloc+0x3df/0x840
          [<ffffffffc11642d9>] kmemleak_test_init+0x2c9/0x2f0 [kmemleak_test]
          [<ffffffffa7c02264>] do_one_initcall+0x44/0x300
          [<ffffffffa7de9e10>] do_init_module+0x60/0x240
          [<ffffffffa7deb946>] init_module_from_file+0x86/0xc0
          [<ffffffffa7deba99>] idempotent_init_module+0x109/0x2a0
          [<ffffffffa7debd2a>] __x64_sys_finit_module+0x5a/0xb0
          [<ffffffffa88f4f3a>] do_syscall_64+0x7a/0x160
          [<ffffffffa8a0012b>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      Link: https://lkml.kernel.org/r/20240725041223.872472-3-ptikhomirov@virtuozzo.com
      
      
      Signed-off-by: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
      Cc: Chen Jun <chenjun102@huawei.com>
      Cc: Wei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      e0b2fdb3
  5. Aug 27, 2024
  6. Aug 15, 2024
  7. Aug 12, 2024
  8. Jul 17, 2024
  9. Jul 10, 2024
  10. Jul 08, 2024
  11. Jul 05, 2024
  12. Jul 04, 2024
  13. Jun 29, 2024
  14. Jun 14, 2024
  15. Jun 11, 2024
  16. Jun 04, 2024
  17. May 27, 2024
  18. May 23, 2024
    • Steven Rostedt (Google)'s avatar
      tracing/treewide: Remove second parameter of __assign_str() · 2c92ca84
      Steven Rostedt (Google) authored
      With the rework of how the __string() handles dynamic strings where it
      saves off the source string in field in the helper structure[1], the
      assignment of that value to the trace event field is stored in the helper
      value and does not need to be passed in again.
      
      This means that with:
      
        __string(field, mystring)
      
      Which use to be assigned with __assign_str(field, mystring), no longer
      needs the second parameter and it is unused. With this, __assign_str()
      will now only get a single parameter.
      
      There's over 700 users of __assign_str() and because coccinelle does not
      handle the TRACE_EVENT() macro I ended up using the following sed script:
      
        git grep -l __assign_str | while read a ; do
            sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file;
            mv /tmp/test-file $a;
        done
      
      I then searched for __assign_str() that did not end with ';' as those
      were multi line assignments that the sed script above would fail to catch.
      
      Note, the same updates will need to be done for:
      
        __assign_str_len()
        __assign_rel_str()
        __assign_rel_str_len()
      
      I tested this with both an allmodconfig and an allyesconfig (build only for both).
      
      [1] https://lore.kernel.org/linux-trace-kernel/20240222211442.634192653@goodmis.org/
      
      Link: https://lore.kernel.org/linux-trace-kernel/20240516133454.681ba6a0@rorschach.local.home
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Julia Lawall <Julia.Lawall@inria.fr>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Acked-by: Christian König <christian.koenig@amd.com> for the amdgpu parts.
      Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #for
      Acked-by: Rafael J. Wysocki <rafael@kernel.org> # for thermal
      Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
      Acked-by: Darrick J. Wong <djwong@kernel.org>	# xfs
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      2c92ca84
  19. May 21, 2024
  20. May 13, 2024
  21. May 09, 2024
    • Masahiro Yamada's avatar
      kbuild: use $(src) instead of $(srctree)/$(src) for source directory · b1992c37
      Masahiro Yamada authored
      
      Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
      checked-in source files. It is merely a convention without any functional
      difference. In fact, $(obj) and $(src) are exactly the same, as defined
      in scripts/Makefile.build:
      
          src := $(obj)
      
      When the kernel is built in a separate output directory, $(src) does
      not accurately reflect the source directory location. While Kbuild
      resolves this discrepancy by specifying VPATH=$(srctree) to search for
      source files, it does not cover all cases. For example, when adding a
      header search path for local headers, -I$(srctree)/$(src) is typically
      passed to the compiler.
      
      This introduces inconsistency between upstream and downstream Makefiles
      because $(src) is used instead of $(srctree)/$(src) for the latter.
      
      To address this inconsistency, this commit changes the semantics of
      $(src) so that it always points to the directory in the source tree.
      
      Going forward, the variables used in Makefiles will have the following
      meanings:
      
        $(obj)     - directory in the object tree
        $(src)     - directory in the source tree  (changed by this commit)
        $(objtree) - the top of the kernel object tree
        $(srctree) - the top of the kernel source tree
      
      Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
      with $(src).
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      b1992c37
  22. May 08, 2024
  23. May 04, 2024
  24. Apr 29, 2024
  25. Apr 16, 2024
  26. Mar 18, 2024
  27. Mar 08, 2024
  28. Mar 05, 2024
  29. Feb 29, 2024
    • Kees Cook's avatar
      bpf: Replace bpf_lpm_trie_key 0-length array with flexible array · 896880ff
      Kees Cook authored
      
      Replace deprecated 0-length array in struct bpf_lpm_trie_key with
      flexible array. Found with GCC 13:
      
      ../kernel/bpf/lpm_trie.c:207:51: warning: array subscript i is outside array bounds of 'const __u8[0]' {aka 'const unsigned char[]'} [-Warray-bounds=]
        207 |                                        *(__be16 *)&key->data[i]);
            |                                                   ^~~~~~~~~~~~~
      ../include/uapi/linux/swab.h:102:54: note: in definition of macro '__swab16'
        102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
            |                                                      ^
      ../include/linux/byteorder/generic.h:97:21: note: in expansion of macro '__be16_to_cpu'
         97 | #define be16_to_cpu __be16_to_cpu
            |                     ^~~~~~~~~~~~~
      ../kernel/bpf/lpm_trie.c:206:28: note: in expansion of macro 'be16_to_cpu'
        206 |                 u16 diff = be16_to_cpu(*(__be16 *)&node->data[i]
      ^
            |                            ^~~~~~~~~~~
      In file included from ../include/linux/bpf.h:7:
      ../include/uapi/linux/bpf.h:82:17: note: while referencing 'data'
         82 |         __u8    data[0];        /* Arbitrary size */
            |                 ^~~~
      
      And found at run-time under CONFIG_FORTIFY_SOURCE:
      
        UBSAN: array-index-out-of-bounds in kernel/bpf/lpm_trie.c:218:49
        index 0 is out of range for type '__u8 [*]'
      
      Changing struct bpf_lpm_trie_key is difficult since has been used by
      userspace. For example, in Cilium:
      
      	struct egress_gw_policy_key {
      	        struct bpf_lpm_trie_key lpm_key;
      	        __u32 saddr;
      	        __u32 daddr;
      	};
      
      While direct references to the "data" member haven't been found, there
      are static initializers what include the final member. For example,
      the "{}" here:
      
              struct egress_gw_policy_key in_key = {
                      .lpm_key = { 32 + 24, {} },
                      .saddr   = CLIENT_IP,
                      .daddr   = EXTERNAL_SVC_IP & 0Xffffff,
              };
      
      To avoid the build time and run time warnings seen with a 0-sized
      trailing array for struct bpf_lpm_trie_key, introduce a new struct
      that correctly uses a flexible array for the trailing bytes,
      struct bpf_lpm_trie_key_u8. As part of this, include the "header"
      portion (which is just the "prefixlen" member), so it can be used
      by anything building a bpf_lpr_trie_key that has trailing members that
      aren't a u8 flexible array (like the self-test[1]), which is named
      struct bpf_lpm_trie_key_hdr.
      
      Unfortunately, C++ refuses to parse the __struct_group() helper, so
      it is not possible to define struct bpf_lpm_trie_key_hdr directly in
      struct bpf_lpm_trie_key_u8, so we must open-code the union directly.
      
      Adjust the kernel code to use struct bpf_lpm_trie_key_u8 through-out,
      and for the selftest to use struct bpf_lpm_trie_key_hdr. Add a comment
      to the UAPI header directing folks to the two new options.
      
      Reported-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Closes: https://paste.debian.net/hidden/ca500597/
      Link: https://lore.kernel.org/all/202206281009.4332AA33@keescook/ [1]
      Link: https://lore.kernel.org/bpf/20240222155612.it.533-kees@kernel.org
      896880ff
  30. Feb 12, 2024
  31. Feb 09, 2024
    • Linus Torvalds's avatar
      work around gcc bugs with 'asm goto' with outputs · 4356e9f8
      Linus Torvalds authored
      We've had issues with gcc and 'asm goto' before, and we created a
      'asm_volatile_goto()' macro for that in the past: see commits
      3f0116c3 ("compiler/gcc4: Add quirk for 'asm goto' miscompilation
      bug") and a9f18034 ("compiler/gcc4: Make quirk for
      asm_volatile_goto() unconditional").
      
      Then, much later, we ended up removing the workaround in commit
      43c249ea ("compiler-gcc.h: remove ancient workaround for gcc PR
      58670") because we no longer supported building the kernel with the
      affected gcc versions, but we left the macro uses around.
      
      Now, Sean Christopherson reports a new version of a very similar
      problem, which is fixed by re-applying that ancient workaround.  But the
      problem in question is limited to only the 'asm goto with outputs'
      cases, so instead of re-introducing the old workaround as-is, let's
      rename and limit the workaround to just that much less common case.
      
      It looks like there are at least two separate issues that all hit in
      this area:
      
       (a) some versions of gcc don't mark the asm goto as 'volatile' when it
           has outputs:
      
              https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619
              https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420
      
           which is easy to work around by just adding the 'volatile' by hand.
      
       (b) Internal compiler errors:
      
              https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422
      
      
      
           which are worked around by adding the extra empty 'asm' as a
           barrier, as in the original workaround.
      
      but the problem Sean sees may be a third thing since it involves bad
      code generation (not an ICE) even with the manually added 'volatile'.
      
      but the same old workaround works for this case, even if this feels a
      bit like voodoo programming and may only be hiding the issue.
      
      Reported-and-tested-by: default avatarSean Christopherson <seanjc@google.com>
      Link: https://lore.kernel.org/all/20240208220604.140859-1-seanjc@google.com/
      
      
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Uros Bizjak <ubizjak@gmail.com>
      Cc: Jakub Jelinek <jakub@redhat.com>
      Cc: Andrew Pinski <quic_apinski@quicinc.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4356e9f8
  32. Jan 24, 2024
  33. Jan 18, 2024
Loading