12 Nov, 2021

1 commit

  • commit 4f612ed3f748962cbef1316ff3d323e2b9055b6e upstream.

    We have observed that on very large machines with newer CPUs, the static
    key/branch switching delay is on the order of milliseconds. This is due
    to the required broadcast IPIs, which simply does not scale well to
    hundreds of CPUs (cores). If done too frequently, this can adversely
    affect tail latencies of various workloads.

    One workaround is to increase the sample interval to several seconds,
    while decreasing sampled allocation coverage, but the problem still
    exists and could still increase tail latencies.

    As already noted in the Kconfig help text, there are trade-offs: at
    lower sample intervals the dynamic branch results in better performance;
    however, at very large sample intervals, the static keys mode can result
    in better performance -- careful benchmarking is recommended.

    Our initial benchmarking showed that with large enough sample intervals
    and workloads stressing the allocator, the static keys mode was slightly
    better. Evaluating and observing the possible system-wide side-effects
    of the static-key-switching induced broadcast IPIs, however, was a blind
    spot (in particular on large machines with 100s of cores).

    Therefore, a major downside of the static keys mode is, unfortunately,
    that it is hard to predict performance on new system architectures and
    topologies, but also making conclusions about performance of new
    workloads based on a limited set of benchmarks.

    Most distributions will simply select the defaults, while targeting a
    large variety of different workloads and system architectures. As such,
    the better default is CONFIG_KFENCE_STATIC_KEYS=n, and re-enabling it is
    only recommended after careful evaluation.

    For reference, on x86-64 the condition in kfence_alloc() generates
    exactly
    2 instructions in the kmem_cache_alloc() fast-path:

    | ...
    | cmpl $0x0,0x1a8021c(%rip) # ffffffff82d560d0
    | je ffffffff812d6003
    | ...

    which, given kfence_allocation_gate is infrequently modified, should be
    well predicted by most CPUs.

    Link: https://lkml.kernel.org/r/20211019102524.2807208-2-elver@google.com
    Signed-off-by: Marco Elver
    Cc: Alexander Potapenko
    Cc: Dmitry Vyukov
    Cc: Jann Horn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Marco Elver
     

09 Sep, 2021

2 commits

  • Merge more updates from Andrew Morton:
    "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f.

    Subsystems affected by this patch series: mm (memory-hotplug, rmap,
    ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan),
    alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib,
    checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig,
    selftests, ipc, and scripts"

    * emailed patches from Andrew Morton : (94 commits)
    scripts: check_extable: fix typo in user error message
    mm/workingset: correct kernel-doc notations
    ipc: replace costly bailout check in sysvipc_find_ipc()
    selftests/memfd: remove unused variable
    Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH
    configs: remove the obsolete CONFIG_INPUT_POLLDEV
    prctl: allow to setup brk for et_dyn executables
    pid: cleanup the stale comment mentioning pidmap_init().
    kernel/fork.c: unexport get_{mm,task}_exe_file
    coredump: fix memleak in dump_vma_snapshot()
    fs/coredump.c: log if a core dump is aborted due to changed file permissions
    nilfs2: use refcount_dec_and_lock() to fix potential UAF
    nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group
    nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group
    nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
    nilfs2: fix NULL pointer in nilfs_##name##_attr_release
    nilfs2: fix memory leak in nilfs_sysfs_create_device_group
    trap: cleanup trap_init()
    init: move usermodehelper_enable() to populate_rootfs()
    ...

    Linus Torvalds
     
  • Record cpu and timestamp on allocations and frees, and show them in
    reports. Upon an error, this can help correlate earlier messages in the
    kernel log via allocation and free timestamps.

    Link: https://lkml.kernel.org/r/20210714175312.2947941-1-elver@google.com
    Suggested-by: Joern Engel
    Signed-off-by: Marco Elver
    Acked-by: Alexander Potapenko
    Acked-by: Joern Engel
    Cc: Yuanyuan Zhong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Marco Elver
     

04 Sep, 2021

2 commits

  • Merge misc updates from Andrew Morton:
    "173 patches.

    Subsystems affected by this series: ia64, ocfs2, block, and mm (debug,
    pagecache, gup, swap, shmem, memcg, selftests, pagemap, mremap,
    bootmem, sparsemem, vmalloc, kasan, pagealloc, memory-failure,
    hugetlb, userfaultfd, vmscan, compaction, mempolicy, memblock,
    oom-kill, migration, ksm, percpu, vmstat, and madvise)"

    * emailed patches from Andrew Morton : (173 commits)
    mm/madvise: add MADV_WILLNEED to process_madvise()
    mm/vmstat: remove unneeded return value
    mm/vmstat: simplify the array size calculation
    mm/vmstat: correct some wrong comments
    mm/percpu,c: remove obsolete comments of pcpu_chunk_populated()
    selftests: vm: add COW time test for KSM pages
    selftests: vm: add KSM merging time test
    mm: KSM: fix data type
    selftests: vm: add KSM merging across nodes test
    selftests: vm: add KSM zero page merging test
    selftests: vm: add KSM unmerge test
    selftests: vm: add KSM merge test
    mm/migrate: correct kernel-doc notation
    mm: wire up syscall process_mrelease
    mm: introduce process_mrelease system call
    memblock: make memblock_find_in_range method private
    mm/mempolicy.c: use in_task() in mempolicy_slab_node()
    mm/mempolicy: unify the create() func for bind/interleave/prefer-many policies
    mm/mempolicy: advertise new MPOL_PREFERRED_MANY
    mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY
    ...

    Linus Torvalds
     
  • Move the boot parameter 'kasan.fault' from hw_tags.c to report.c, so it
    can support all KASAN modes - generic, and both tag-based.

    Link: https://lkml.kernel.org/r/20210713010536.3161822-1-woodylin@google.com
    Signed-off-by: Woody Lin
    Reviewed-by: Marco Elver
    Reviewed-by: Andrey Konovalov
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Alexander Potapenko
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Woody Lin
     

03 Sep, 2021

1 commit

  • Pull memory model updates from Ingo Molnar:
    "LKMM updates:

    - Update documentation and code example

    KCSAN updates:

    - Introduce CONFIG_KCSAN_STRICT (which RCU uses)

    - Optimize use of get_ctx() by kcsan_found_watchpoint()

    - Rework atomic.h into permissive.h

    - Add the ability to ignore writes that change only one bit of a
    given data-racy variable.

    - Improve comments"

    * tag 'locking-debug-2021-09-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tools/memory-model: Document data_race(READ_ONCE())
    tools/memory-model: Heuristics using data_race() must handle all values
    tools/memory-model: Add example for heuristic lockless reads
    tools/memory-model: Make read_foo_diagnostic() more clearly diagnostic
    kcsan: Make strict mode imply interruptible watchers
    kcsan: permissive: Ignore data-racy 1-bit value changes
    kcsan: Print if strict or non-strict during init
    kcsan: Rework atomic.h into permissive.h
    kcsan: Reduce get_ctx() uses in kcsan_found_watchpoint()
    kcsan: Introduce CONFIG_KCSAN_STRICT
    kcsan: Remove CONFIG_KCSAN_DEBUG
    kcsan: Improve some Kconfig comments

    Linus Torvalds
     

14 Aug, 2021

2 commits

  • --raw_output is nice, but it would be nicer if could show only output
    after KUnit tests have started.

    So change the flag to allow specifying a string ('kunit').
    Make it so `--raw_output` alone will default to `--raw_output=all` and
    have the same original behavior.

    Drop the small kunit_parser.raw_output() function since it feels wrong
    to put it in "kunit_parser.py" when the point of it is to not parse
    anything.

    E.g.

    $ ./tools/testing/kunit/kunit.py run --raw_output=kunit
    ...
    [15:24:07] Starting KUnit Kernel ...
    TAP version 14
    1..1
    # Subtest: example
    1..3
    # example_simple_test: initializing
    ok 1 - example_simple_test
    # example_skip_test: initializing
    # example_skip_test: You should not see a line below.
    ok 2 - example_skip_test # SKIP this test should be skipped
    # example_mark_skipped_test: initializing
    # example_mark_skipped_test: You should see a line below.
    # example_mark_skipped_test: You should see this line.
    ok 3 - example_mark_skipped_test # SKIP this test should be skipped
    ok 1 - example
    [15:24:10] Elapsed time: 6.487s total, 0.001s configuring, 3.510s building, 0.000s running

    Signed-off-by: Daniel Latypov
    Reviewed-by: David Gow
    Signed-off-by: Shuah Khan

    Daniel Latypov
     
  • kunit.py currently does not make it possible for users to specify module
    parameters (/kernel arguments more generally) unless one directly tweaks
    the kunit.py code itself.

    This hasn't mattered much so far, but this would make it easier to port
    existing tests that expose module parameters over to KUnit and/or let
    current KUnit tests take advantage of them.

    Tested using an kunit internal parameter:
    $ ./tools/testing/kunit/kunit.py run --kunitconfig=lib/kunit \
    --kernel_args=kunit.filter_glob=kunit_status
    ...
    Testing complete. 2 tests run. 0 failed. 0 crashed. 0 skipped.

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

    Daniel Latypov
     

21 Jul, 2021

2 commits

  • Rework atomic.h into permissive.h to better reflect its purpose, and
    introduce kcsan_ignore_address() and kcsan_ignore_data_race().

    Introduce CONFIG_KCSAN_PERMISSIVE and update the stub functions in
    preparation for subsequent changes.

    As before, developers who choose to use KCSAN in "strict" mode will see
    all data races and are not affected. Furthermore, by relying on the
    value-change filter logic for kcsan_ignore_data_race(), even if the
    permissive rules are enabled, the opt-outs in report.c:skip_report()
    override them (such as for RCU-related functions by default).

    The option CONFIG_KCSAN_PERMISSIVE is disabled by default, so that the
    documented default behaviour of KCSAN does not change. Instead, like
    CONFIG_KCSAN_IGNORE_ATOMICS, the option needs to be explicitly opted in.

    Signed-off-by: Marco Elver
    Acked-by: Mark Rutland
    Signed-off-by: Paul E. McKenney

    Marco Elver
     
  • Add a simpler Kconfig variable to configure KCSAN's "strict" mode. This
    makes it simpler in documentation or messages to suggest just a single
    configuration option to select the strictest checking mode (vs.
    currently having to list several options).

    Signed-off-by: Marco Elver
    Acked-by: Mark Rutland
    Signed-off-by: Paul E. McKenney

    Marco Elver
     

13 Jul, 2021

1 commit

  • Commit b6d5799b0b58 ("kunit: Add 'kunit_shutdown' option") changes KUnit
    to call kernel_halt() by default when done testing.

    This fixes the issue with not having .gcda files due to not calling
    atexit() handlers, and therefore we can stop recommending people
    manually tweak UML code.

    The need to use older versions of GCC (
    Reviewed-by: David Gow
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Daniel Latypov
     

05 Jul, 2021

1 commit

  • Pull KCSAN updates from Paul McKenney.

    * 'kcsan.2021.05.18a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
    kcsan: Use URL link for pointing access-marking.txt
    kcsan: Document "value changed" line
    kcsan: Report observed value changes
    kcsan: Remove kcsan_report_type
    kcsan: Remove reporting indirection
    kcsan: Refactor access_info initialization
    kcsan: Fold panic() call into print_report()
    kcsan: Refactor passing watchpoint/other_info
    kcsan: Distinguish kcsan_report() calls
    kcsan: Simplify value change detection
    kcsan: Add pointer to access-marking.txt to data_race() bullet

    Linus Torvalds
     

03 Jul, 2021

1 commit

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

    Pull KUnit update from Shuah Khan:
    "Fixes and features:

    - add support for skipped tests

    - introduce kunit_kmalloc_array/kunit_kcalloc() helpers

    - add gnu_printf specifiers

    - add kunit_shutdown

    - add unit test for filtering suites by names

    - convert lib/test_list_sort.c to use KUnit

    - code organization moving default config to tools/testing/kunit

    - refactor of internal parser input handling

    - cleanups and updates to documentation

    - code cleanup related to casts"

    * tag 'linux-kselftest-kunit-fixes-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (29 commits)
    kunit: add unit test for filtering suites by names
    kasan: test: make use of kunit_skip()
    kunit: test: Add example tests which are always skipped
    kunit: tool: Support skipped tests in kunit_tool
    kunit: Support skipped tests
    thunderbolt: test: Reinstate a few casts of bitfields
    kunit: tool: internal refactor of parser input handling
    lib/test: convert lib/test_list_sort.c to use KUnit
    kunit: introduce kunit_kmalloc_array/kunit_kcalloc() helpers
    kunit: Remove the unused all_tests.config
    kunit: Move default config from arch/um -> tools/testing/kunit
    kunit: arch/um/configs: Enable KUNIT_ALL_TESTS by default
    kunit: Add gnu_printf specifiers
    lib/cmdline_kunit: Remove a cast which are no-longer required
    kernel/sysctl-test: Remove some casts which are no-longer required
    thunderbolt: test: Remove some casts which are no longer required
    mmc: sdhci-of-aspeed: Remove some unnecessary casts from KUnit tests
    iio: Remove a cast in iio-test-format which is no longer required
    device property: Remove some casts in property-entry-test
    Documentation: kunit: Clean up some string casts in examples
    ...

    Linus Torvalds
     

30 Jun, 2021

2 commits

  • Merge misc updates from Andrew Morton:
    "191 patches.

    Subsystems affected by this patch series: kthread, ia64, scripts,
    ntfs, squashfs, ocfs2, kernel/watchdog, and mm (gup, pagealloc, slab,
    slub, kmemleak, dax, debug, pagecache, gup, swap, memcg, pagemap,
    mprotect, bootmem, dma, tracing, vmalloc, kasan, initialization,
    pagealloc, and memory-failure)"

    * emailed patches from Andrew Morton : (191 commits)
    mm,hwpoison: make get_hwpoison_page() call get_any_page()
    mm,hwpoison: send SIGBUS with error virutal address
    mm/page_alloc: split pcp->high across all online CPUs for cpuless nodes
    mm/page_alloc: allow high-order pages to be stored on the per-cpu lists
    mm: replace CONFIG_FLAT_NODE_MEM_MAP with CONFIG_FLATMEM
    mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA
    docs: remove description of DISCONTIGMEM
    arch, mm: remove stale mentions of DISCONIGMEM
    mm: remove CONFIG_DISCONTIGMEM
    m68k: remove support for DISCONTIGMEM
    arc: remove support for DISCONTIGMEM
    arc: update comment about HIGHMEM implementation
    alpha: remove DISCONTIGMEM and NUMA
    mm/page_alloc: move free_the_page
    mm/page_alloc: fix counting of managed_pages
    mm/page_alloc: improve memmap_pages dbg msg
    mm: drop SECTION_SHIFT in code comments
    mm/page_alloc: introduce vm.percpu_pagelist_high_fraction
    mm/page_alloc: limit the number of pages on PCP lists when reclaim is active
    mm/page_alloc: scale the number of pages that are batch freed
    ...

    Linus Torvalds
     
  • The KUNIT_EXPECT_KASAN_FAIL() macro currently uses KUNIT_EXPECT_EQ() to
    compare fail_data.report_expected and fail_data.report_found. This always
    gave a somewhat useless error message on failure, but the addition of
    extra compile-time checking with READ_ONCE() has caused it to get much
    longer, and be truncated before anything useful is displayed.

    Instead, just check fail_data.report_found by hand (we've just set
    report_expected to 'true'), and print a better failure message with
    KUNIT_FAIL(). Because of this, report_expected is no longer used
    anywhere, and can be removed.

    Beforehand, a failure in:
    KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)area)[3100]);
    would have looked like:
    [22:00:34] [FAILED] vmalloc_oob
    [22:00:34] # vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:991
    [22:00:34] Expected ({ do { extern void __compiletime_assert_705(void) __attribute__((__error__("Unsupported access size for {READ,WRITE}_ONCE()."))); if (!((sizeof(fail_data.report_expected) == sizeof(char) || sizeof(fail_data.repp
    [22:00:34] not ok 45 - vmalloc_oob

    With this change, it instead looks like:
    [22:04:04] [FAILED] vmalloc_oob
    [22:04:04] # vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:993
    [22:04:04] KASAN failure expected in "((volatile char *)area)[3100]", but none occurred
    [22:04:04] not ok 45 - vmalloc_oob

    Also update the example failure in the documentation to reflect this.

    Link: https://lkml.kernel.org/r/20210606005531.165954-1-davidgow@google.com
    Signed-off-by: David Gow
    Reviewed-by: Andrey Konovalov
    Reviewed-by: Marco Elver
    Acked-by: Brendan Higgins
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Daniel Axtens
    Cc: David Gow
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Gow
     

24 Jun, 2021

3 commits

  • The default .kunitconfig file is currently kept in
    arch/um/configs/kunit_defconfig, but -- with the impending QEMU patch
    -- will no-longer be exclusively used for UML-based kernels.

    Move it alongside the other KUnit configs in
    tools/testing/kunit/configs, and give it a name which matches the
    existing all_tests.config and broken_on_uml.config files.

    Also update the Getting Started documentation to point to the new file.

    Signed-off-by: David Gow
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    David Gow
     
  • As the type checking is no longer excessively strict, get rid of the
    unsightly (char*) casts -- and comment discussing them -- from the KUnit
    usage page.

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

    David Gow
     
  • We'll be replacing :doc:`foo` references to
    Documentation/foo.rst. Yet, here it happens inside a table.
    Doing a search-and-replace would break it.

    Yet, as there's no good reason to use a table there,
    let's just convert it into a list.

    Reviewed-by: David Gow
    Acked-by: Brendan Higgins
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Shuah Khan

    Mauro Carvalho Chehab
     

18 Jun, 2021

3 commits

  • The :doc:`foo` tag is auto-generated via automarkup.py.
    So, use the filename at the sources, instead of :doc:`foo`.

    Reviewed-by: David Gow
    Acked-by: Brendan Higgins
    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/6fde409079959a95b62b9b2692503608d7ff0dbd.1623824363.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • The :doc:`foo` tag is auto-generated via automarkup.py.
    So, use the filename at the sources, instead of :doc:`foo`.

    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/6bbecd4170ee08f36f8060b0719a46c64a21aefc.1623824363.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     
  • We'll be replacing :doc:`foo` references to
    Documentation/foo.rst. Yet, here it happens inside a table.
    Doing a search-and-replace would break it.

    Yet, as there's no good reason to use a table there,
    let's just convert it into a list.

    Reviewed-by: David Gow
    Acked-by: Brendan Higgins
    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/07d3a8ccafbb6345d6e78fb090290859e84361a1.1623824363.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

15 Jun, 2021

1 commit

  • Add and document more checkpatch message types. About 50% of all
    message types are documented now.

    In addition to this:

    - Create a new subsection 'Indentation and Line Breaks'.
    - Rename subsection 'Comment style' to simply 'Comments'.
    - Refactor some of the existing types to appropriate subsections.

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

    Dwaipayan Ray
     

12 Jun, 2021

1 commit


22 May, 2021

2 commits

  • The kunit_tool documentation page was pretty minimal, and a bit
    outdated. Update it and flesh it out a bit.

    In particular,
    - Mention that .kunitconfig is now in the build directory
    - Describe the use of --kunitconfig to specify a different config
    framgent
    - Mention the split functionality (i.e., commands other than 'run')
    - Describe --raw_output and kunit.py parse
    - Mention the globbing support
    - Provide a quick overview of other options, including --build_dir and
    --alltests

    Note that this does overlap a little with the new running_tips page. I
    don't think it's a problem having both: this page is supposed to be a
    bit more of a reference, rather than a list of useful tips, so the fact
    that they both describe the same features isn't a problem.

    Signed-off-by: David Gow
    Reviewed-by: Daniel Latypov
    Signed-off-by: Shuah Khan

    David Gow
     
  • This is long overdue.

    There are several things that aren't nailed down (in-tree
    .kunitconfig's), or partially broken (GCOV on UML), but having them
    documented, warts and all, is better than having nothing.

    This covers a bunch of the more recent features
    * kunit_filter_glob
    * kunit.py run --kunitconfig
    * slightly more detail on building tests as modules
    * CONFIG_KUNIT_DEBUGFS

    By my count, the only headline features now not mentioned are the KASAN
    integration and KernelCI json output support (kunit.py run --json).

    And then it also discusses how to get code coverage reports under UML
    and non-UML since this is a question people have repeatedly asked.

    Non-UML coverage collection is no different from normal, but we should
    probably explicitly call this out.

    As for UML, I was able to get it working again with two small hacks.*
    E.g. with CONFIG_KUNIT=y && CONFIG_KUNIT_ALL_TESTS=y
    Overall coverage rate:
    lines......: 15.1% (18294 of 120776 lines)
    functions..: 16.8% (1860 of 11050 functions)

    Note: this doesn't document --alltests since this is not stable yet.
    Hopefully being run more frequently as part of KernelCI will help...

    *Using gcc/gcov-6 and not using uml_abort() in os_dump_core().
    I've documented these hacks in "Notes" but left TODOs for
    brendanhiggins@google.com who tracked down the runtime issue in GCC.
    To be clear: these are not issues specific to KUnit, but rather to UML.

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

    Daniel Latypov
     

21 May, 2021

2 commits

  • While include/linux/bitops.h brings in the BIT() macro, it was moved to
    include/linux/bits.h in commit 8bd9cb51daac ("locking/atomics, asm-generic:
    Move some macros from to a new file").

    Since that commit BIT() has moved again into include/vdso/bits.h via
    commit 3945ff37d2f4 ("linux/bits.h: Extract common header for vDSO").

    I think the move to the vDSO header can be considered an implementation
    detail, so for now update the checkpatch documentation to recommend use
    of include/linux/bits.h.

    Signed-off-by: Andrew Jeffery
    Acked-by: Jiri Slaby
    Acked-by: Lukas Bulwahn
    Acked-by: Dwaipayan Ray
    Cc: Jiri Slaby
    Link: https://lore.kernel.org/r/20210520093949.511471-1-andrew@aj.id.au
    Signed-off-by: Jonathan Corbet

    Andrew Jeffery
     
  • - Document a couple of more checkpatch message types.
    - Add a blank line before all `See:` lines to improve the
    rst output.
    - Create a new subsection `Permissions` and move a few types
    to it.

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

    Dwaipayan Ray
     

19 May, 2021

3 commits


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

8 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