07 May, 2021

2 commits

  • arm64 uses SP_EL0 to save the current task_struct address. While running
    in EL0, SP_EL0 is clobbered by userspace. So if the upper bit is not 1
    (not TTBR1), the current address is invalid. This patch checks the upper
    bit of SP_EL0, if the upper bit is 1, lx_current() of arm64 will return
    the derefrence of current task. Otherwise, lx_current() will tell users
    they are running in userspace(EL0).

    While arm64 is running in EL0, it is actually pointless to print current
    task as the memory of kernel space is not accessible in EL0.

    Link: https://lkml.kernel.org/r/20210314203444.15188-3-song.bao.hua@hisilicon.com
    Signed-off-by: Barry Song
    Cc: Jan Kiszka
    Cc: Jonathan Corbet
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Barry Song
     
  • Patch series "scripts/gdb: clarify the platforms supporting lx_current and add arm64 support", v2.

    lx_current depends on per_cpu current_task variable which exists on x86
    only. so it actually works on x86 only. the 1st patch documents this
    clearly; the 2nd patch adds support for arm64.

    This patch (of 2):

    x86 is the only architecture which has per_cpu current_task:

    arch$ git grep current_task | grep -i per_cpu
    x86/include/asm/current.h:DECLARE_PER_CPU(struct task_struct *, current_task);
    x86/kernel/cpu/common.c:DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
    x86/kernel/cpu/common.c:EXPORT_PER_CPU_SYMBOL(current_task);
    x86/kernel/cpu/common.c:DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
    x86/kernel/cpu/common.c:EXPORT_PER_CPU_SYMBOL(current_task);
    x86/kernel/smpboot.c: per_cpu(current_task, cpu) = idle;

    On other architectures, lx_current() will lead to a python exception:

    (gdb) p $lx_current().pid
    Python Exception No symbol "current_task" in current context.:
    Error occurred in Python: No symbol "current_task" in current context.

    To avoid more people struggling and wasting time in other architectures,
    document it.

    Link: https://lkml.kernel.org/r/20210314203444.15188-1-song.bao.hua@hisilicon.com
    Link: https://lkml.kernel.org/r/20210314203444.15188-2-song.bao.hua@hisilicon.com
    Signed-off-by: Barry Song
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Barry Song
     

01 May, 2021

11 commits

  • Update the "Tests" section in KASAN documentation:

    - Add an introductory sentence.

    - Add proper indentation for the list of ways to run KUnit tests.

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/fb08845e25c8847ffda271fa19cda2621c04a65b.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Ignoring accesses" section in KASAN documentation:

    - Mention __no_sanitize_address/noinstr.

    - Mention kasan_disable/enable_current().

    - Mention kasan_reset_tag()/page_kasan_tag_reset().

    - Readability and punctuation clean-ups.

    Link: https://lkml.kernel.org/r/4531ba5f3eca61f6aade863c136778cc8c807a64.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Shadow memory" section in KASAN documentation:

    - Rearrange the introduction paragraph do it doesn't give a
    "KASAN has an issue" impression.

    - Update the list of architectures with vmalloc support.

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/00f8c38b0fd5290a3f4dced04eaba41383e67e14.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Implementation details" section for HW_TAGS KASAN:

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/ee2caf4c138cc1fd239822c2abefd5af6c057744.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Implementation details" section for SW_TAGS KASAN:

    - Clarify the introduction sentence.

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/69b9b2e49d8cf789358fa24558be3fc0ce4ee32c.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Implementation details" section for generic KASAN:

    - Don't mention kmemcheck, it's not present in the kernel anymore.

    - Don't mention GCC as the only supported compiler.

    - Update kasan_mem_to_shadow() definition to match actual code.

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/f2f35fdab701f8c709f63d328f98aec2982c8acc.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Boot parameters" section in KASAN documentation:

    - Mention panic_on_warn.

    - Mention kasan_multi_shot and its interaction with panic_on_warn.

    - Clarify kasan.fault=panic interaction with panic_on_warn.

    - A readability clean-up.

    Link: https://lkml.kernel.org/r/01364952f15789948f0627d6733b5cdf5209f83a.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Error reports" section in KASAN documentation:

    - Mention that bug titles are best-effort.

    - Move and reword the part about auxiliary stacks from "Implementation
    details".

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/3531e8fe6972cf39d1954e3643237b19eb21227e.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Usage" section in KASAN documentation:

    - Add inline code snippet markers.

    - Reword the part about stack traces for clarity.

    - Other minor clean-ups.

    Link: https://lkml.kernel.org/r/48427809cd4b8b5d6bc00926cbe87e2b5081df17.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update the "Overview" section in KASAN documentation:

    - Outline main use cases for each mode.

    - Mention that HW_TAGS mode need compiler support too.

    - Move the part about SLUB/SLAB support from "Usage" to "Overview".

    - Punctuation, readability, and other minor clean-ups.

    Link: https://lkml.kernel.org/r/1486fba8514de3d7db2f47df2192db59228b0a7b.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Update KASAN documentation:

    - Give some sections clearer names.

    - Remove unneeded subsections in the "Tests" section.

    - Move the "For developers" section and split into subsections.

    Link: https://lkml.kernel.org/r/c2bbb56eaea80ad484f0ee85bb71959a3a63f1d7.1615559068.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     

29 Apr, 2021

1 commit

  • Pull locking updates from Ingo Molnar:

    - rtmutex cleanup & spring cleaning pass that removes ~400 lines of
    code

    - Futex simplifications & cleanups

    - Add debugging to the CSD code, to help track down a tenacious race
    (or hw problem)

    - Add lockdep_assert_not_held(), to allow code to require a lock to not
    be held, and propagate this into the ath10k driver

    - Misc LKMM documentation updates

    - Misc KCSAN updates: cleanups & documentation updates

    - Misc fixes and cleanups

    - Fix locktorture bugs with ww_mutexes

    * tag 'locking-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (44 commits)
    kcsan: Fix printk format string
    static_call: Relax static_call_update() function argument type
    static_call: Fix unused variable warn w/o MODULE
    locking/rtmutex: Clean up signal handling in __rt_mutex_slowlock()
    locking/rtmutex: Restrict the trylock WARN_ON() to debug
    locking/rtmutex: Fix misleading comment in rt_mutex_postunlock()
    locking/rtmutex: Consolidate the fast/slowpath invocation
    locking/rtmutex: Make text section and inlining consistent
    locking/rtmutex: Move debug functions as inlines into common header
    locking/rtmutex: Decrapify __rt_mutex_init()
    locking/rtmutex: Remove pointless CONFIG_RT_MUTEXES=n stubs
    locking/rtmutex: Inline chainwalk depth check
    locking/rtmutex: Move rt_mutex_debug_task_free() to rtmutex.c
    locking/rtmutex: Remove empty and unused debug stubs
    locking/rtmutex: Consolidate rt_mutex_init()
    locking/rtmutex: Remove output from deadlock detector
    locking/rtmutex: Remove rtmutex deadlock tester leftovers
    locking/rtmutex: Remove rt_mutex_timed_lock()
    MAINTAINERS: Add myself as futex reviewer
    locking/mutex: Remove repeated declaration
    ...

    Linus Torvalds
     

28 Apr, 2021

2 commits

  • …/kernel/git/shuah/linux-kselftest

    Pull KUnit updates from Shuah Khan:
    "Several fixes and a new feature to support failure from dynamic
    analysis tools such as UBSAN and fake ops for testing.

    - a fake ops struct for testing a "free" function to complain if it
    was called with an invalid argument, or caught a double-free. Most
    return void and have no normal means of signalling failure (e.g.
    super_operations, iommu_ops, etc.)"

    * tag 'linux-kselftest-kunit-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    Documentation: kunit: add tips for using current->kunit_test
    kunit: fix -Wunused-function warning for __kunit_fail_current_test
    kunit: support failure from dynamic analysis tools
    kunit: tool: make --kunitconfig accept dirs, add lib/kunit fragment
    kunit: make KUNIT_EXPECT_STREQ() quote values, don't print literals
    kunit: Match parenthesis alignment to improve code readability

    Linus Torvalds
     
  • …kernel/git/shuah/linux-kselftest

    Pull Kselftest updates from Shuah Khan:

    - fixes and updates to resctrl test from Fenghua Yu and Reinette Chatre

    - fixes to Kselftest documentation, framework

    - minor spelling correction in timers test

    * tag 'linux-kselftest-next-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (25 commits)
    selftests/resctrl: Change a few printed messages
    Documentation: kselftest: fix path to test module files
    selftests/resctrl: Create .gitignore to include resctrl_tests
    selftests/resctrl: Fix checking for < 0 for unsigned values
    selftests/resctrl: Fix incorrect parsing of iMC counters
    selftests/resctrl: Fix unmount resctrl FS
    selftests/resctrl: Skip the test if requested resctrl feature is not supported
    selftests/resctrl: Modularize resctrl test suite main() function
    selftests/resctrl: Don't hard code value of "no_of_bits" variable
    selftests/resctrl: Fix MBA/MBM results reporting format
    selftests/resctrl: Use resctrl/info for feature detection
    selftests/resctrl: Check for resctrl mount point only if resctrl FS is supported
    selftests/resctrl: Add config dependencies
    selftests/resctrl: Fix a printed message
    selftests/resctrl: Share show_cache_info() by CAT and CMT tests
    selftests/resctrl: Call kselftest APIs to log test results
    selftests/resctrl: Rename CQM test as CMT test
    selftests/resctrl: Fix missing options "-n" and "-p"
    selftests/resctrl: Ensure sibling CPU is not same as original CPU
    selftests/resctrl: Clean up resctrl features check
    ...

    Linus Torvalds
     

27 Apr, 2021

1 commit

  • Pull documentation updates from Jonathan Corbet:
    "It's been a relatively busy cycle in docsland, though more than
    usually well contained to Documentation/ itself. Highlights include:

    - The Chinese translators have been busy and show no signs of
    stopping anytime soon. Italian has also caught up.

    - Aditya Srivastava has been working on improvements to the
    kernel-doc script.

    - Thorsten continues his work on reporting-issues.rst and related
    documentation around regression reporting.

    - Lots of documentation updates, typo fixes, etc. as usual"

    * tag 'docs-5.13' of git://git.lwn.net/linux: (139 commits)
    docs/zh_CN: add openrisc translation to zh_CN index
    docs/zh_CN: add openrisc index.rst translation
    docs/zh_CN: add openrisc todo.rst translation
    docs/zh_CN: add openrisc openrisc_port.rst translation
    docs/zh_CN: add core api translation to zh_CN index
    docs/zh_CN: add core-api index.rst translation
    docs/zh_CN: add core-api irq index.rst translation
    docs/zh_CN: add core-api irq irqflags-tracing.rst translation
    docs/zh_CN: add core-api irq irq-domain.rst translation
    docs/zh_CN: add core-api irq irq-affinity.rst translation
    docs/zh_CN: add core-api irq concepts.rst translation
    docs: sphinx-pre-install: don't barf on beta Sphinx releases
    scripts: kernel-doc: improve parsing for kernel-doc comments syntax
    docs/zh_CN: two minor fixes in zh_CN/doc-guide/
    Documentation: dev-tools: Add Testing Overview
    docs/zh_CN: add translations in zh_CN/dev-tools/gcov
    docs: reporting-issues: make people CC the regressions list
    MAINTAINERS: add regressions mailing list
    doc:it_IT: align Italian documentation
    docs/zh_CN: sync reporting-issues.rst
    ...

    Linus Torvalds
     

16 Apr, 2021

1 commit

  • The kernel now has a number of testing and debugging tools, and we've
    seen a bit of confusion about what the differences between them are.

    Add a basic documentation outlining the testing tools, when to use each,
    and how they interact.

    This is a pretty quick overview rather than the idealised "kernel
    testing guide" that'd probably be optimal, but given the number of times
    questions like "When do you use KUnit and when do you use Kselftest?"
    are being asked, it seemed worth at least having something. Hopefully
    this can form the basis for more detailed documentation later.

    Signed-off-by: David Gow
    Reviewed-by: Marco Elver
    Reviewed-by: Daniel Latypov
    Link: https://lore.kernel.org/r/20210415054036.581117-1-davidgow@google.com
    Signed-off-by: Jonathan Corbet

    David Gow
     

11 Apr, 2021

1 commit

  • Architectures supported by KASAN_HW_TAGS can provide a sync or async mode
    of execution. On an MTE enabled arm64 hw for example this can be identified
    with the synchronous or asynchronous tagging mode of execution.
    In synchronous mode, an exception is triggered if a tag check fault occurs.
    In asynchronous mode, if a tag check fault occurs, the TFSR_EL1 register is
    updated asynchronously. The kernel checks the corresponding bits
    periodically.

    KASAN requires a specific kernel command line parameter to make use of this
    hw features.

    Add KASAN HW execution mode kernel command line parameter.

    Note: This patch adds the kasan.mode kernel parameter and the
    sync/async kernel command line options to enable the described features.

    [ Add a new var instead of exposing kasan_arg_mode to be consistent with
    flags for other command line arguments. ]

    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: Alexander Potapenko
    Cc: Andrey Konovalov
    Reviewed-by: Andrey Konovalov
    Acked-by: Catalin Marinas
    Acked-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Vincenzo Frascino
    Signed-off-by: Andrey Konovalov
    Link: https://lore.kernel.org/r/20210315132019.33202-3-vincenzo.frascino@arm.com
    Signed-off-by: Catalin Marinas

    Vincenzo Frascino
     

09 Apr, 2021

1 commit


08 Apr, 2021

1 commit

  • As of commit 359a376081d4 ("kunit: support failure from dynamic analysis
    tools"), we can use current->kunit_test to find the current kunit test.

    Mention this in tips.rst and give an example of how this can be used in
    conjunction with `test->priv` to pass around state and specifically
    implement something like mocking.
    There's a lot more we could go into on that topic, but given that
    example is already longer than every other "tip" on this page, we just
    point to the API docs and leave filling in the blanks as an exercise to
    the reader.

    Also give an example of kunit_fail_current_test().

    Signed-off-by: Daniel Latypov
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Daniel Latypov
     

03 Apr, 2021

1 commit


26 Mar, 2021

1 commit

  • All the error message types now have a verbose description.

    Also there are two new groups of message types:

    - Macros, Attributes and Symbols
    - Functions and Variables

    Rearrange the message types to fit these new groups as needed.

    Signed-off-by: Dwaipayan Ray
    Reviewed-by: Lukas Bulwahn
    Link: https://lore.kernel.org/r/20210322082139.33822-1-dwaipayanray1@gmail.com
    Signed-off-by: Jonathan Corbet

    Dwaipayan Ray
     

09 Mar, 2021

1 commit


07 Mar, 2021

1 commit

  • Add documentation for kernel script checkpatch.pl.
    This documentation is also parsed by checkpatch to
    enable a verbose mode.

    The checkpatch message types are grouped by usage. Under
    each group the types are described briefly. 34 of such
    types are documented.

    Signed-off-by: Dwaipayan Ray
    Link: https://lore.kernel.org/r/20210226093827.12700-2-dwaipayanray1@gmail.com
    Signed-off-by: Jonathan Corbet

    Dwaipayan Ray
     

27 Feb, 2021

4 commits

  • Hwardware tag-based KASAN only reports the first found bug. After that MTE
    tag checking gets disabled. Clarify this in comments and documentation.

    Link: https://lkml.kernel.org/r/00383ba88a47c3f8342d12263c24bdf95527b07d.1612546384.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Branislav Rankov
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Evgenii Stepanov
    Cc: Kevin Brodsky
    Cc: Peter Collingbourne
    Cc: Vincenzo Frascino
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • We cannot rely on CONFIG_DEBUG_KERNEL to decide if we're running a "debug
    kernel" where we can safely show potentially sensitive information in the
    kernel log.

    Instead, simply rely on the newly introduced "no_hash_pointers" to print
    unhashed kernel pointers, as well as decide if our reports can include
    other potentially sensitive information such as registers and corrupted
    bytes.

    Link: https://lkml.kernel.org/r/20210223082043.1972742-1-elver@google.com
    Signed-off-by: Marco Elver
    Cc: Timur Tabi
    Cc: Alexander Potapenko
    Cc: Dmitry Vyukov
    Cc: Andrey Konovalov
    Cc: Jann Horn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marco Elver
     
  • Add KFENCE test suite, testing various error detection scenarios. Makes
    use of KUnit for test organization. Since KFENCE's interface to obtain
    error reports is via the console, the test verifies that KFENCE outputs
    expected reports to the console.

    [elver@google.com: fix typo in test]
    Link: https://lkml.kernel.org/r/X9lHQExmHGvETxY4@elver.google.com
    [elver@google.com: show access type in report]
    Link: https://lkml.kernel.org/r/20210111091544.3287013-2-elver@google.com

    Link: https://lkml.kernel.org/r/20201103175841.3495947-9-elver@google.com
    Signed-off-by: Alexander Potapenko
    Signed-off-by: Marco Elver
    Reviewed-by: Dmitry Vyukov
    Co-developed-by: Alexander Potapenko
    Reviewed-by: Jann Horn
    Cc: Andrey Konovalov
    Cc: Andrey Ryabinin
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Catalin Marinas
    Cc: Christopher Lameter
    Cc: Dave Hansen
    Cc: David Rientjes
    Cc: Eric Dumazet
    Cc: Greg Kroah-Hartman
    Cc: Hillf Danton
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Joern Engel
    Cc: Jonathan Corbet
    Cc: Joonsoo Kim
    Cc: Kees Cook
    Cc: Mark Rutland
    Cc: Paul E. McKenney
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: SeongJae Park
    Cc: Thomas Gleixner
    Cc: Vlastimil Babka
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marco Elver
     
  • Add KFENCE documentation in dev-tools/kfence.rst, and add to index.

    [elver@google.com: add missing copyright header to documentation]
    Link: https://lkml.kernel.org/r/20210118092159.145934-4-elver@google.com

    Link: https://lkml.kernel.org/r/20201103175841.3495947-8-elver@google.com
    Signed-off-by: Alexander Potapenko
    Signed-off-by: Marco Elver
    Reviewed-by: Dmitry Vyukov
    Co-developed-by: Alexander Potapenko
    Reviewed-by: Jann Horn
    Cc: Andrey Konovalov
    Cc: Andrey Ryabinin
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Catalin Marinas
    Cc: Christopher Lameter
    Cc: Dave Hansen
    Cc: David Rientjes
    Cc: Eric Dumazet
    Cc: Greg Kroah-Hartman
    Cc: Hillf Danton
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Joern Engel
    Cc: Jonathan Corbet
    Cc: Joonsoo Kim
    Cc: Kees Cook
    Cc: Mark Rutland
    Cc: Paul E. McKenney
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: SeongJae Park
    Cc: Thomas Gleixner
    Cc: Vlastimil Babka
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marco Elver
     

25 Feb, 2021

2 commits

  • Rename CONFIG_TEST_KASAN_MODULE to CONFIG_KASAN_MODULE_TEST.

    This naming is more consistent with the existing CONFIG_KASAN_KUNIT_TEST.

    Link: https://linux-review.googlesource.com/id/Id347dfa5fe8788b7a1a189863e039f409da0ae5f
    Link: https://lkml.kernel.org/r/f08250246683981bcf8a094fbba7c361995624d2.1610733117.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Reviewed-by: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Branislav Rankov
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Evgenii Stepanov
    Cc: Kevin Brodsky
    Cc: Peter Collingbourne
    Cc: Vincenzo Frascino
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     
  • Mention in the documentation that enabling CONFIG_KASAN_HW_TAGS always
    results in in-kernel TBI (Top Byte Ignore) being enabled.

    Also do a few minor documentation cleanups.

    Link: https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae
    Link: https://lkml.kernel.org/r/3b4ea6875bb14d312092ad14ac55cb456c83c08e.1610733117.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Reviewed-by: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Branislav Rankov
    Cc: Catalin Marinas
    Cc: Dmitry Vyukov
    Cc: Evgenii Stepanov
    Cc: Kevin Brodsky
    Cc: Peter Collingbourne
    Cc: Vincenzo Frascino
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     

23 Feb, 2021

1 commit

  • …/kernel/git/shuah/linux-kselftest

    Pull KUnit updates from Shuah Khan

    - support for filtering test suites using glob from Daniel Latypov.

    "kunit_filter.glob" command line option is passed to the UML
    kernel, which currently only supports filtering by suite name.
    This support allows running different subsets of tests, e.g.

    $ ./tools/testing/kunit/kunit.py build
    $ ./tools/testing/kunit/kunit.py exec 'list*'
    $ ./tools/testing/kunit/kunit.py exec 'kunit*'

    - several fixes and cleanups also from Daniel Latypov.

    * tag 'linux-kselftest-kunit-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    kunit: tool: fix unintentional statefulness in run_kernel()
    kunit: tool: add support for filtering suites by glob
    kunit: add kunit.filter_glob cmdline option to filter suites
    kunit: don't show `1 == 1` in failed assertion messages
    kunit: make kunit_tool accept optional path to .kunitconfig fragment
    Documentation: kunit: add tips.rst for small examples
    KUnit: Docs: make start.rst example Kconfig follow style.rst
    kunit: tool: simplify kconfig is_subset_of() logic
    minor: kunit: tool: fix unit test so it can run from non-root dir
    kunit: tool: use `with open()` in unit test
    kunit: tool: stop using bare asserts in unit test
    kunit: tool: fix unit test cleanup handling

    Linus Torvalds
     

10 Feb, 2021

1 commit

  • Currently, whether the alloc/free stack traces collection is enabled by
    default for hardware tag-based KASAN depends on CONFIG_DEBUG_KERNEL.
    The intention for this dependency was to only enable collection on slow
    debug kernels due to a significant perf and memory impact.

    As it turns out, CONFIG_DEBUG_KERNEL is not considered a debug option
    and is enabled on many productions kernels including Android and Ubuntu.
    As the result, this dependency is pointless and only complicates the
    code and documentation.

    Having stack traces collection disabled by default would make the
    hardware mode work differently to to the software ones, which is
    confusing.

    This change removes the dependency and enables stack traces collection
    by default.

    Looking into the future, this default might makes sense for production
    kernels, assuming we implement a fast stack trace collection approach.

    Link: https://lkml.kernel.org/r/6678d77ceffb71f1cff2cf61560e2ffe7bb6bfe9.1612808820.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Cc: Catalin Marinas
    Cc: Vincenzo Frascino
    Cc: Dmitry Vyukov
    Cc: Alexander Potapenko
    Cc: Will Deacon
    Cc: Andrey Ryabinin
    Cc: Peter Collingbourne
    Cc: Evgenii Stepanov
    Cc: Branislav Rankov
    Cc: Kevin Brodsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     

09 Feb, 2021

2 commits

  • ./usage.rst contains fairly long examples and explanations of things
    like how to fake a class and how to use parameterized tests (and how you
    could do table-driven tests yourself).

    It's not exactly necessary information, so we add a new page with more
    digestible tips like "use kunit_kzalloc() instead of kzalloc() so you
    don't have to worry about calling kfree() yourself" and the like.

    Change start.rst to point users to this new page first and let them know
    that usage.rst is more of optional further reading.

    Signed-off-by: Daniel Latypov
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Daniel Latypov
     
  • The primary change is that we want to encourage people to respect
    KUNIT_ALL_TESTS to make it easy to run all the relevant tests for a
    given config.

    Signed-off-by: Daniel Latypov
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Daniel Latypov
     

25 Jan, 2021

1 commit

  • The initially proposed KASAN command line parameters are redundant.

    This change drops the complex "kasan.mode=off/prod/full" parameter and
    adds a simpler kill switch "kasan=off/on" instead. The new parameter
    together with the already existing ones provides a cleaner way to
    express the same set of features.

    The full set of parameters with this change:

    kasan=off/on - whether KASAN is enabled
    kasan.fault=report/panic - whether to only print a report or also panic
    kasan.stacktrace=off/on - whether to collect alloc/free stack traces

    Default values:

    kasan=on
    kasan.fault=report
    kasan.stacktrace=on (if CONFIG_DEBUG_KERNEL=y)
    kasan.stacktrace=off (otherwise)

    Link: https://linux-review.googlesource.com/id/Ib3694ed90b1e8ccac6cf77dfd301847af4aba7b8
    Link: https://lkml.kernel.org/r/4e9c4a4bdcadc168317deb2419144582a9be6e61.1610736745.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Vincenzo Frascino
    Reviewed-by: Marco Elver
    Cc: Dmitry Vyukov
    Cc: Alexander Potapenko
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Andrey Ryabinin
    Cc: Peter Collingbourne
    Cc: Evgenii Stepanov
    Cc: Branislav Rankov
    Cc: Kevin Brodsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     

16 Jan, 2021

1 commit

  • Commit fadb08e7c750 ("kunit: Support for Parameterized Testing")
    introduced support but lacks documentation for how to use it.

    This patch builds on commit 1f0e943df68a ("Documentation: kunit: provide
    guidance for testing many inputs") to show a minimal example of the new
    feature.

    Signed-off-by: Daniel Latypov
    Reviewed-by: David Gow
    Tested-by: Brendan Higgins
    Acked-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Daniel Latypov
     

23 Dec, 2020

3 commits

  • Merge KASAN updates from Andrew Morton.

    This adds a new hardware tag-based mode to KASAN. The new mode is
    similar to the existing software tag-based KASAN, but relies on arm64
    Memory Tagging Extension (MTE) to perform memory and pointer tagging
    (instead of shadow memory and compiler instrumentation).

    By Andrey Konovalov and Vincenzo Frascino.

    * emailed patches from Andrew Morton : (60 commits)
    kasan: update documentation
    kasan, mm: allow cache merging with no metadata
    kasan: sanitize objects when metadata doesn't fit
    kasan: clarify comment in __kasan_kfree_large
    kasan: simplify assign_tag and set_tag calls
    kasan: don't round_up too much
    kasan, mm: rename kasan_poison_kfree
    kasan, mm: check kasan_enabled in annotations
    kasan: add and integrate kasan boot parameters
    kasan: inline (un)poison_range and check_invalid_free
    kasan: open-code kasan_unpoison_slab
    kasan: inline random_tag for HW_TAGS
    kasan: inline kasan_reset_tag for tag-based modes
    kasan: remove __kasan_unpoison_stack
    kasan: allow VMAP_STACK for HW_TAGS mode
    kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK
    kasan: introduce set_alloc_info
    kasan: rename get_alloc/free_info
    kasan: simplify quarantine_put call site
    kselftest/arm64: check GCR_EL1 after context switch
    ...

    Linus Torvalds
     
  • Pull ARM updates from Russell King:

    - Rework phys/virt translation

    - Add KASan support

    - Move DT out of linear map region

    - Use more PC-relative addressing in assembly

    - Remove FP emulation handling while in kernel mode

    - Link with '-z norelro'

    - remove old check for GCC PA calculations with adr_l call
    ARM: head.S: use PC relative insn sequence to calculate PHYS_OFFSET
    ...

    Linus Torvalds
     
  • This change updates KASAN documentation to reflect the addition of boot
    parameters and also reworks and clarifies some of the existing sections,
    in particular: defines what a memory granule is, mentions quarantine,
    makes Kunit section more readable.

    Link: https://lkml.kernel.org/r/748daf013e17d925b0fe00c1c3b5dce726dd2430.1606162397.git.andreyknvl@google.com
    Link: https://linux-review.googlesource.com/id/Ib1f83e91be273264b25f42b04448ac96b858849f
    Signed-off-by: Andrey Konovalov
    Reviewed-by: Dmitry Vyukov
    Reviewed-by: Marco Elver
    Tested-by: Vincenzo Frascino
    Cc: Alexander Potapenko
    Cc: Andrey Ryabinin
    Cc: Branislav Rankov
    Cc: Catalin Marinas
    Cc: Evgenii Stepanov
    Cc: Kevin Brodsky
    Cc: Vasily Gorbik
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Konovalov