30 Oct, 2020

1 commit

  • The files under Documentation/ABI should follow the syntax
    as defined at Documentation/ABI/README.

    Allow checking if they're following the syntax by running
    the ABI parser script on COMPILE_TEST.

    With that, when there's a problem with a file under
    Documentation/ABI, it would produce a warning like:

    Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#14:
    What '/sys/bus/pci/devices//aer_stats/aer_rootport_total_err_cor' doesn't have a description
    Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#21:
    What '/sys/bus/pci/devices//aer_stats/aer_rootport_total_err_fatal' doesn't have a description

    Acked-by: Jonathan Corbet
    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/57a38de85cb4b548857207cf1fc1bf1ee08613c9.1604042072.git.mchehab+huawei@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Mauro Carvalho Chehab
     

23 Oct, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - Support 'make compile_commands.json' to generate the compilation
    database more easily, avoiding stale entries

    - Support 'make clang-analyzer' and 'make clang-tidy' for static checks
    using clang-tidy

    - Preprocess scripts/modules.lds.S to allow CONFIG options in the
    module linker script

    - Drop cc-option tests from compiler flags supported by our minimal
    GCC/Clang versions

    - Use always 12-digits commit hash for CONFIG_LOCALVERSION_AUTO=y

    - Use sha1 build id for both BFD linker and LLD

    - Improve deb-pkg for reproducible builds and rootless builds

    - Remove stale, useless scripts/namespace.pl

    - Turn -Wreturn-type warning into error

    - Fix build error of deb-pkg when CONFIG_MODULES=n

    - Replace 'hostname' command with more portable 'uname -n'

    - Various Makefile cleanups

    * tag 'kbuild-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
    kbuild: Use uname for LINUX_COMPILE_HOST detection
    kbuild: Only add -fno-var-tracking-assignments for old GCC versions
    kbuild: remove leftover comment for filechk utility
    treewide: remove DISABLE_LTO
    kbuild: deb-pkg: clean up package name variables
    kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
    kbuild: enforce -Werror=return-type
    scripts: remove namespace.pl
    builddeb: Add support for all required debian/rules targets
    builddeb: Enable rootless builds
    builddeb: Pass -n to gzip for reproducible packages
    kbuild: split the build log of kallsyms
    kbuild: explicitly specify the build id style
    scripts/setlocalversion: make git describe output more reliable
    kbuild: remove cc-option test of -Werror=date-time
    kbuild: remove cc-option test of -fno-stack-check
    kbuild: remove cc-option test of -fno-strict-overflow
    kbuild: move CFLAGS_{KASAN,UBSAN,KCSAN} exports to relevant Makefiles
    kbuild: remove redundant CONFIG_KASAN check from scripts/Makefile.kasan
    kbuild: do not create built-in objects for external module builds
    ...

    Linus Torvalds
     

19 Oct, 2020

2 commits

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

    Pull more Kunit updates from Shuah Khan:

    - add Kunit to kernel_init() and remove KUnit from init calls entirely.

    This addresses the concern that Kunit would not work correctly during
    late init phase.

    - add a linker section where KUnit can put references to its test
    suites.

    This is the first step in transitioning to dispatching all KUnit
    tests from a centralized executor rather than having each as its own
    separate late_initcall.

    - add a centralized executor to dispatch tests rather than relying on
    late_initcall to schedule each test suite separately. Centralized
    execution is for built-in tests only; modules will execute tests when
    loaded.

    - convert bitfield test to use KUnit framework

    - Documentation updates for naming guidelines and how
    kunit_test_suite() works.

    - add test plan to KUnit TAP format

    * tag 'linux-kselftest-kunit-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    lib: kunit: Fix compilation test when using TEST_BIT_FIELD_COMPILE
    lib: kunit: add bitfield test conversion to KUnit
    Documentation: kunit: add a brief blurb about kunit_test_suite
    kunit: test: add test plan to KUnit TAP format
    init: main: add KUnit to kernel init
    kunit: test: create a single centralized executor for all tests
    vmlinux.lds.h: add linker section for KUnit test suites
    Documentation: kunit: Add naming guidelines

    Linus Torvalds
     
  • Pull RCU changes from Ingo Molnar:

    - Debugging for smp_call_function()

    - RT raw/non-raw lock ordering fixes

    - Strict grace periods for KASAN

    - New smp_call_function() torture test

    - Torture-test updates

    - Documentation updates

    - Miscellaneous fixes

    [ This doesn't actually pull the tag - I've dropped the last merge from
    the RCU branch due to questions about the series. - Linus ]

    * tag 'core-rcu-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (77 commits)
    smp: Make symbol 'csd_bug_count' static
    kernel/smp: Provide CSD lock timeout diagnostics
    smp: Add source and destination CPUs to __call_single_data
    rcu: Shrink each possible cpu krcp
    rcu/segcblist: Prevent useless GP start if no CBs to accelerate
    torture: Add gdb support
    rcutorture: Allow pointer leaks to test diagnostic code
    rcutorture: Hoist OOM registry up one level
    refperf: Avoid null pointer dereference when buf fails to allocate
    rcutorture: Properly synchronize with OOM notifier
    rcutorture: Properly set rcu_fwds for OOM handling
    torture: Add kvm.sh --help and update help message
    rcutorture: Add CONFIG_PROVE_RCU_LIST to TREE05
    torture: Update initrd documentation
    rcutorture: Replace HTTP links with HTTPS ones
    locktorture: Make function torture_percpu_rwsem_init() static
    torture: document --allcpus argument added to the kvm.sh script
    rcutorture: Output number of elapsed grace periods
    rcutorture: Remove KCSAN stubs
    rcu: Remove unused "cpu" parameter from rcu_report_qs_rdp()
    ...

    Linus Torvalds
     

17 Oct, 2020

1 commit

  • Patch series "add fault injection to user memory access", v3.

    The goal of this series is to improve testing of fault-tolerance in usages
    of user memory access functions, by adding support for fault injection.

    syzkaller/syzbot are using the existing fault injection modes and will use
    this particular feature also.

    The first patch adds failure injection capability for usercopy functions.
    The second changes usercopy functions to use this new failure capability
    (copy_from_user, ...). The third patch adds get/put/clear_user failures
    to x86.

    This patch (of 3):

    Add a failure injection capability to improve testing of fault-tolerance
    in usages of user memory access functions.

    Add CONFIG_FAULT_INJECTION_USERCOPY to enable faults in usercopy
    functions. The should_fail_usercopy function is to be called by these
    functions (copy_from_user, get_user, ...) in order to fail or not.

    Signed-off-by: Albert van der Linde
    Signed-off-by: Andrew Morton
    Reviewed-by: Akinobu Mita
    Reviewed-by: Alexander Potapenko
    Cc: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Jonathan Corbet
    Cc: Thomas Gleixner
    Cc: Arnd Bergmann
    Cc: Peter Zijlstra (Intel)
    Cc: "H. Peter Anvin"
    Cc: Al Viro
    Cc: Andrey Konovalov
    Cc: Dmitry Vyukov
    Cc: Marco Elver
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20200831171733.955393-1-alinde@google.com
    Link: http://lkml.kernel.org/r/20200831171733.955393-2-alinde@google.com
    Signed-off-by: Linus Torvalds

    Albert van der Linde
     

14 Oct, 2020

2 commits

  • Here is a very rare race which leaks memory:

    Page P0 is allocated to the page cache. Page P1 is free.

    Thread A Thread B Thread C
    find_get_entry():
    xas_load() returns P0
    Removes P0 from page cache
    P0 finds its buddy P1
    alloc_pages(GFP_KERNEL, 1) returns P0
    P0 has refcount 1
    page_cache_get_speculative(P0)
    P0 has refcount 2
    __free_pages(P0)
    P0 has refcount 1
    put_page(P0)
    P1 is not freed

    Fix this by freeing all the pages in __free_pages() that won't be freed
    by the call to put_page(). It's usually not a good idea to split a page,
    but this is a very unlikely scenario.

    Fixes: e286781d5f2e ("mm: speculative page references")
    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Andrew Morton
    Acked-by: Mike Rapoport
    Cc: Nick Piggin
    Cc: Hugh Dickins
    Cc: Peter Zijlstra
    Link: https://lkml.kernel.org/r/20200926213919.26642-1-willy@infradead.org
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     
  • This adds the conversion of the runtime tests of test_bitfield,
    from `lib/test_bitfield.c` to KUnit tests.

    Code Style Documentation: [0]

    Signed-off-by: Vitor Massaru Iha
    Link: [0] https://lore.kernel.org/linux-kselftest/20200620054944.167330-1-davidgow@google.com/T/#u
    Reviewed-by: Brendan Higgins
    Signed-off-by: Shuah Khan

    Vitor Massaru Iha
     

09 Oct, 2020

1 commit

  • …k/linux-rcu into core/rcu

    Pull v5.10 RCU changes from Paul E. McKenney:

    - Debugging for smp_call_function().

    - Strict grace periods for KASAN. The point of this series is to find
    RCU-usage bugs, so the corresponding new RCU_STRICT_GRACE_PERIOD
    Kconfig option depends on both DEBUG_KERNEL and RCU_EXPERT, and is
    further disabled by dfefault. Finally, the help text includes
    a goodly list of scary caveats.

    - New smp_call_function() torture test.

    - Torture-test updates.

    - Documentation updates.

    - Miscellaneous fixes.

    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

20 Sep, 2020

1 commit

  • This moves the KCSAN kconfig items under menu 'Generic Kernel Debugging
    Instruments' where UBSAN resides.

    Signed-off-by: Changbin Du
    Signed-off-by: Andrew Morton
    Tested-by: Randy Dunlap
    Reviewed-by: Randy Dunlap
    Cc: Greg Kroah-Hartman
    Cc: Marco Elver
    Link: https://lkml.kernel.org/r/20200904152224.5570-1-changbin.du@gmail.com
    Signed-off-by: Linus Torvalds

    Changbin Du
     

05 Sep, 2020

2 commits

  • csd.2020.09.04a: CPU smp_call_function() torture tests.

    Paul E. McKenney
     
  • This commit causes csd_lock_wait() to emit diagnostics when a CPU
    fails to respond quickly enough to one of the smp_call_function()
    family of function calls. These diagnostics are enabled by a new
    CSD_LOCK_WAIT_DEBUG Kconfig option that depends on DEBUG_KERNEL.

    This commit was inspired by an earlier patch by Josef Bacik.

    [ paulmck: Fix for syzbot+0f719294463916a3fc0e@syzkaller.appspotmail.com ]
    [ paulmck: Fix KASAN use-after-free issue reported by Qian Cai. ]
    [ paulmck: Fix botched nr_cpu_ids comparison per Dan Carpenter. ]
    [ paulmck: Apply Peter Zijlstra feedback. ]
    Link: https://lore.kernel.org/lkml/00000000000042f21905a991ecea@google.com
    Link: https://lore.kernel.org/lkml/0000000000002ef21705a9933cf3@google.com
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Sebastian Andrzej Siewior
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

26 Aug, 2020

1 commit


25 Aug, 2020

1 commit


13 Aug, 2020

5 commits

  • There exists duplicated "the" in the help text of CONFIG_PANIC_TIMEOUT,
    Remove it.

    Signed-off-by: Tiezhu Yang
    Signed-off-by: Andrew Morton
    Reviewed-by: Kees Cook
    Cc: Xuefeng Li
    Link: http://lkml.kernel.org/r/1591103358-32087-2-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Linus Torvalds

    Tiezhu Yang
     
  • Add tests of GENMASK and GENMASK_ULL.

    A few test cases that should fail compilation are provided under #ifdef
    TEST_GENMASK_FAILURES

    [rd.dunlap@gmail.com: add MODULE_LICENSE()]
    Link: http://lkml.kernel.org/r/dfc74524-0789-2827-4eff-476ddab65699@gmail.com
    [weiyongjun1@huawei.com: make some functions static]
    Link: http://lkml.kernel.org/r/20200702150336.4756-1-weiyongjun1@huawei.com

    Suggested-by: Andy Shevchenko
    Signed-off-by: Rikard Falkeborn
    Signed-off-by: Randy Dunlap
    Signed-off-by: Wei Yongjun
    Signed-off-by: Andrew Morton
    Reviewed-by: Andy Shevchenko
    Acked-by: William Breathitt Gray
    Cc: Emil Velikov
    Cc: Syed Nayyar Waris
    Cc: Andy Shevchenko
    Cc: Arnd Bergmann
    Cc: Geert Uytterhoeven
    Cc: Kees Cook
    Cc: Linus Walleij
    Cc: Masahiro Yamada
    Link: http://lkml.kernel.org/r/20200621054210.14804-2-rikard.falkeborn@gmail.com
    Link: http://lkml.kernel.org/r/20200608221823.35799-2-rikard.falkeborn@gmail.com
    Signed-off-by: Linus Torvalds

    Rikard Falkeborn
     
  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Andrew Morton
    Acked-by: Coly Li [crc64.c]
    Link: http://lkml.kernel.org/r/20200726112154.16510-1-grandmaster@al2klimov.de
    Signed-off-by: Linus Torvalds

    Alexander A. Klimov
     
  • Since test_lockup is a test module to generate lockups, it is better to
    limit TEST_LOCKUP to module (=m) or disabled (=n) because we can not use
    the module parameters when CONFIG_TEST_LOCKUP=y.

    Signed-off-by: Tiezhu Yang
    Signed-off-by: Andrew Morton
    Reviewed-by: Guenter Roeck
    Cc: Konstantin Khlebnikov
    Cc: Kees Cook
    Link: http://lkml.kernel.org/r/1595555407-29875-1-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Linus Torvalds

    Tiezhu Yang
     
  • Recently 0day reported many strange performance changes (regression or
    improvement), in which there was no obvious relation between the culprit
    commit and the benchmark at the first look, and it causes people to doubt
    the test itself is wrong.

    Upon further check, many of these cases are caused by the change to the
    alignment of kernel text or data, as whole text/data of kernel are linked
    together, change in one domain may affect alignments of other domains.

    gcc has an option '-falign-functions=n' to force text aligned, and with
    that option enabled, some of those performance changes will be gone, like
    [1][2][3].

    Add this option so that developers and 0day can easily find performance
    bump caused by text alignment change, as tracking these strange bump is
    quite time consuming. Though it can't help in other cases like data
    alignment changes like [4].

    Following is some size data for v5.7 kernel built with a RHEL config used
    in 0day:

    text data bss dec filename
    19738771 13292906 5554236 38585913 vmlinux.noalign
    19758591 13297002 5529660 38585253 vmlinux.align32

    Raw vmlinux size in bytes:

    v5.7 v5.7+align32
    253950832 254018000 +0.02%

    Some benchmark data, most of them have no big change:

    * hackbench: [ -1.8%, +0.5%]

    * fsmark: [ -3.2%, +3.4%] # ext4/xfs/btrfs

    * kbuild: [ -2.0%, +0.9%]

    * will-it-scale: [ -0.5%, +1.8%] # mmap1/pagefault3

    * netperf:
    - TCP_CRR [+16.6%, +97.4%]
    - TCP_RR [-18.5%, -1.8%]
    - TCP_STREAM [ -1.1%, +1.9%]

    [1] https://lore.kernel.org/lkml/20200114085637.GA29297@shao2-debian/
    [2] https://lore.kernel.org/lkml/20200330011254.GA14393@feng-iot/
    [3] https://lore.kernel.org/lkml/1d98d1f0-fe84-6df7-f5bd-f4cb2cdb7f45@intel.com/
    [4] https://lore.kernel.org/lkml/20200205123216.GO12867@shao2-debian/

    Signed-off-by: Feng Tang
    Signed-off-by: Andrew Morton
    Cc: Masahiro Yamada
    Cc: Michal Marek
    Cc: Andi Kleen
    Cc: Huang Ying
    Cc: Andy Shevchenko
    Link: http://lkml.kernel.org/r/1595475001-90945-1-git-send-email-feng.tang@intel.com
    Signed-off-by: Linus Torvalds

    Feng Tang
     

06 Aug, 2020

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the "big" set of changes to the driver core, and some drivers
    using the changes, for 5.9-rc1.

    "Biggest" thing in here is the device link exposure in sysfs, to help
    to tame the madness that is SoC device tree representations and driver
    interactions with it.

    Other stuff in here that is interesting is:

    - device probe log helper so that drivers can report problems in a
    unified way easier.

    - devres functions added

    - DEVICE_ATTR_ADMIN_* macro added to make it harder to write
    incorrect sysfs file permissions

    - documentation cleanups

    - ability for debugfs to be present in the kernel, yet not exposed to
    userspace. Needed for systems that want it enabled, but do not
    trust users, so they can still use some kernel functions that were
    otherwise disabled.

    - other minor fixes and cleanups

    The patches outside of drivers/base/ all have acks from the respective
    subsystem maintainers to go through this tree instead of theirs.

    All of these have been in linux-next with no reported issues"

    * tag 'driver-core-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (39 commits)
    drm/bridge: lvds-codec: simplify error handling
    drm/bridge/sii8620: fix resource acquisition error handling
    driver core: add deferring probe reason to devices_deferred property
    driver core: add device probe log helper
    driver core: Avoid binding drivers to dead devices
    Revert "test_firmware: Test platform fw loading on non-EFI systems"
    firmware_loader: EFI firmware loader must handle pre-allocated buffer
    selftest/firmware: Add selftest timeout in settings
    test_firmware: Test platform fw loading on non-EFI systems
    driver core: Change delimiter in devlink device's name to "--"
    debugfs: Add access restriction option
    tracefs: Remove unnecessary debug_fs checks.
    driver core: Fix probe_count imbalance in really_probe()
    kobject: remove unused KOBJ_MAX action
    driver core: Fix sleeping in invalid context during device link deletion
    driver core: Add waiting_for_supplier sysfs file for devices
    driver core: Add state_synced sysfs file for devices that support it
    driver core: Expose device link details in sysfs
    driver core: Drop mention of obsolete bus rwsem from kernel-doc
    debugfs: file: Remove unnecessary cast in kfree()
    ...

    Linus Torvalds
     

04 Aug, 2020

1 commit


03 Aug, 2020

1 commit


29 Jul, 2020

1 commit

  • Asserting that preemption is enabled or disabled is a critical sanity
    check. Developers are usually reluctant to add such a check in a
    fastpath as reading the preemption count can be costly.

    Extend the lockdep API with macros asserting that preemption is disabled
    or enabled. If lockdep is disabled, or if the underlying architecture
    does not support kernel preemption, this assert has no runtime overhead.

    References: f54bb2ec02c8 ("locking/lockdep: Add IRQs disabled/enabled assertion APIs: ...")
    Signed-off-by: Ahmed S. Darwish
    Signed-off-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20200720155530.1173732-8-a.darwish@linutronix.de

    Ahmed S. Darwish
     

27 Jul, 2020

1 commit

  • Prior to commit:

    859d069ee1dd ("lockdep: Prepare for NMI IRQ state tracking")

    IRQ state tracking was disabled in NMIs due to nmi_enter()
    doing lockdep_off() -- with the obvious requirement that NMI entry
    call nmi_enter() before trace_hardirqs_off().

    [ AFAICT, PowerPC and SH violate this order on their NMI entry ]

    However, that commit explicitly changed lockdep_hardirqs_*() to ignore
    lockdep_off() and breaks every architecture that has irq-tracing in
    it's NMI entry that hasn't been fixed up (x86 being the only fixed one
    at this point).

    The reason for this change is that by ignoring lockdep_off() we can:

    - get rid of 'current->lockdep_recursion' in lockdep_assert_irqs*()
    which was going to to give header-recursion issues with the
    seqlock rework.

    - allow these lockdep_assert_*() macros to function in NMI context.

    Restore the previous state of things and allow an architecture to
    opt-in to the NMI IRQ tracking support, however instead of relying on
    lockdep_off(), rely on in_nmi(), both are part of nmi_enter() and so
    over-all entry ordering doesn't need to change.

    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Link: https://lore.kernel.org/r/20200727124852.GK119549@hirez.programming.kicks-ass.net

    peterz@infradead.org
     

23 Jul, 2020

1 commit

  • Since debugfs include sensitive information it need to be treated
    carefully. But it also has many very useful debug functions for userspace.
    With this option we can have same configuration for system with
    need of debugfs and a way to turn it off. This gives a extra protection
    for exposure on systems where user-space services with system
    access are attacked.

    It is controlled by a configurable default value that can be override
    with a kernel command line parameter. (debugfs=)

    It can be on or off, but also internally on but not seen from user-space.
    This no-mount mode do not register a debugfs as filesystem, but client can
    register their parts in the internal structures. This data can be readed
    with a debugger or saved with a crashkernel. When it is off clients
    get EPERM error when accessing the functions for registering their
    components.

    Signed-off-by: Peter Enderborg
    Link: https://lore.kernel.org/r/20200716071511.26864-3-peter.enderborg@sony.com
    Signed-off-by: Greg Kroah-Hartman

    Peter Enderborg
     

03 Jul, 2020

1 commit

  • There is no extra interrupt when registering a shared interrupt handler
    since 2011. Update the Kconfig text to make it clear and to avoid wrong
    assumptions when debugging issues found by it.

    Fixes: 6d83f94db95c ("genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for now")
    Link: https://lore.kernel.org/linux-i2c/859e8211-2c56-8dd5-d6fb-33e4358e4128@pengutronix.de/T/#mf24d7070d7e0c8f17b6be6ceb51df94b7d7613b3
    Reviewed-by: Krzysztof Kozlowski
    Acked-by: Andy Shevchenko
    Signed-off-by: Wolfram Sang
    Link: https://lore.kernel.org/r/20200702222024.6915-1-wsa+renesas@sang-engineering.com
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     

29 Jun, 2020

1 commit

  • Add a selftest for the usage of FPU code in kernel mode.

    Currently only implemented for x86. In the future, kernel FPU testing
    could be unified between the different architectures supporting it.

    [ bp:

    - Split out from a conglomerate patch, put comments over statements.
    - run the test only on debugfs write.
    - Add bare-minimum run_test_fpu.sh, run 1000 iterations on all CPUs
    by default.
    - Add conditionally -msse2 so that clang doesn't generate library
    calls.
    - Use cc-option to detect gcc 7.1 not supporting -mpreferred-stack-boundary=3 (amluto).
    - Document stuff so that we don't forget.
    - Fix:
    ld: lib/test_fpu.o: in function `test_fpu_get':
    >> test_fpu.c:(.text+0x16e): undefined reference to `__sanitizer_cov_trace_cmpd'
    >> ld: test_fpu.c:(.text+0x1a7): undefined reference to `__sanitizer_cov_trace_cmpd'
    ld: test_fpu.c:(.text+0x1e0): undefined reference to `__sanitizer_cov_trace_cmpd'
    ]

    Reported-by: kernel test robot
    Signed-off-by: Petteri Aimonen
    Signed-off-by: Borislav Petkov
    Reviewed-by: Nick Desaulniers
    Link: https://lkml.kernel.org/r/20200624114646.28953-3-bp@alien8.de

    Petteri Aimonen
     

17 Jun, 2020

1 commit

  • cc-option and as-option are almost the same; both pass the flag to
    $(CC). The main difference is the cc-option stops before the assemble
    stage (-S option) whereas as-option stops after (-c option).

    I chose -S because it is slightly faster, but $(cc-option,-gz=zlib)
    returns a wrong result (https://lkml.org/lkml/2020/6/9/1529).
    It has been fixed by commit 7b16994437c7 ("Makefile: Improve compressed
    debug info support detection"), but the assembler should always be
    invoked for more reliable compiler option tests.

    However, you cannot simply replace -S with -c because the following
    code in lib/Kconfig.debug would break:

    depends on $(cc-option,-gsplit-dwarf)

    The combination of -c and -gsplit-dwarf does not accept /dev/null as
    output.

    $ cat /dev/null | gcc -gsplit-dwarf -S -x c - -o /dev/null
    $ echo $?
    0

    $ cat /dev/null | gcc -gsplit-dwarf -c -x c - -o /dev/null
    objcopy: Warning: '/dev/null' is not an ordinary file
    $ echo $?
    1

    $ cat /dev/null | gcc -gsplit-dwarf -c -x c - -o tmp.o
    $ echo $?
    0

    There is another flag that creates an separate file based on the
    object file path:

    $ cat /dev/null | gcc -ftest-coverage -c -x c - -o /dev/null
    :1: error: cannot open /dev/null.gcno

    So, we cannot use /dev/null to sink the output.

    Align the cc-option implementation with scripts/Kbuild.include.

    With -c option used in cc-option, as-option is unneeded.

    Signed-off-by: Masahiro Yamada
    Acked-by: Will Deacon

    Masahiro Yamada
     

15 Jun, 2020

1 commit

  • Commit
    10e68b02c861 ("Makefile: support compressed debug info")
    added support for compressed debug sections.

    Support is detected by checking
    - does the compiler support -gz=zlib
    - does the assembler support --compressed-debug-sections=zlib
    - does the linker support --compressed-debug-sections=zlib

    However, the gcc driver's support for this option is somewhat
    convoluted. The driver's builtin specs are set based on the version of
    binutils that it was configured with. It reports an error if the
    configure-time linker/assembler (i.e., not necessarily the actual
    assembler that will be run) do not support the option, but only if the
    assembler (or linker) is actually invoked when -gz=zlib is passed.

    The cc-option check in scripts/Kconfig.include does not invoke the
    assembler, so the gcc driver reports success even if it does not support
    the option being passed to the assembler.

    Because the as-option check passes the option directly to the assembler
    via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
    this option and will never report an error.

    Combined with an installed version of binutils that is more recent than
    the one the compiler was built with, it is possible for all three tests
    to succeed, yet an actual compilation with -gz=zlib to fail.

    Moreover, it is unnecessary to explicitly pass
    --compressed-debug-sections=zlib to the assembler via -Wa, since the
    driver will do that automatically when it supports -gz=zlib.

    Convert the as-option to just -gz=zlib, simplifying it as well as
    performing a better test of the gcc driver's capabilities.

    Reported-by: kernel test robot
    Signed-off-by: Arvind Sankar
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada

    Arvind Sankar
     

14 Jun, 2020

2 commits

  • Pull more Kbuild updates from Masahiro Yamada:

    - fix build rules in binderfs sample

    - fix build errors when Kbuild recurses to the top Makefile

    - covert '---help---' in Kconfig to 'help'

    * tag 'kbuild-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    treewide: replace '---help---' in Kconfig files with 'help'
    kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables
    samples: binderfs: really compile this sample and fix build issues

    Linus Torvalds
     
  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

12 Jun, 2020

2 commits

  • Pull the Kernel Concurrency Sanitizer from Thomas Gleixner:
    "The Kernel Concurrency Sanitizer (KCSAN) is a dynamic race detector,
    which relies on compile-time instrumentation, and uses a
    watchpoint-based sampling approach to detect races.

    The feature was under development for quite some time and has already
    found legitimate bugs.

    Unfortunately it comes with a limitation, which was only understood
    late in the development cycle:

    It requires an up to date CLANG-11 compiler

    CLANG-11 is not yet released (scheduled for June), but it's the only
    compiler today which handles the kernel requirements and especially
    the annotations of functions to exclude them from KCSAN
    instrumentation correctly.

    These annotations really need to work so that low level entry code and
    especially int3 text poke handling can be completely isolated.

    A detailed discussion of the requirements and compiler issues can be
    found here:

    https://lore.kernel.org/lkml/CANpmjNMTsY_8241bS7=XAfqvZHFLrVEkv_uM4aDUWE_kh3Rvbw@mail.gmail.com/

    We came to the conclusion that trying to work around compiler
    limitations and bugs again would end up in a major trainwreck, so
    requiring a working compiler seemed to be the best choice.

    For Continous Integration purposes the compiler restriction is
    manageable and that's where most xxSAN reports come from.

    For a change this limitation might make GCC people actually look at
    their bugs. Some issues with CSAN in GCC are 7 years old and one has
    been 'fixed' 3 years ago with a half baken solution which 'solved' the
    reported issue but not the underlying problem.

    The KCSAN developers also ponder to use a GCC plugin to become
    independent, but that's not something which will show up in a few
    days.

    Blocking KCSAN until wide spread compiler support is available is not
    a really good alternative because the continuous growth of lockless
    optimizations in the kernel demands proper tooling support"

    * tag 'locking-kcsan-2020-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (76 commits)
    compiler_types.h, kasan: Use __SANITIZE_ADDRESS__ instead of CONFIG_KASAN to decide inlining
    compiler.h: Move function attributes to compiler_types.h
    compiler.h: Avoid nested statement expression in data_race()
    compiler.h: Remove data_race() and unnecessary checks from {READ,WRITE}_ONCE()
    kcsan: Update Documentation to change supported compilers
    kcsan: Remove 'noinline' from __no_kcsan_or_inline
    kcsan: Pass option tsan-instrument-read-before-write to Clang
    kcsan: Support distinguishing volatile accesses
    kcsan: Restrict supported compilers
    kcsan: Avoid inserting __tsan_func_entry/exit if possible
    ubsan, kcsan: Don't combine sanitizer with kcov on clang
    objtool, kcsan: Add kcsan_disable_current() and kcsan_enable_current_nowarn()
    kcsan: Add __kcsan_{enable,disable}_current() variants
    checkpatch: Warn about data_race() without comment
    kcsan: Use GFP_ATOMIC under spin lock
    Improve KCSAN documentation a bit
    kcsan: Make reporting aware of KCSAN tests
    kcsan: Fix function matching in report
    kcsan: Change data_race() to no longer require marking racing accesses
    kcsan: Move kcsan_{disable,enable}_current() to kcsan-checks.h
    ...

    Linus Torvalds
     
  • Merge the state of the locking kcsan branch before the read/write_once()
    and the atomics modifications got merged.

    Squash the fallout of the rebase on top of the read/write once and atomic
    fallback work into the merge. The history of the original branch is
    preserved in tag locking-kcsan-2020-06-02.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

11 Jun, 2020

1 commit

  • Add some tests for get_count_order/long in test_bitops.c.

    [akpm@linux-foundation.org: define local `i']
    [akpm@linux-foundation.org: enhancement, warning fix, cleanup per Geert]
    [akpm@linux-foundation.org: fix loop bound, per Wei Yang]

    Signed-off-by: Wei Yang
    Signed-off-by: Andrew Morton
    Reviewed-by: Andy Shevchenko
    Cc: Christian Brauner
    Cc: Geert Uytterhoeven
    Link: http://lkml.kernel.org/r/20200602223728.32722-1-richard.weiyang@gmail.com
    Signed-off-by: Linus Torvalds

    Wei Yang
     

10 Jun, 2020

1 commit

  • …kernel/git/shuah/linux-kselftest

    Pull Kunit updates from Shuah Khan:
    "This consists of:

    - Several config fragment fixes from Anders Roxell to improve test
    coverage.

    - Improvements to kunit run script to use defconfig as default and
    restructure the code for config/build/exec/parse from Vitor Massaru
    Iha and David Gow.

    - Miscellaneous documentation warn fix"

    * tag 'linux-kselftest-kunit-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    security: apparmor: default KUNIT_* fragments to KUNIT_ALL_TESTS
    fs: ext4: default KUNIT_* fragments to KUNIT_ALL_TESTS
    drivers: base: default KUNIT_* fragments to KUNIT_ALL_TESTS
    lib: Kconfig.debug: default KUNIT_* fragments to KUNIT_ALL_TESTS
    kunit: default KUNIT_* fragments to KUNIT_ALL_TESTS
    kunit: Kconfig: enable a KUNIT_ALL_TESTS fragment
    kunit: Fix TabError, remove defconfig code and handle when there is no kunitconfig
    kunit: use KUnit defconfig by default
    kunit: use --build_dir=.kunit as default
    Documentation: test.h - fix warnings
    kunit: kunit_tool: Separate out config/build/exec/parse

    Linus Torvalds
     

09 Jun, 2020

1 commit

  • Instead of enabling dynamic debug globally with CONFIG_DYNAMIC_DEBUG,
    CONFIG_DYNAMIC_DEBUG_CORE will only enable core function of dynamic
    debug. With the DYNAMIC_DEBUG_MODULE defined for any modules, dynamic
    debug will be tied to them.

    This is useful for people who only want to enable dynamic debug for
    kernel modules without worrying about kernel image size and memory
    consumption is increasing too much.

    [orson.zhai@unisoc.com: v2]
    Link: http://lkml.kernel.org/r/1587408228-10861-1-git-send-email-orson.unisoc@gmail.com

    Signed-off-by: Orson Zhai
    Signed-off-by: Andrew Morton
    Acked-by: Greg Kroah-Hartman
    Acked-by: Petr Mladek
    Cc: Jonathan Corbet
    Cc: Sergey Senozhatsky
    Cc: Steven Rostedt
    Cc: Jason Baron
    Cc: Randy Dunlap
    Link: http://lkml.kernel.org/r/1586521984-5890-1-git-send-email-orson.unisoc@gmail.com
    Signed-off-by: Linus Torvalds

    Orson Zhai
     

07 Jun, 2020

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - fix warnings in 'make clean' for ARCH=um, hexagon, h8300, unicore32

    - ensure to rebuild all objects when the compiler is upgraded

    - exclude system headers from dependency tracking and fixdep processing

    - fix potential bit-size mismatch between the kernel and BPF user-mode
    helper

    - add the new syntax 'userprogs' to build user-space programs for the
    target architecture (the same arch as the kernel)

    - compile user-space sample code under samples/ for the target arch
    instead of the host arch

    - make headers_install fail if a CONFIG option is leaked to user-space

    - sanitize the output format of scripts/checkstack.pl

    - handle ARM 'push' instruction in scripts/checkstack.pl

    - error out before modpost if a module name conflict is found

    - error out when multiple directories are passed to M= because this
    feature is broken for a long time

    - add CONFIG_DEBUG_INFO_COMPRESSED to support compressed debug info

    - a lot of cleanups of modpost

    - dump vmlinux symbols out into vmlinux.symvers, and reuse it in the
    second pass of modpost

    - do not run the second pass of modpost if nothing in modules is
    updated

    - install modules.builtin(.modinfo) by 'make install' as well as by
    'make modules_install' because it is useful even when
    CONFIG_MODULES=n

    - add new command line variables, GZIP, BZIP2, LZOP, LZMA, LZ4, and XZ
    to allow users to use alternatives such as pigz, pbzip2, etc.

    * tag 'kbuild-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (96 commits)
    kbuild: add variables for compression tools
    Makefile: install modules.builtin even if CONFIG_MODULES=n
    mksysmap: Fix the mismatch of '.L' symbols in System.map
    kbuild: doc: rename LDFLAGS to KBUILD_LDFLAGS
    modpost: change elf_info->size to size_t
    modpost: remove is_vmlinux() helper
    modpost: strip .o from modname before calling new_module()
    modpost: set have_vmlinux in new_module()
    modpost: remove mod->skip struct member
    modpost: add mod->is_vmlinux struct member
    modpost: remove is_vmlinux() call in check_for_{gpl_usage,unused}()
    modpost: remove mod->is_dot_o struct member
    modpost: move -d option in scripts/Makefile.modpost
    modpost: remove -s option
    modpost: remove get_next_text() and make {grab,release_}file static
    modpost: use read_text_file() and get_line() for reading text files
    modpost: avoid false-positive file open error
    modpost: fix potential mmap'ed file overrun in get_src_version()
    modpost: add read_text_file() and get_line() helpers
    modpost: do not call get_modinfo() for vmlinux(.o)
    ...

    Linus Torvalds
     

05 Jun, 2020

3 commits

  • Test some bit clears/sets to make sure assembly doesn't change, and that
    the set_bit and clear_bit functions work and don't cause sparse warnings.

    Instruct Kbuild to build this file with extra warning level -Wextra, to
    catch new issues, and also doesn't hurt to build with C=1.

    This was used to test changes to arch/x86/include/asm/bitops.h.

    In particular, sparse (C=1) was very concerned when the last bit before a
    natural boundary, like 7, or 31, was being tested, as this causes sign
    extension (0xffffff7f) for instance when clearing bit 7.

    Recommended usage:

    make defconfig
    scripts/config -m CONFIG_TEST_BITOPS
    make modules_prepare
    make C=1 W=1 lib/test_bitops.ko
    objdump -S -d lib/test_bitops.ko
    insmod lib/test_bitops.ko
    rmmod lib/test_bitops.ko

    , there should be no compiler/sparse warnings and no
    error messages in log.

    Link: http://lkml.kernel.org/r/20200310221747.2848474-2-jesse.brandeburg@intel.com
    Signed-off-by: Jesse Brandeburg
    Reviewed-by: Andy Shevchenko
    Cc: Thomas Gleixner
    CcL Ingo Molnar
    Signed-off-by: Andrew Morton
    Cc: Borislav Petkov
    Cc: Rasmus Villemoes
    Cc: Dan Williams
    Cc: Peter Zijlstra
    Cc: Wei Yang
    Cc: Christian Brauner
    Signed-off-by: Linus Torvalds

    Jesse Brandeburg
     
  • This adds tests which will validate architecture page table helpers and
    other accessors in their compliance with expected generic MM semantics.
    This will help various architectures in validating changes to existing
    page table helpers or addition of new ones.

    This test covers basic page table entry transformations including but not
    limited to old, young, dirty, clean, write, write protect etc at various
    level along with populating intermediate entries with next page table page
    and validating them.

    Test page table pages are allocated from system memory with required size
    and alignments. The mapped pfns at page table levels are derived from a
    real pfn representing a valid kernel text symbol. This test gets called
    via late_initcall().

    This test gets built and run when CONFIG_DEBUG_VM_PGTABLE is selected.
    Any architecture, which is willing to subscribe this test will need to
    select ARCH_HAS_DEBUG_VM_PGTABLE. For now this is limited to arc, arm64,
    x86, s390 and powerpc platforms where the test is known to build and run
    successfully Going forward, other architectures too can subscribe the test
    after fixing any build or runtime problems with their page table helpers.

    Folks interested in making sure that a given platform's page table helpers
    conform to expected generic MM semantics should enable the above config
    which will just trigger this test during boot. Any non conformity here
    will be reported as an warning which would need to be fixed. This test
    will help catch any changes to the agreed upon semantics expected from
    generic MM and enable platforms to accommodate it thereafter.

    [anshuman.khandual@arm.com: v17]
    Link: http://lkml.kernel.org/r/1587436495-22033-3-git-send-email-anshuman.khandual@arm.com
    [anshuman.khandual@arm.com: v18]
    Link: http://lkml.kernel.org/r/1588564865-31160-3-git-send-email-anshuman.khandual@arm.com
    Suggested-by: Catalin Marinas
    Signed-off-by: Anshuman Khandual
    Signed-off-by: Christophe Leroy
    Signed-off-by: Qian Cai
    Signed-off-by: Andrew Morton
    Tested-by: Gerald Schaefer [s390]
    Tested-by: Christophe Leroy [ppc32]
    Reviewed-by: Ingo Molnar
    Cc: Mike Rapoport
    Cc: Vineet Gupta
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Cc: Christian Borntraeger
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Borislav Petkov
    Cc: "H. Peter Anvin"
    Cc: Kirill A. Shutemov
    Cc: Paul Walmsley
    Cc: Palmer Dabbelt
    Link: http://lkml.kernel.org/r/1583919272-24178-1-git-send-email-anshuman.khandual@arm.com
    Signed-off-by: Linus Torvalds

    Anshuman Khandual
     
  • This change extends kcov remote coverage support to allow collecting
    coverage from soft interrupts in addition to kernel background threads.

    To collect coverage from code that is executed in softirq context, a part
    of that code has to be annotated with kcov_remote_start/stop() in a
    similar way as how it is done for global kernel background threads. Then
    the handle used for the annotations has to be passed to the
    KCOV_REMOTE_ENABLE ioctl.

    Internally this patch adjusts the __sanitizer_cov_trace_pc() compiler
    inserted callback to not bail out when called from softirq context.
    kcov_remote_start/stop() are updated to save/restore the current per task
    kcov state in a per-cpu area (in case the softirq came when the kernel was
    already collecting coverage in task context). Coverage from softirqs is
    collected into pre-allocated per-cpu areas, whose size is controlled by
    the new CONFIG_KCOV_IRQ_AREA_SIZE.

    [andreyknvl@google.com: turn current->kcov_softirq into unsigned int to fix objtool warning]
    Link: http://lkml.kernel.org/r/841c778aa3849c5cb8c3761f56b87ce653a88671.1585233617.git.andreyknvl@google.com
    Signed-off-by: Andrey Konovalov
    Signed-off-by: Andrew Morton
    Reviewed-by: Dmitry Vyukov
    Cc: Alan Stern
    Cc: Alexander Potapenko
    Cc: Andrey Konovalov
    Cc: Greg Kroah-Hartman
    Cc: Marco Elver
    Link: http://lkml.kernel.org/r/469bd385c431d050bc38a593296eff4baae50666.1584655448.git.andreyknvl@google.com
    Signed-off-by: Linus Torvalds

    Andrey Konovalov
     

03 Jun, 2020

1 commit

  • Pull hmm updates from Jason Gunthorpe:
    "This series adds a selftest for hmm_range_fault() and several of the
    DEVICE_PRIVATE migration related actions, and another simplification
    for hmm_range_fault()'s API.

    - Simplify hmm_range_fault() with a simpler return code, no
    HMM_PFN_SPECIAL, and no customizable output PFN format

    - Add a selftest for hmm_range_fault() and DEVICE_PRIVATE related
    functionality"

    * tag 'for-linus-hmm' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
    MAINTAINERS: add HMM selftests
    mm/hmm/test: add selftests for HMM
    mm/hmm/test: add selftest driver for HMM
    mm/hmm: remove the customizable pfn format from hmm_range_fault
    mm/hmm: remove HMM_PFN_SPECIAL
    drm/amdgpu: remove dead code after hmm_range_fault()
    mm/hmm: make hmm_range_fault return 0 or -1

    Linus Torvalds