1. 10 2月, 2022 1 次提交
  2. 06 12月, 2021 1 次提交
  3. 10 11月, 2021 1 次提交
  4. 27 10月, 2021 2 次提交
  5. 09 9月, 2021 1 次提交
  6. 19 8月, 2021 1 次提交
  7. 09 7月, 2021 2 次提交
    • S
      module: add printk formats to add module build ID to stacktraces · 9294523e
      Stephen Boyd 提交于
      Let's make kernel stacktraces easier to identify by including the build
      ID[1] of a module if the stacktrace is printing a symbol from a module.
      This makes it simpler for developers to locate a kernel module's full
      debuginfo for a particular stacktrace.  Combined with
      scripts/decode_stracktrace.sh, a developer can download the matching
      debuginfo from a debuginfod[2] server and find the exact file and line
      number for the functions plus offsets in a stacktrace that match the
      module.  This is especially useful for pstore crash debugging where the
      kernel crashes are recorded in something like console-ramoops and the
      recovery kernel/modules are different or the debuginfo doesn't exist on
      the device due to space concerns (the debuginfo can be too large for space
      limited devices).
      
      Originally, I put this on the %pS format, but that was quickly rejected
      given that %pS is used in other places such as ftrace where build IDs
      aren't meaningful.  There was some discussions on the list to put every
      module build ID into the "Modules linked in:" section of the stacktrace
      message but that quickly becomes very hard to read once you have more than
      three or four modules linked in.  It also provides too much information
      when we don't expect each module to be traversed in a stacktrace.  Having
      the build ID for modules that aren't important just makes things messy.
      Splitting it to multiple lines for each module quickly explodes the number
      of lines printed in an oops too, possibly wrapping the warning off the
      console.  And finally, trying to stash away each module used in a
      callstack to provide the ID of each symbol printed is cumbersome and would
      require changes to each architecture to stash away modules and return
      their build IDs once unwinding has completed.
      
      Instead, we opt for the simpler approach of introducing new printk formats
      '%pS[R]b' for "pointer symbolic backtrace with module build ID" and '%pBb'
      for "pointer backtrace with module build ID" and then updating the few
      places in the architecture layer where the stacktrace is printed to use
      this new format.
      
      Before:
      
       Call trace:
        lkdtm_WARNING+0x28/0x30 [lkdtm]
        direct_entry+0x16c/0x1b4 [lkdtm]
        full_proxy_write+0x74/0xa4
        vfs_write+0xec/0x2e8
      
      After:
      
       Call trace:
        lkdtm_WARNING+0x28/0x30 [lkdtm 6c2215028606bda50de823490723dc4bc5bf46f9]
        direct_entry+0x16c/0x1b4 [lkdtm 6c2215028606bda50de823490723dc4bc5bf46f9]
        full_proxy_write+0x74/0xa4
        vfs_write+0xec/0x2e8
      
      [akpm@linux-foundation.org: fix build with CONFIG_MODULES=n, tweak code layout]
      [rdunlap@infradead.org: fix build when CONFIG_MODULES is not set]
        Link: https://lkml.kernel.org/r/20210513171510.20328-1-rdunlap@infradead.org
      [akpm@linux-foundation.org: make kallsyms_lookup_buildid() static]
      [cuibixuan@huawei.com: fix build error when CONFIG_SYSFS is disabled]
        Link: https://lkml.kernel.org/r/20210525105049.34804-1-cuibixuan@huawei.com
      
      Link: https://lkml.kernel.org/r/20210511003845.2429846-6-swboyd@chromium.org
      Link: https://fedoraproject.org/wiki/Releases/FeatureBuildId [1]
      Link: https://sourceware.org/elfutils/Debuginfod.html [2]
      Signed-off-by: NStephen Boyd <swboyd@chromium.org>
      Signed-off-by: NBixuan Cui <cuibixuan@huawei.com>
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Evan Green <evgreen@chromium.org>
      Cc: Hsin-Yi Wang <hsinyi@chromium.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9294523e
    • Z
      lib: fix spelling mistakes · 9dbbc3b9
      Zhen Lei 提交于
      Fix some spelling mistakes in comments:
      permanentely ==> permanently
      wont ==> won't
      remaning ==> remaining
      succed ==> succeed
      shouldnt ==> shouldn't
      alpha-numeric ==> alphanumeric
      storeing ==> storing
      funtion ==> function
      documenation ==> documentation
      Determin ==> Determine
      intepreted ==> interpreted
      ammount ==> amount
      obious ==> obvious
      interupts ==> interrupts
      occured ==> occurred
      asssociated ==> associated
      taking into acount ==> taking into account
      squence ==> sequence
      stil ==> still
      contiguos ==> contiguous
      matchs ==> matches
      
      Link: https://lkml.kernel.org/r/20210607072555.12416-1-thunder.leizhen@huawei.comSigned-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9dbbc3b9
  8. 02 7月, 2021 1 次提交
  9. 30 6月, 2021 1 次提交
    • S
      slub: force on no_hash_pointers when slub_debug is enabled · 79270291
      Stephen Boyd 提交于
      Obscuring the pointers that slub shows when debugging makes for some
      confusing slub debug messages:
      
       Padding overwritten. 0x0000000079f0674a-0x000000000d4dce17
      
      Those addresses are hashed for kernel security reasons.  If we're trying
      to be secure with slub_debug on the commandline we have some big problems
      given that we dump whole chunks of kernel memory to the kernel logs.
      Let's force on the no_hash_pointers commandline flag when slub_debug is on
      the commandline.  This makes slub debug messages more meaningful and if by
      chance a kernel address is in some slub debug object dump we will have a
      better chance of figuring out what went wrong.
      
      Note that we don't use %px in the slub code because we want to reduce the
      number of places that %px is used in the kernel.  This also nicely prints
      a big fat warning at kernel boot if slub_debug is on the commandline so
      that we know that this kernel shouldn't be used on production systems.
      
      [akpm@linux-foundation.org: fix build with CONFIG_SLUB_DEBUG=n]
      
      Link: https://lkml.kernel.org/r/20210601182202.3011020-5-swboyd@chromium.orgSigned-off-by: NStephen Boyd <swboyd@chromium.org>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NPetr Mladek <pmladek@suse.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      79270291
  10. 19 5月, 2021 2 次提交
  11. 17 5月, 2021 1 次提交
  12. 23 4月, 2021 1 次提交
  13. 07 4月, 2021 1 次提交
  14. 19 3月, 2021 2 次提交
  15. 17 2月, 2021 1 次提交
  16. 15 2月, 2021 1 次提交
  17. 19 11月, 2020 2 次提交
  18. 25 9月, 2020 1 次提交
  19. 25 8月, 2020 1 次提交
    • G
      lib: Revert use of fallthrough pseudo-keyword in lib/ · 6a9dc5fd
      Gustavo A. R. Silva 提交于
      The following build error for powerpc64 was reported by Nathan Chancellor:
      
        "$ scripts/config --file arch/powerpc/configs/powernv_defconfig -e KERNEL_XZ
      
         $ make -skj"$(nproc)" ARCH=powerpc CROSS_COMPILE=powerpc64le-linux- distclean powernv_defconfig zImage
         ...
         In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:234,
                          from arch/powerpc/boot/decompress.c:38:
         arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c: In function 'dec_main':
         arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:586:4: error: 'fallthrough' undeclared (first use in this function)
           586 |    fallthrough;
               |    ^~~~~~~~~~~
      
         This will end up affecting distribution configurations such as Debian
         and OpenSUSE according to my testing. I am not sure what the solution
         is, the PowerPC wrapper does not set -D__KERNEL__ so I am not sure
         that compiler_attributes.h can be safely included."
      
      In order to avoid these sort of problems, it seems that the best
      solution is to use /* fall through */ comments instead of the
      fallthrough pseudo-keyword macro in lib/, for now.
      Reported-by: NNathan Chancellor <natechancellor@gmail.com>
      Fixes: df561f66 ("treewide: Use fallthrough pseudo-keyword")
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Reviewed-and-tested-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6a9dc5fd
  20. 24 8月, 2020 1 次提交
  21. 01 8月, 2020 3 次提交
  22. 03 7月, 2020 1 次提交
  23. 20 5月, 2020 2 次提交
  24. 15 5月, 2020 1 次提交
    • D
      bpf: Restrict bpf_trace_printk()'s %s usage and add %pks, %pus specifier · b2a5212f
      Daniel Borkmann 提交于
      Usage of plain %s conversion specifier in bpf_trace_printk() suffers from the
      very same issue as bpf_probe_read{,str}() helpers, that is, it is broken on
      archs with overlapping address ranges.
      
      While the helpers have been addressed through work in 6ae08ae3 ("bpf: Add
      probe_read_{user, kernel} and probe_read_{user, kernel}_str helpers"), we need
      an option for bpf_trace_printk() as well to fix it.
      
      Similarly as with the helpers, force users to make an explicit choice by adding
      %pks and %pus specifier to bpf_trace_printk() which will then pick the corresponding
      strncpy_from_unsafe*() variant to perform the access under KERNEL_DS or USER_DS.
      The %pk* (kernel specifier) and %pu* (user specifier) can later also be extended
      for other objects aside strings that are probed and printed under tracing, and
      reused out of other facilities like bpf_seq_printf() or BTF based type printing.
      
      Existing behavior of %s for current users is still kept working for archs where it
      is not broken and therefore gated through CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE.
      For archs not having this property we fall-back to pick probing under KERNEL_DS as
      a sensible default.
      
      Fixes: 8d3b7dce ("bpf: add support for %s specifier to bpf_trace_printk()")
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Link: https://lore.kernel.org/bpf/20200515101118.6508-4-daniel@iogearbox.net
      b2a5212f
  25. 28 2月, 2020 1 次提交
  26. 01 12月, 2019 1 次提交
  27. 17 10月, 2019 1 次提交
    • R
      printf: add support for printing symbolic error names · 57f5677e
      Rasmus Villemoes 提交于
      It has been suggested several times to extend vsnprintf() to be able
      to convert the numeric value of ENOSPC to print "ENOSPC". This
      implements that as a %p extension: With %pe, one can do
      
        if (IS_ERR(foo)) {
          pr_err("Sorry, can't do that: %pe\n", foo);
          return PTR_ERR(foo);
        }
      
      instead of what is seen in quite a few places in the kernel:
      
        if (IS_ERR(foo)) {
          pr_err("Sorry, can't do that: %ld\n", PTR_ERR(foo));
          return PTR_ERR(foo);
        }
      
      If the value passed to %pe is an ERR_PTR, but the library function
      errname() added here doesn't know about the value, the value is simply
      printed in decimal. If the value passed to %pe is not an ERR_PTR, we
      treat it as an ordinary %p and thus print the hashed value (passing
      non-ERR_PTR values to %pe indicates a bug in the caller, but we can't
      do much about that).
      
      With my embedded hat on, and because it's not very invasive to do,
      I've made it possible to remove this. The errname() function and
      associated lookup tables take up about 3K. For most, that's probably
      quite acceptable and a price worth paying for more readable
      dmesg (once this starts getting used), while for those that disable
      printk() it's of very little use - I don't see a
      procfs/sysfs/seq_printf() file reasonably making use of this - and
      they clearly want to squeeze vmlinux as much as possible. Hence the
      default y if PRINTK.
      
      The symbols to include have been found by massaging the output of
      
        find arch include -iname 'errno*.h' | xargs grep -E 'define\s*E'
      
      In the cases where some common aliasing exists
      (e.g. EAGAIN=EWOULDBLOCK on all platforms, EDEADLOCK=EDEADLK on most),
      I've moved the more popular one (in terms of 'git grep -w Efoo | wc)
      to the bottom so that one takes precedence.
      
      Link: http://lkml.kernel.org/r/20191015190706.15989-1-linux@rasmusvillemoes.dk
      To: "Jonathan Corbet" <corbet@lwn.net>
      To: linux-kernel@vger.kernel.org
      Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>
      Cc: "Andrew Morton" <akpm@linux-foundation.org>
      Cc: "Joe Perches" <joe@perches.com>
      Cc: linux-doc@vger.kernel.org
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Acked-by: NUwe Kleine-König <uwe@kleine-koenig.org>
      Reviewed-by: NPetr Mladek <pmladek@suse.com>
      [andy.shevchenko@gmail.com: use abs()]
      Acked-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      57f5677e
  28. 11 10月, 2019 5 次提交