22 Jun, 2022

1 commit

  • commit abfed87e2a12bd246047d78c01d81eb9529f1d06 upstream.

    This is used by code that doesn't need CONFIG_CRYPTO, so move this into
    lib/ with a Kconfig option so that it can be selected by whatever needs
    it.

    This fixes a linker error Zheng pointed out when
    CRYPTO_MANAGER_DISABLE_TESTS!=y and CRYPTO=m:

    lib/crypto/curve25519-selftest.o: In function `curve25519_selftest':
    curve25519-selftest.c:(.init.text+0x60): undefined reference to `__crypto_memneq'
    curve25519-selftest.c:(.init.text+0xec): undefined reference to `__crypto_memneq'
    curve25519-selftest.c:(.init.text+0x114): undefined reference to `__crypto_memneq'
    curve25519-selftest.c:(.init.text+0x154): undefined reference to `__crypto_memneq'

    Reported-by: Zheng Bin
    Cc: Eric Biggers
    Cc: stable@vger.kernel.org
    Fixes: aa127963f1ca ("crypto: lib/curve25519 - re-add selftests")
    Signed-off-by: Jason A. Donenfeld
    Reviewed-by: Eric Biggers
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

15 Jun, 2022

1 commit

  • [ Upstream commit 6014a23638cdee63a71ef13c51d7c563eb5829ee ]

    Since the APIs defined in the bootconfig.o are not individually used,
    it is meaningless to build it as library by lib-y. Use obj-y for that.

    Link: https://lkml.kernel.org/r/164921225875.1090670.15565363126983098971.stgit@devnote2

    Cc: Padmanabha Srinivasaiah
    Cc: Jonathan Corbet
    Cc: Randy Dunlap
    Cc: Nick Desaulniers
    Cc: Sami Tolvanen
    Cc: Nathan Chancellor
    Cc: Linux Kbuild mailing list
    Reported-by: Masahiro Yamada
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (Google)
    Signed-off-by: Sasha Levin

    Masami Hiramatsu
     

07 Oct, 2021

1 commit

  • The structleak plugin causes the stack frame size to grow immensely:

    lib/bitfield_kunit.c: In function 'test_bitfields_constants':
    lib/bitfield_kunit.c:93:1: error: the frame size of 7440 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

    Turn it off in this file.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Brendan Higgins
    Reviewed-by: Kees Cook
    Signed-off-by: Shuah Khan

    Arnd Bergmann
     

10 Jul, 2021

1 commit

  • Pull UML updates from Richard Weinberger:

    - Support for optimized routines based on the host CPU

    - Support for PCI via virtio

    - Various fixes

    * tag 'for-linus-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
    um: remove unneeded semicolon in um_arch.c
    um: Remove the repeated declaration
    um: fix error return code in winch_tramp()
    um: fix error return code in slip_open()
    um: Fix stack pointer alignment
    um: implement flush_cache_vmap/flush_cache_vunmap
    um: add a UML specific futex implementation
    um: enable the use of optimized xor routines in UML
    um: Add support for host CPU flags and alignment
    um: allow not setting extra rpaths in the linux binary
    um: virtio/pci: enable suspend/resume
    um: add PCI over virtio emulation driver
    um: irqs: allow invoking time-travel handler multiple times
    um: time-travel/signals: fix ndelay() in interrupt
    um: expose time-travel mode to userspace side
    um: export signals_enabled directly
    um: remove unused smp_sigio_handler() declaration
    lib: add iomem emulation (logic_iomem)
    um: allow disabling NO_IOMEM

    Linus Torvalds
     

30 Jun, 2021

3 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
     
  • Pull printk updates from Petr Mladek:

    - Add %pt[RT]s modifier to vsprintf(). It overrides ISO 8601 separator
    by using ' ' (space). It produces "YYYY-mm-dd HH:MM:SS" instead of
    "YYYY-mm-ddTHH:MM:SS".

    - Correctly parse long row of numbers by sscanf() when using the field
    width. Add extensive sscanf() selftest.

    - Generalize re-entrant CPU lock that has already been used to
    serialize dump_stack() output. It is part of the ongoing printk
    rework. It will allow to remove the obsoleted printk_safe buffers and
    introduce atomic consoles.

    - Some code clean up and sparse warning fixes.

    * tag 'printk-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
    printk: fix cpu lock ordering
    lib/dump_stack: move cpu lock to printk.c
    printk: Remove trailing semicolon in macros
    random32: Fix implicit truncation warning in prandom_seed_state()
    lib: test_scanf: Remove pointless use of type_min() with unsigned types
    selftests: lib: Add wrapper script for test_scanf
    lib: test_scanf: Add tests for sscanf number conversion
    lib: vsprintf: Fix handling of number field widths in vsscanf
    lib: vsprintf: scanf: Negative number must have field width > 1
    usb: host: xhci-tegra: Switch to use %ptTs
    nilfs2: Switch to use %ptTs
    kdb: Switch to use %ptTs
    lib/vsprintf: Allow to override ISO 8601 date and time separator

    Linus Torvalds
     
  • SLUB has resiliency_test() function which is hidden behind #ifdef
    SLUB_RESILIENCY_TEST that is not part of Kconfig, so nobody runs it.
    KUnit should be a proper replacement for it.

    Try changing byte in redzone after allocation and changing pointer to next
    free node, first byte, 50th byte and redzone byte. Check if validation
    finds errors.

    There are several differences from the original resiliency test: Tests
    create own caches with known state instead of corrupting shared kmalloc
    caches.

    The corruption of freepointer uses correct offset, the original resiliency
    test got broken with freepointer changes.

    Scratch changing random byte test, because it does not have meaning in
    this form where we need deterministic results.

    Add new option CONFIG_SLUB_KUNIT_TEST in Kconfig. Tests next_pointer,
    first_word and clobber_50th_byte do not run with KASAN option on. Because
    the test deliberately modifies non-allocated objects.

    Use kunit_resource to count errors in cache and silence bug reports.
    Count error whenever slab_bug() or slab_fix() is called or when the count
    of pages is wrong.

    [glittao@gmail.com: remove unused function test_exit(), from SLUB KUnit test]
    Link: https://lkml.kernel.org/r/20210512140656.12083-1-glittao@gmail.com
    [akpm@linux-foundation.org: export kasan_enable/disable_current to modules]

    Link: https://lkml.kernel.org/r/20210511150734.3492-2-glittao@gmail.com
    Signed-off-by: Oliver Glitta
    Reviewed-by: Vlastimil Babka
    Acked-by: Daniel Latypov
    Acked-by: Marco Elver
    Cc: Brendan Higgins
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oliver Glitta
     

18 Jun, 2021

1 commit

  • Add IO memory emulation that uses callbacks for read/write to
    the allocated regions. The callbacks can be registered by the
    users using logic_iomem_alloc().

    To use, an architecture must 'select LOGIC_IOMEM' in Kconfig
    and then include into asm/io.h to get
    the __raw_read*/__raw_write* functions.

    Optionally, an architecture may 'select LOGIC_IOMEM_FALLBACK'
    in which case non-emulated regions will 'fall back' to the
    various real_* functions that must then be provided.

    Cc: Arnd Bergmann
    Signed-off-by: Johannes Berg
    Signed-off-by: Richard Weinberger

    Johannes Berg
     

23 May, 2021

1 commit

  • lib/bitfield_kunit.c: In function `test_bitfields_constants':
    lib/bitfield_kunit.c:93:1: warning: the frame size of 7456 bytes is larger than 2048 bytes [-Wframe-larger-than=]
    }
    ^

    As the description of BITFIELD_KUNIT in lib/Kconfig.debug, it "Only useful
    for kernel devs running the KUnit test harness, and not intended for
    inclusion into a production build". Therefore, it is not worth modifying
    variable 'test_bitfields_constants' to clear this warning. Just suppress
    it.

    Link: https://lkml.kernel.org/r/20210518094533.7652-1-thunder.leizhen@huawei.com
    Signed-off-by: Zhen Lei
    Cc: Shuah Khan
    Cc: Vitor Massaru Iha
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhen Lei
     

19 May, 2021

1 commit

  • Adds test_sscanf to test various number conversion cases, as
    number conversion was previously broken.

    This also tests the simple_strtoxxx() functions exported from
    vsprintf.c.

    Signed-off-by: Richard Fitzgerald
    Acked-by: Andy Shevchenko
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20210514161206.30821-3-rf@opensource.cirrus.com

    Richard Fitzgerald
     

14 Apr, 2021

1 commit

  • We have a need in the TPM2 trusted keys to return the ASN.1 form of the TPM
    key blob so it can be operated on by tools outside of the kernel. The
    specific tools are the openssl_tpm2_engine, openconnect and the Intel
    tpm2-tss-engine. To do that, we have to be able to read and write the same
    binary key format the tools use. The current ASN.1 decoder does fine for
    reading, but we need pieces of an ASN.1 encoder to write the key blob in
    binary compatible form.

    For backwards compatibility, the trusted key reader code will still accept
    the two TPM2B quantities that it uses today, but the writer will only
    output the ASN.1 form.

    The current implementation only encodes the ASN.1 bits we actually need.

    Signed-off-by: James Bottomley
    Reviewed-by: David Howells
    Reviewed-by: Jarkko Sakkinen
    Tested-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    James Bottomley
     

25 Feb, 2021

1 commit

  • 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
     

22 Feb, 2021

1 commit

  • Pull locking updates from Ingo Molnar:
    "Core locking primitives updates:
    - Remove mutex_trylock_recursive() from the API - no users left
    - Simplify + constify the futex code a bit

    Lockdep updates:
    - Teach lockdep about local_lock_t
    - Add CONFIG_DEBUG_IRQFLAGS=y debug config option to check for
    potentially unsafe IRQ mask restoration patterns. (I.e.
    calling raw_local_irq_restore() with IRQs enabled.)
    - Add wait context self-tests
    - Fix graph lock corner case corrupting internal data structures
    - Fix noinstr annotations

    LKMM updates:
    - Simplify the litmus tests
    - Documentation fixes

    KCSAN updates:
    - Re-enable KCSAN instrumentation in lib/random32.c

    Misc fixes:
    - Don't branch-trace static label APIs
    - DocBook fix
    - Remove stale leftover empty file"

    * tag 'locking-core-2021-02-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
    checkpatch: Don't check for mutex_trylock_recursive()
    locking/mutex: Kill mutex_trylock_recursive()
    s390: Use arch_local_irq_{save,restore}() in early boot code
    lockdep: Noinstr annotate warn_bogus_irq_restore()
    locking/lockdep: Avoid unmatched unlock
    locking/rwsem: Remove empty rwsem.h
    locking/rtmutex: Add missing kernel-doc markup
    futex: Remove unneeded gotos
    futex: Change utime parameter to be 'const ... *'
    lockdep: report broken irq restoration
    jump_label: Do not profile branch annotations
    locking: Add Reviewers
    locking/selftests: Add local_lock inversion tests
    locking/lockdep: Exclude local_lock_t from IRQ inversions
    locking/lockdep: Clean up check_redundant() a bit
    locking/lockdep: Add a skip() function to __bfs()
    locking/lockdep: Mark local_lock_t
    locking/selftests: More granular debug_locks_verbose
    lockdep/selftest: Add wait context selftests
    tools/memory-model: Fix typo in klitmus7 compatibility table
    ...

    Linus Torvalds
     

15 Jan, 2021

1 commit

  • Moving stack_map_get_build_id into lib with
    declaration in linux/buildid.h header:

    int build_id_parse(struct vm_area_struct *vma, unsigned char *build_id);

    This function returns build id for given struct vm_area_struct.
    There is no functional change to stack_map_get_build_id function.

    Signed-off-by: Jiri Olsa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Song Liu
    Link: https://lore.kernel.org/bpf/20210114134044.1418404-2-jolsa@kernel.org

    Jiri Olsa
     

05 Jan, 2021

1 commit


19 Dec, 2020

1 commit

  • Pull RISC-V updates from Palmer Dabbelt:
    "We have a handful of new kernel features for 5.11:

    - Support for the contiguous memory allocator.

    - Support for IRQ Time Accounting

    - Support for stack tracing

    - Support for strict /dev/mem

    - Support for kernel section protection

    I'm being a bit conservative on the cutoff for this round due to the
    timing, so this is all the new development I'm going to take for this
    cycle (even if some of it probably normally would have been OK). There
    are, however, some fixes on the list that I will likely be sending
    along either later this week or early next week.

    There is one issue in here: one of my test configurations
    (PREEMPT{,_DEBUG}=y) fails to boot on QEMU 5.0.0 (from April) as of
    the .text.init alignment patch.

    With any luck we'll sort out the issue, but given how many bugs get
    fixed all over the place and how unrelated those features seem my
    guess is that we're just running into something that's been lurking
    for a while and has already been fixed in the newer QEMU (though I
    wouldn't be surprised if it's one of these implicit assumptions we
    have in the boot flow). If it was hardware I'd be strongly inclined to
    look more closely, but given that users can upgrade their simulators
    I'm less worried about it"

    * tag 'riscv-for-linus-5.11-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
    arm64: Use the generic devmem_is_allowed()
    arm: Use the generic devmem_is_allowed()
    RISC-V: Use the new generic devmem_is_allowed()
    lib: Add a generic version of devmem_is_allowed()
    riscv: Fixed kernel test robot warning
    riscv: kernel: Drop unused clean rule
    riscv: provide memmove implementation
    RISC-V: Move dynamic relocation section under __init
    RISC-V: Protect all kernel sections including init early
    RISC-V: Align the .init.text section
    RISC-V: Initialize SBI early
    riscv: Enable ARCH_STACKWALK
    riscv: Make stack walk callback consistent with generic code
    riscv: Cleanup stacktrace
    riscv: Add HAVE_IRQ_TIME_ACCOUNTING
    riscv: Enable CMA support
    riscv: Ignore Image.* and loader.bin
    riscv: Clean up boot dir
    riscv: Fix compressed Image formats build
    RISC-V: Add kernel image sections to the resource tree

    Linus Torvalds
     

16 Dec, 2020

1 commit

  • Test get_option() for a starter which is provided by cmdline.c.

    [akpm@linux-foundation.org: fix warning by constifying cmdline_test_values]
    [andriy.shevchenko@linux.intel.com: type of expected returned values should be int]
    Link: https://lkml.kernel.org/r/20201116104244.15472-1-andriy.shevchenko@linux.intel.com
    [andriy.shevchenko@linux.intel.com: provide meaningful MODULE_LICENSE()]
    Link: https://lkml.kernel.org/r/20201116104257.15527-1-andriy.shevchenko@linux.intel.com

    Link: https://lkml.kernel.org/r/20201112180732.75589-6-andriy.shevchenko@linux.intel.com
    Signed-off-by: Andy Shevchenko
    Cc: Shuah Khan
    Cc: Vitor Massaru Iha
    Cc: Mark Brown
    Cc: Brendan Higgins
    Cc: David Gow
    Cc: Matti Vaittinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

12 Dec, 2020

3 commits

  • With extra warnings enabled, clang complains about the redundant
    -mhard-float argument:

    clang: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]

    Move this into the gcc-only part of the Makefile.

    Link: https://lkml.kernel.org/r/20201203223652.1320700-1-arnd@kernel.org
    Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
    Signed-off-by: Arnd Bergmann
    Cc: Nathan Chancellor
    Cc: Nick Desaulniers
    Cc: Petteri Aimonen
    Cc: Borislav Petkov
    Cc: Arnd Bergmann
    Cc: Andy Shevchenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • As part of adding STRICT_DEVMEM support to the RISC-V port, Zong provided an
    implementation of devmem_is_allowed() that's exactly the same as the version in
    a handful of other ports. Rather than duplicate code, I've put a generic
    version of this in lib/ and used it for the RISC-V port.

    * palmer/generic-devmem:
    arm64: Use the generic devmem_is_allowed()
    arm: Use the generic devmem_is_allowed()
    RISC-V: Use the new generic devmem_is_allowed()
    lib: Add a generic version of devmem_is_allowed()

    Palmer Dabbelt
     
  • As part of adding support for STRICT_DEVMEM to the RISC-V port, Zong
    provided a devmem_is_allowed() implementation that's exactly the same as
    all the others I checked. Instead I'm adding a generic version, which
    will soon be used.

    Reviewed-by: Luis Chamberlain
    Signed-off-by: Palmer Dabbelt

    Palmer Dabbelt
     

19 Oct, 2020

1 commit

  • …/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
     

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

3 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)
     
  • Transfer all previous tests for KASAN to KUnit so they can be run more
    easily. Using kunit_tool, developers can run these tests with their other
    KUnit tests and see "pass" or "fail" with the appropriate KASAN report
    instead of needing to parse each KASAN report to test KASAN
    functionalities. All KASAN reports are still printed to dmesg.

    Stack tests do not work properly when KASAN_STACK is enabled so those
    tests use a check for "if IS_ENABLED(CONFIG_KASAN_STACK)" so they only run
    if stack instrumentation is enabled. If KASAN_STACK is not enabled, KUnit
    will print a statement to let the user know this test was not run with
    KASAN_STACK enabled.

    copy_user_test and kasan_rcu_uaf cannot be run in KUnit so there is a
    separate test file for those tests, which can be run as before as a
    module.

    [trishalfonso@google.com: v14]
    Link: https://lkml.kernel.org/r/20200915035828.570483-4-davidgow@google.com

    Signed-off-by: Patricia Alfonso
    Signed-off-by: David Gow
    Signed-off-by: Andrew Morton
    Tested-by: Andrey Konovalov
    Reviewed-by: Brendan Higgins
    Reviewed-by: Andrey Konovalov
    Reviewed-by: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: Ingo Molnar
    Cc: Juri Lelli
    Cc: Peter Zijlstra
    Cc: Shuah Khan
    Cc: Vincent Guittot
    Link: https://lkml.kernel.org/r/20200910070331.3358048-4-davidgow@google.com
    Signed-off-by: Linus Torvalds

    Patricia Alfonso
     
  • 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
     

20 Aug, 2020

1 commit

  • gcc can transform the loop in a naive implementation of memset/memcpy
    etc into a call to the function itself. This optimization is enabled by
    -ftree-loop-distribute-patterns.

    This has been the case for a while, but gcc-10.x enables this option at
    -O2 rather than -O3 as in previous versions.

    Add -ffreestanding, which implicitly disables this optimization with
    gcc. It is unclear whether clang performs such optimizations, but
    hopefully it will also not do so in a freestanding environment.

    Signed-off-by: Arvind Sankar
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
    Signed-off-by: Linus Torvalds

    Arvind Sankar
     

13 Aug, 2020

1 commit

  • 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
     

10 Aug, 2020

2 commits

  • Pull Kbuild updates from Masahiro Yamada:

    - run the checker (e.g. sparse) after the compiler

    - remove unneeded cc-option tests for old compiler flags

    - fix tar-pkg to install dtbs

    - introduce ccflags-remove-y and asflags-remove-y syntax

    - allow to trace functions in sub-directories of lib/

    - introduce hostprogs-always-y and userprogs-always-y syntax

    - various Makefile cleanups

    * tag 'kbuild-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: stop filtering out $(GCC_PLUGINS_CFLAGS) from cc-option base
    kbuild: include scripts/Makefile.* only when relevant CONFIG is enabled
    kbuild: introduce hostprogs-always-y and userprogs-always-y
    kbuild: sort hostprogs before passing it to ifneq
    kbuild: move host .so build rules to scripts/gcc-plugins/Makefile
    kbuild: Replace HTTP links with HTTPS ones
    kbuild: trace functions in subdirectories of lib/
    kbuild: introduce ccflags-remove-y and asflags-remove-y
    kbuild: do not export LDFLAGS_vmlinux
    kbuild: always create directories of targets
    powerpc/boot: add DTB to 'targets'
    kbuild: buildtar: add dtbs support
    kbuild: remove cc-option test of -ffreestanding
    kbuild: remove cc-option test of -fno-stack-protector
    Revert "kbuild: Create directory for target DTB"
    kbuild: run the checker after the compiler

    Linus Torvalds
     
  • CFLAGS_REMOVE_.o filters out flags when compiling a particular
    object, but there is no convenient way to do that for every object in
    a directory.

    Add ccflags-remove-y and asflags-remove-y to make it easily.

    Use ccflags-remove-y to clean up some Makefiles.

    The add/remove order works as follows:

    [1] KBUILD_CFLAGS specifies compiler flags used globally

    [2] ccflags-y adds compiler flags for all objects in the
    current Makefile

    [3] ccflags-remove-y removes compiler flags for all objects in the
    current Makefile (New feature)

    [4] CFLAGS_ adds compiler flags per file.

    [5] CFLAGS_REMOVE_ removes compiler flags per file.

    Having [3] before [4] allows us to remove flags from most (but not all)
    objects in the current Makefile.

    For example, kernel/trace/Makefile removes $(CC_FLAGS_FTRACE)
    from all objects in the directory, then adds it back to
    trace_selftest_dynamic.o and CFLAGS_trace_kprobe_selftest.o

    The same applies to lib/livepatch/Makefile.

    Please note ccflags-remove-y has no effect to the sub-directories.
    In contrast, the previous notation got rid of compiler flags also from
    all the sub-directories.

    The following are not affected because they have no sub-directories:

    arch/arm/boot/compressed/
    arch/powerpc/xmon/
    arch/sh/
    kernel/trace/

    However, lib/ has several sub-directories.

    To keep the behavior, I added ccflags-remove-y to all Makefiles
    in subdirectories of lib/, except the following:

    lib/vdso/Makefile - Kbuild does not descend into this Makefile
    lib/raid/test/Makefile - This is not used for the kernel build

    I think commit 2464a609ded0 ("ftrace: do not trace library functions")
    excluded too much. In the next commit, I will remove ccflags-remove-y
    from the sub-directories of lib/.

    Suggested-by: Sami Tolvanen
    Signed-off-by: Masahiro Yamada
    Acked-by: Steven Rostedt (VMware)
    Acked-by: Michael Ellerman (powerpc)
    Acked-by: Brendan Higgins (KUnit)
    Tested-by: Anders Roxell

    Masahiro Yamada
     

08 Aug, 2020

1 commit

  • The functionality in lib/ioremap.c deals with pagetables, vmalloc and
    caches, so it naturally belongs to mm/ Moving it there will also allow
    declaring p?d_alloc_track functions in an header file inside mm/ rather
    than having those declarations in include/linux/mm.h

    Suggested-by: Andrew Morton
    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Reviewed-by: Pekka Enberg
    Cc: Abdul Haleem
    Cc: Andy Lutomirski
    Cc: Arnd Bergmann
    Cc: Christophe Leroy
    Cc: Joerg Roedel
    Cc: Joerg Roedel
    Cc: Max Filippov
    Cc: Peter Zijlstra (Intel)
    Cc: Satheesh Rajendran
    Cc: Stafford Horne
    Cc: Stephen Rothwell
    Cc: Steven Rostedt
    Cc: Geert Uytterhoeven
    Cc: Matthew Wilcox
    Link: http://lkml.kernel.org/r/20200627143453.31835-8-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

06 Aug, 2020

1 commit

  • Pull networking updates from David Miller:

    1) Support 6Ghz band in ath11k driver, from Rajkumar Manoharan.

    2) Support UDP segmentation in code TSO code, from Eric Dumazet.

    3) Allow flashing different flash images in cxgb4 driver, from Vishal
    Kulkarni.

    4) Add drop frames counter and flow status to tc flower offloading,
    from Po Liu.

    5) Support n-tuple filters in cxgb4, from Vishal Kulkarni.

    6) Various new indirect call avoidance, from Eric Dumazet and Brian
    Vazquez.

    7) Fix BPF verifier failures on 32-bit pointer arithmetic, from
    Yonghong Song.

    8) Support querying and setting hardware address of a port function via
    devlink, use this in mlx5, from Parav Pandit.

    9) Support hw ipsec offload on bonding slaves, from Jarod Wilson.

    10) Switch qca8k driver over to phylink, from Jonathan McDowell.

    11) In bpftool, show list of processes holding BPF FD references to
    maps, programs, links, and btf objects. From Andrii Nakryiko.

    12) Several conversions over to generic power management, from Vaibhav
    Gupta.

    13) Add support for SO_KEEPALIVE et al. to bpf_setsockopt(), from Dmitry
    Yakunin.

    14) Various https url conversions, from Alexander A. Klimov.

    15) Timestamping and PHC support for mscc PHY driver, from Antoine
    Tenart.

    16) Support bpf iterating over tcp and udp sockets, from Yonghong Song.

    17) Support 5GBASE-T i40e NICs, from Aleksandr Loktionov.

    18) Add kTLS RX HW offload support to mlx5e, from Tariq Toukan.

    19) Fix the ->ndo_start_xmit() return type to be netdev_tx_t in several
    drivers. From Luc Van Oostenryck.

    20) XDP support for xen-netfront, from Denis Kirjanov.

    21) Support receive buffer autotuning in MPTCP, from Florian Westphal.

    22) Support EF100 chip in sfc driver, from Edward Cree.

    23) Add XDP support to mvpp2 driver, from Matteo Croce.

    24) Support MPTCP in sock_diag, from Paolo Abeni.

    25) Commonize UDP tunnel offloading code by creating udp_tunnel_nic
    infrastructure, from Jakub Kicinski.

    26) Several pci_ --> dma_ API conversions, from Christophe JAILLET.

    27) Add FLOW_ACTION_POLICE support to mlxsw, from Ido Schimmel.

    28) Add SK_LOOKUP bpf program type, from Jakub Sitnicki.

    29) Refactor a lot of networking socket option handling code in order to
    avoid set_fs() calls, from Christoph Hellwig.

    30) Add rfc4884 support to icmp code, from Willem de Bruijn.

    31) Support TBF offload in dpaa2-eth driver, from Ioana Ciornei.

    32) Support XDP_REDIRECT in qede driver, from Alexander Lobakin.

    33) Support PCI relaxed ordering in mlx5 driver, from Aya Levin.

    34) Support TCP syncookies in MPTCP, from Flowian Westphal.

    35) Fix several tricky cases of PMTU handling wrt. briding, from Stefano
    Brivio.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2056 commits)
    net: thunderx: initialize VF's mailbox mutex before first usage
    usb: hso: remove bogus check for EINPROGRESS
    usb: hso: no complaint about kmalloc failure
    hso: fix bailout in error case of probe
    ip_tunnel_core: Fix build for archs without _HAVE_ARCH_IPV6_CSUM
    selftests/net: relax cpu affinity requirement in msg_zerocopy test
    mptcp: be careful on subflow creation
    selftests: rtnetlink: make kci_test_encap() return sub-test result
    selftests: rtnetlink: correct the final return value for the test
    net: dsa: sja1105: use detected device id instead of DT one on mismatch
    tipc: set ub->ifindex for local ipv6 address
    ipv6: add ipv6_dev_find()
    net: openvswitch: silence suspicious RCU usage warning
    Revert "vxlan: fix tos value before xmit"
    ptp: only allow phase values lower than 1 period
    farsync: switch from 'pci_' to 'dma_' API
    wan: wanxl: switch from 'pci_' to 'dma_' API
    hv_netvsc: do not use VF device if link is down
    dpaa2-eth: Fix passing zero to 'PTR_ERR' warning
    net: macb: Properly handle phylink on at91sam9x
    ...

    Linus Torvalds
     

04 Aug, 2020

1 commit


31 Jul, 2020

1 commit

  • - Add unzstd() and the zstd decompress interface.

    - Add zstd support to decompress_method().

    The decompress_method() and unzstd() functions are used to decompress
    the initramfs and the initrd. The __decompress() function is used in
    the preboot environment to decompress a zstd compressed kernel.

    The zstd decompression function allows the input and output buffers to
    overlap because that is used by x86 kernel decompression.

    Signed-off-by: Nick Terrell
    Signed-off-by: Ingo Molnar
    Tested-by: Sedat Dilek
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/20200730190841.2071656-3-nickrterrell@gmail.com

    Nick Terrell
     

29 Jul, 2020

1 commit

  • The pldmfw library is used to implement common logic needed to flash
    devices based on firmware files using the format described by the PLDM
    for Firmware Update standard.

    This library consists of logic to parse the PLDM file format from
    a firmware file object, as well as common logic for sending the relevant
    PLDM header data to the device firmware.

    A simple ops table is provided so that device drivers can implement
    device specific hardware interactions while keeping the common logic to
    the pldmfw library.

    This library will be used by the Intel ice networking driver as part of
    implementing device flash update via devlink. The library aims to be
    vendor and device agnostic. For this reason, it has been placed in
    lib/pldmfw, in the hopes that other devices which use the PLDM firmware
    file format may benefit from it in the future. However, do note that not
    all features defined in the PLDM standard have been implemented.

    Signed-off-by: Jacob Keller
    Signed-off-by: David S. Miller

    Jacob Keller
     

07 Jul, 2020

1 commit

  • Some Makefiles already pass -fno-stack-protector unconditionally.
    For example, arch/arm64/kernel/vdso/Makefile, arch/x86/xen/Makefile.

    No problem report so far about hard-coding this option. So, we can
    assume all supported compilers know -fno-stack-protector.

    GCC 4.8 and Clang support this option (https://godbolt.org/z/_HDGzN)

    Get rid of cc-option from -fno-stack-protector.

    Remove CONFIG_CC_HAS_STACKPROTECTOR_NONE, which is always 'y'.

    Note:
    arch/mips/vdso/Makefile adds -fno-stack-protector twice, first
    unconditionally, and second conditionally. I removed the second one.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Kees Cook
    Acked-by: Ard Biesheuvel
    Reviewed-by: Nick Desaulniers

    Masahiro Yamada
     

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
     

12 Jun, 2020

1 commit

  • 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
     

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
     

05 Jun, 2020

1 commit

  • 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
     

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