09 Jun, 2022

1 commit

  • [ Upstream commit 78ed93d72ded679e3caf0758357209887bda885f ]

    With SIGTRAP on perf events, we have encountered termination of
    processes due to user space attempting to block delivery of SIGTRAP.
    Consider this case:


    ...
    sigset_t s;
    sigemptyset(&s);
    sigaddset(&s, SIGTRAP | );
    sigprocmask(SIG_BLOCK, &s, ...);
    ...

    When the perf event triggers, while SIGTRAP is blocked, force_sig_perf()
    will force the signal, but revert back to the default handler, thus
    terminating the task.

    This makes sense for error conditions, but not so much for explicitly
    requested monitoring. However, the expectation is still that signals
    generated by perf events are synchronous, which will no longer be the
    case if the signal is blocked and delivered later.

    To give user space the ability to clearly distinguish synchronous from
    asynchronous signals, introduce siginfo_t::si_perf_flags and
    TRAP_PERF_FLAG_ASYNC (opted for flags in case more binary information is
    required in future).

    The resolution to the problem is then to (a) no longer force the signal
    (avoiding the terminations), but (b) tell user space via si_perf_flags
    if the signal was synchronous or not, so that such signals can be
    handled differently (e.g. let user space decide to ignore or consider
    the data imprecise).

    The alternative of making the kernel ignore SIGTRAP on perf events if
    the signal is blocked may work for some usecases, but likely causes
    issues in others that then have to revert back to interception of
    sigprocmask() (which we want to avoid). [ A concrete example: when using
    breakpoint perf events to track data-flow, in a region of code where
    signals are blocked, data-flow can no longer be tracked accurately.
    When a relevant asynchronous signal is received after unblocking the
    signal, the data-flow tracking logic needs to know its state is
    imprecise. ]

    Fixes: 97ba62b27867 ("perf: Add support for SIGTRAP on perf events")
    Reported-by: Dmitry Vyukov
    Signed-off-by: Marco Elver
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Geert Uytterhoeven
    Tested-by: Dmitry Vyukov
    Link: https://lore.kernel.org/r/20220404111204.935357-1-elver@google.com
    Signed-off-by: Sasha Levin

    Marco Elver
     

30 May, 2022

1 commit

  • commit ac9756c79797bb98972736b13cfb239fd2cffb79 upstream.

    In the event that random_get_entropy() can't access a cycle counter or
    similar, falling back to returning 0 is really not the best we can do.
    Instead, at least calling random_get_entropy_fallback() would be
    preferable, because that always needs to return _something_, even
    falling back to jiffies eventually. It's not as though
    random_get_entropy_fallback() is super high precision or guaranteed to
    be entropic, but basically anything that's not zero all the time is
    better than returning zero all the time.

    This is accomplished by just including the asm-generic code like on
    other architectures, which means we can get rid of the empty stub
    function here.

    Cc: Thomas Gleixner
    Cc: Arnd Bergmann
    Cc: David S. Miller
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

08 Apr, 2022

1 commit

  • [ Upstream commit 23fc539e81295b14b50c6ccc5baeb4f3d59d822d ]

    On some architectures, access_ok() does not do any argument type
    checking, so replacing the definition with a generic one causes
    a few warnings for harmless issues that were never caught before.

    Fix the ones that I found either through my own test builds or
    that were reported by the 0-day bot.

    Reported-by: kernel test robot
    Reviewed-by: Christoph Hellwig
    Acked-by: Dinh Nguyen
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sasha Levin

    Arnd Bergmann
     

25 Nov, 2021

3 commits

  • commit fcb116bc43c8c37c052530ead79872f8b2615711 upstream.

    Recently to prevent issues with SECCOMP_RET_KILL and similar signals
    being changed before they are delivered SA_IMMUTABLE was added.

    Unfortunately this broke debuggers[1][2] which reasonably expect
    to be able to trap synchronous SIGTRAP and SIGSEGV even when
    the target process is not configured to handle those signals.

    Add force_exit_sig and use it instead of force_fatal_sig where
    historically the code has directly called do_exit. This has the
    implementation benefits of going through the signal exit path
    (including generating core dumps) without the danger of allowing
    userspace to ignore or change these signals.

    This avoids userspace regressions as older kernels exited with do_exit
    which debuggers also can not intercept.

    In the future is should be possible to improve the quality of
    implementation of the kernel by changing some of these force_exit_sig
    calls to force_fatal_sig. That can be done where it matters on
    a case-by-case basis with careful analysis.

    Reported-by: Kyle Huey
    Reported-by: kernel test robot
    [1] https://lkml.kernel.org/r/CAP045AoMY4xf8aC_4QU_-j7obuEPYgTcnQQP3Yxk=2X90jtpjw@mail.gmail.com
    [2] https://lkml.kernel.org/r/20211117150258.GB5403@xsang-OptiPlex-9020
    Fixes: 00b06da29cf9 ("signal: Add SA_IMMUTABLE to ensure forced siganls do not get changed")
    Fixes: a3616a3c0272 ("signal/m68k: Use force_sigsegv(SIGSEGV) in fpsp040_die")
    Fixes: 83a1f27ad773 ("signal/powerpc: On swapcontext failure force SIGSEGV")
    Fixes: 9bc508cf0791 ("signal/s390: Use force_sigsegv in default_trap_handler")
    Fixes: 086ec444f866 ("signal/sparc32: In setup_rt_frame and setup_fram use force_fatal_sig")
    Fixes: c317d306d550 ("signal/sparc32: Exit with a fatal signal when try_to_clear_window_buffer fails")
    Fixes: 695dd0d634df ("signal/x86: In emulate_vsyscall force a signal instead of calling do_exit")
    Fixes: 1fbd60df8a85 ("signal/vm86_32: Properly send SIGSEGV when the vm86 state cannot be saved.")
    Fixes: 941edc5bf174 ("exit/syscall_user_dispatch: Send ordinary signals on failure")
    Link: https://lkml.kernel.org/r/871r3dqfv8.fsf_-_@email.froward.int.ebiederm.org
    Reviewed-by: Kees Cook
    Tested-by: Kees Cook
    Tested-by: Kyle Huey
    Signed-off-by: "Eric W. Biederman"
    Cc: Thomas Backlund
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit 086ec444f86660e103de8945d0dcae9b67132ac9 upstream.

    Modify the 32bit version of setup_rt_frame and setup_frame to act
    similar to the 64bit version of setup_rt_frame and fail with a signal
    instead of calling do_exit.

    Replacing do_exit(SIGILL) with force_fatal_signal(SIGILL) ensures that
    the process will be terminated cleanly when the stack frame is
    invalid, instead of just killing off a single thread and leaving the
    process is a weird state.

    Cc: David Miller
    Cc: sparclinux@vger.kernel.org
    Link: https://lkml.kernel.org/r/20211020174406.17889-16-ebiederm@xmission.com
    Signed-off-by: Eric W. Biederman
    Cc: Thomas Backlund
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • commit c317d306d55079525c9610267fdaf3a8a6d2f08b upstream.

    The function try_to_clear_window_buffer is only called from
    rtrap_32.c. After it is called the signal pending state is retested,
    and signals are handled if TIF_SIGPENDING is set. This allows
    try_to_clear_window_buffer to call force_fatal_signal and then rely on
    the signal being delivered to kill the process, without any danger of
    returning to userspace, or otherwise using possible corrupt state on
    failure.

    The functional difference between force_fatal_sig and do_exit is that
    do_exit will only terminate a single thread, and will never trigger a
    core-dump. A multi-threaded program for which a single thread
    terminates unexpectedly is hard to reason about. Calling force_fatal_sig
    does not give userspace a chance to catch the signal, but otherwise
    is an ordinary fatal signal exit, and it will trigger a coredump
    of the offending process if core dumps are enabled.

    Cc: David Miller
    Cc: sparclinux@vger.kernel.org
    Link: https://lkml.kernel.org/r/20211020174406.17889-15-ebiederm@xmission.com
    Signed-off-by: Eric W. Biederman
    Cc: Thomas Backlund
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

19 Nov, 2021

1 commit

  • [ Upstream commit a3c7ca2b141b9735eb383246e966a4f4322e3e65 ]

    Fix observed warning:

    /builds/linux/arch/sparc/boot/Makefile:35: FORCE prerequisite is missing

    Fixes: e1f86d7b4b2a ("kbuild: warn if FORCE is missing for if_changed(_dep,_rule) and filechk")
    Signed-off-by: Kees Cook
    Acked-by: Nicolas Schier
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Kees Cook
     

21 Sep, 2021

1 commit

  • Guenter reported [1] that the pci_iounmap() changes remain problematic,
    with sparc64 allnoconfig and tinyconfig still not building due to the
    header file changes and confusion with the arch-specific pci_iounmap()
    implementation.

    I'm pretty convinced that sparc should just use GENERIC_IOMAP instead of
    doing its own thing, since it turns out that the sparc64 version of
    pci_iounmap() is somewhat buggy (see [2]). But in the meantime, this
    just fixes the build by avoiding the trivial re-definition of the empty
    case.

    Link: https://lore.kernel.org/lkml/20210920134424.GA346531@roeck-us.net/ [1]
    Link: https://lore.kernel.org/lkml/CAHk-=wgheheFx9myQyy5osh79BAazvmvYURAtub2gQtMvLrhqQ@mail.gmail.com/ [2]
    Reported-by: Guenter Roeck
    Cc: David Miller
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

18 Sep, 2021

1 commit

  • Pull dma-mapping fixes from Christoph Hellwig:

    - page align size in sparc32 arch_dma_alloc (Andreas Larsson)

    - tone down a new dma-debug message (Hamza Mahfooz)

    - fix the kerneldoc for dma_map_sg_attrs (me)

    * tag 'dma-mapping-5.15-1' of git://git.infradead.org/users/hch/dma-mapping:
    sparc32: page align size in arch_dma_alloc
    dma-debug: prevent an error message from causing runtime problems
    dma-mapping: fix the kerneldoc for dma_map_sg_attrs

    Linus Torvalds
     

16 Sep, 2021

1 commit

  • The sparc mdesc code does pointer games with 'struct mdesc_hdr', but
    didn't describe to the compiler how that header is then followed by the
    data that the header describes.

    As a result, gcc is now unhappy since it does stricter pointer range
    tracking, and doesn't understand about how these things work. This
    results in various errors like:

    arch/sparc/kernel/mdesc.c: In function ‘mdesc_node_by_name’:
    arch/sparc/kernel/mdesc.c:647:22: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
    647 | if (!strcmp(names + ep[ret].name_offset, name))
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    which are easily avoided by just describing 'struct mdesc_hdr' better,
    and making the node_block() helper function look into that unsized
    data[] that follows the header.

    This makes the sparc64 build happy again at least for my cross-compiler
    version (gcc version 11.2.1).

    Link: https://lore.kernel.org/lkml/CAHk-=wi4NW3NC0xWykkw=6LnjQD6D_rtRtxY9g8gQAJXtQMi8A@mail.gmail.com/
    Cc: Guenter Roeck
    Cc: David S. Miller
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

14 Sep, 2021

1 commit

  • Commit 53b7670e5735 ("sparc: factor the dma coherent mapping into
    helper") lost the page align for the calls to dma_make_coherent and
    srmmu_unmapiorange. The latter cannot handle a non page aligned len
    argument.

    Signed-off-by: Andreas Larsson
    Reviewed-by: Sam Ravnborg
    Signed-off-by: Christoph Hellwig

    Andreas Larsson
     

09 Sep, 2021

2 commits

  • All users of compat_alloc_user_space() and copy_in_user() have been
    removed from the kernel, only a few functions in sparc remain that can be
    changed to calling arch_copy_in_user() instead.

    Link: https://lkml.kernel.org/r/20210727144859.4150043-7-arnd@kernel.org
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Benjamin Herrenschmidt
    Cc: Borislav Petkov
    Cc: Catalin Marinas
    Cc: Christian Borntraeger
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Eric Biederman
    Cc: Feng Tang
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: "James E.J. Bottomley"
    Cc: Michael Ellerman
    Cc: Paul Mackerras
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Vasily Gorbik
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • These are all handled correctly when calling the native system call entry
    point, so remove the special cases.

    Link: https://lkml.kernel.org/r/20210727144859.4150043-6-arnd@kernel.org
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Benjamin Herrenschmidt
    Cc: Borislav Petkov
    Cc: Catalin Marinas
    Cc: Christian Borntraeger
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Eric Biederman
    Cc: Feng Tang
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: "James E.J. Bottomley"
    Cc: Michael Ellerman
    Cc: Paul Mackerras
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Vasily Gorbik
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

06 Sep, 2021

1 commit

  • Pull tracing updates from Steven Rostedt:

    - simplify the Kconfig use of FTRACE and TRACE_IRQFLAGS_SUPPORT

    - bootconfig can now start histograms

    - bootconfig supports group/all enabling

    - histograms now can put values in linear size buckets

    - execnames can be passed to synthetic events

    - introduce "event probes" that attach to other events and can retrieve
    data from pointers of fields, or record fields as different types (a
    pointer to a string as a string instead of just a hex number)

    - various fixes and clean ups

    * tag 'trace-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (35 commits)
    tracing/doc: Fix table format in histogram code
    selftests/ftrace: Add selftest for testing duplicate eprobes and kprobes
    selftests/ftrace: Add selftest for testing eprobe events on synthetic events
    selftests/ftrace: Add test case to test adding and removing of event probe
    selftests/ftrace: Fix requirement check of README file
    selftests/ftrace: Add clear_dynamic_events() to test cases
    tracing: Add a probe that attaches to trace events
    tracing/probes: Reject events which have the same name of existing one
    tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
    tracing/probe: Change traceprobe_set_print_fmt() to take a type
    tracing/probes: Use struct_size() instead of defining custom macros
    tracing/probes: Allow for dot delimiter as well as slash for system names
    tracing/probe: Have traceprobe_parse_probe_arg() take a const arg
    tracing: Have dynamic events have a ref counter
    tracing: Add DYNAMIC flag for dynamic events
    tracing: Replace deprecated CPU-hotplug functions.
    MAINTAINERS: Add an entry for os noise/latency
    tracepoint: Fix kerneldoc comments
    bootconfig/tracing/ktest: Update ktest example for boot-time tracing
    tools/bootconfig: Use per-group/all enable option in ftrace2bconf script
    ...

    Linus Torvalds
     

04 Sep, 2021

3 commits

  • Pull Kbuild updates from Masahiro Yamada:

    - Add -s option (strict mode) to merge_config.sh to make it fail when
    any symbol is redefined.

    - Show a warning if a different compiler is used for building external
    modules.

    - Infer --target from ARCH for CC=clang to let you cross-compile the
    kernel without CROSS_COMPILE.

    - Make the integrated assembler default (LLVM_IAS=1) for CC=clang.

    - Add to the kernel source instead of borrowing
    from the compiler.

    - Add Nick Desaulniers as a Kbuild reviewer.

    - Drop stale cc-option tests.

    - Fix the combination of CONFIG_TRIM_UNUSED_KSYMS and CONFIG_LTO_CLANG
    to handle symbols in inline assembly.

    - Show a warning if 'FORCE' is missing for if_changed rules.

    - Various cleanups

    * tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits)
    kbuild: redo fake deps at include/ksym/*.h
    kbuild: clean up objtool_args slightly
    modpost: get the *.mod file path more simply
    checkkconfigsymbols.py: Fix the '--ignore' option
    kbuild: merge vmlinux_link() between ARCH=um and other architectures
    kbuild: do not remove 'linux' link in scripts/link-vmlinux.sh
    kbuild: merge vmlinux_link() between the ordinary link and Clang LTO
    kbuild: remove stale *.symversions
    kbuild: remove unused quiet_cmd_update_lto_symversions
    gen_compile_commands: extract compiler command from a series of commands
    x86: remove cc-option-yn test for -mtune=
    arc: replace cc-option-yn uses with cc-option
    s390: replace cc-option-yn uses with cc-option
    ia64: move core-y in arch/ia64/Makefile to arch/ia64/Kbuild
    sparc: move the install rule to arch/sparc/Makefile
    security: remove unneeded subdir-$(CONFIG_...)
    kbuild: sh: remove unused install script
    kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
    kbuild: Switch to 'f' variants of integrated assembler flag
    kbuild: Shuffle blank line to improve comment meaning
    ...

    Linus Torvalds
     
  • 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
     
  • Split off from prev patch in the series that implements the syscall.

    Link: https://lkml.kernel.org/r/20210809185259.405936-2-surenb@google.com
    Signed-off-by: Suren Baghdasaryan
    Acked-by: Geert Uytterhoeven
    Cc: Andy Lutomirski
    Cc: Christian Brauner
    Cc: Christoph Hellwig
    Cc: David Hildenbrand
    Cc: David Rientjes
    Cc: Florian Weimer
    Cc: Jan Engelhardt
    Cc: Jann Horn
    Cc: Johannes Weiner
    Cc: Matthew Wilcox (Oracle)
    Cc: Michal Hocko
    Cc: Minchan Kim
    Cc: Oleg Nesterov
    Cc: Rik van Riel
    Cc: Roman Gushchin
    Cc: Shakeel Butt
    Cc: Tim Murray
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Suren Baghdasaryan
     

03 Sep, 2021

2 commits

  • Currently, the install target in arch/sparc/Makefile descends into
    arch/sparc/boot/Makefile to invoke the shell script, but there is no
    good reason to do so.

    arch/sparc/Makefile can run the shell script directly.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Pull dma-mapping updates from Christoph Hellwig:

    - fix debugfs initialization order (Anthony Iliopoulos)

    - use memory_intersects() directly (Kefeng Wang)

    - allow to return specific errors from ->map_sg (Logan Gunthorpe,
    Martin Oliveira)

    - turn the dma_map_sg return value into an unsigned int (me)

    - provide a common global coherent pool іmplementation (me)

    * tag 'dma-mapping-5.15' of git://git.infradead.org/users/hch/dma-mapping: (31 commits)
    hexagon: use the generic global coherent pool
    dma-mapping: make the global coherent pool conditional
    dma-mapping: add a dma_init_global_coherent helper
    dma-mapping: simplify dma_init_coherent_memory
    dma-mapping: allow using the global coherent pool for !ARM
    ARM/nommu: use the generic dma-direct code for non-coherent devices
    dma-direct: add support for dma_coherent_default_memory
    dma-mapping: return an unsigned int from dma_map_sg{,_attrs}
    dma-mapping: disallow .map_sg operations from returning zero on error
    dma-mapping: return error code from dma_dummy_map_sg()
    x86/amd_gart: don't set failed sg dma_address to DMA_MAPPING_ERROR
    x86/amd_gart: return error code from gart_map_sg()
    xen: swiotlb: return error code from xen_swiotlb_map_sg()
    parisc: return error code from .map_sg() ops
    sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR
    sparc/iommu: return error codes from .map_sg() ops
    s390/pci: don't set failed sg dma_address to DMA_MAPPING_ERROR
    s390/pci: return error code from s390_dma_map_sg()
    powerpc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR
    powerpc/iommu: return error code from .map_sg() ops
    ...

    Linus Torvalds
     

02 Sep, 2021

3 commits

  • Pull asm-generic updates from Arnd Bergmann:
    "The main content for 5.15 is a series that cleans up the handling of
    strncpy_from_user() and strnlen_user(), removing a lot of slightly
    incorrect versions of these in favor of the lib/strn*.c helpers that
    implement these correctly and more efficiently.

    The only architectures that retain a private version now are mips,
    ia64, um and parisc. I had offered to convert those at all, but Thomas
    Bogendoerfer wanted to keep the mips version for the moment until he
    had a chance to do regression testing.

    The branch also contains two patches for bitops and for ffs()"

    * tag 'asm-generic-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    bitops/non-atomic: make @nr unsigned to avoid any DIV
    asm-generic: ffs: Drop bogus reference to ffz location
    asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols
    asm-generic: remove extra strn{cpy_from,len}_user declarations
    asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user
    s390: use generic strncpy/strnlen from_user
    microblaze: use generic strncpy/strnlen from_user
    csky: use generic strncpy/strnlen from_user
    arc: use generic strncpy/strnlen from_user
    hexagon: use generic strncpy/strnlen from_user
    h8300: remove stale strncpy_from_user
    asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user

    Linus Torvalds
     
  • …nel/git/ebiederm/user-namespace

    Pull exit cleanups from Eric Biederman:
    "In preparation of doing something about PTRACE_EVENT_EXIT I have
    started cleaning up various pieces of code related to do_exit. Most of
    that code I did not manage to get tested and reviewed before the merge
    window opened but a handful of very useful cleanups are ready to be
    merged.

    The first change is simply the removal of the bdflush system call. The
    code has now been disabled long enough that even the oldest userspace
    working userspace setups anyone can find to test are fine with the
    bdflush system call being removed.

    Changing m68k fsp040_die to use force_sigsegv(SIGSEGV) instead of
    calling do_exit directly is interesting only in that it is nearly the
    most difficult of the incorrect uses of do_exit to remove.

    The change to the seccomp code to simply send a signal instead of
    calling do_coredump directly is a very nice little cleanup made
    possible by realizing the existing signal sending helpers were missing
    a little bit of functionality that is easy to provide"

    * 'exit-cleanups-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
    signal/seccomp: Dump core when there is only one live thread
    signal/seccomp: Refactor seccomp signal and coredump generation
    signal/m68k: Use force_sigsegv(SIGSEGV) in fpsp040_die
    exit/bdflush: Remove the deprecated bdflush system call

    Linus Torvalds
     
  • …/kernel/git/ebiederm/user-namespace

    Pull siginfo si_trapno updates from Eric Biederman:
    "The full set of si_trapno changes was not appropriate as a fix for the
    newly added SIGTRAP TRAP_PERF, and so I postponed the rest of the
    related cleanups.

    This is the rest of the cleanups for si_trapno that reduces it from
    being a really weird arch special case that is expect to be always
    present (but isn't) on the architectures that support it to being yet
    another field in the _sigfault union of struct siginfo.

    The changes have been reviewed and marinated in linux-next. With the
    removal of this awkward special case new code (like SIGTRAP TRAP_PERF)
    that works across architectures should be easier to write and
    maintain"

    * 'siginfo-si_trapno-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
    signal: Rename SIL_PERF_EVENT SIL_FAULT_PERF_EVENT for consistency
    signal: Verify the alignment and size of siginfo_t
    signal: Remove the generic __ARCH_SI_TRAPNO support
    signal/alpha: si_trapno is only used with SIGFPE and SIGTRAP TRAP_UNK
    signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP
    arm64: Add compile-time asserts for siginfo_t offsets
    arm: Add compile-time asserts for siginfo_t offsets
    sparc64: Add compile-time asserts for siginfo_t offsets

    Linus Torvalds
     

01 Sep, 2021

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the big set of driver core patches for 5.15-rc1.

    These do change a number of different things across different
    subsystems, and because of that, there were 2 stable tags created that
    might have already come into your tree from different pulls that did
    the following

    - changed the bus remove callback to return void

    - sysfs iomem_get_mapping rework

    Other than those two things, there's only a few small things in here:

    - kernfs performance improvements for huge numbers of sysfs users at
    once

    - tiny api cleanups

    - other minor changes

    All of these have been in linux-next for a while with no reported
    problems, other than the before-mentioned merge issue"

    * tag 'driver-core-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (33 commits)
    MAINTAINERS: Add dri-devel for component.[hc]
    driver core: platform: Remove platform_device_add_properties()
    ARM: tegra: paz00: Handle device properties with software node API
    bitmap: extend comment to bitmap_print_bitmask/list_to_buf
    drivers/base/node.c: use bin_attribute to break the size limitation of cpumap ABI
    topology: use bin_attribute to break the size limitation of cpumap ABI
    lib: test_bitmap: add bitmap_print_bitmask/list_to_buf test cases
    cpumask: introduce cpumap_print_list/bitmask_to_buf to support large bitmask and list
    sysfs: Rename struct bin_attribute member to f_mapping
    sysfs: Invoke iomem_get_mapping() from the sysfs open callback
    debugfs: Return error during {full/open}_proxy_open() on rmmod
    zorro: Drop useless (and hardly used) .driver member in struct zorro_dev
    zorro: Simplify remove callback
    sh: superhyway: Simplify check in remove callback
    nubus: Simplify check in remove callback
    nubus: Make struct nubus_driver::remove return void
    kernfs: dont call d_splice_alias() under kernfs node lock
    kernfs: use i_lock to protect concurrent inode updates
    kernfs: switch kernfs to use an rwsem
    kernfs: use VFS negative dentry caching
    ...

    Linus Torvalds
     

19 Aug, 2021

1 commit


16 Aug, 2021

1 commit

  • Make architectures select TRACE_IRQFLAGS_SUPPORT instead of
    having many defines.

    Link: https://lkml.kernel.org/r/20210731052233.4703-2-masahiroy@kernel.org

    Acked-by: Heiko Carstens
    Acked-by: Vineet Gupta    #arch/arc
    Acked-by: Michael Ellerman (powerpc)
    Acked-by: Catalin Marinas
    Acked-by: Max Filippov
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Steven Rostedt (VMware)

    Masahiro Yamada
     

09 Aug, 2021

3 commits


04 Aug, 2021

1 commit

  • SOCK_SNDBUF_LOCK and SOCK_RCVBUF_LOCK flags disable automatic socket
    buffers adjustment done by kernel (see tcp_fixup_rcvbuf() and
    tcp_sndbuf_expand()). If we've just created a new socket this adjustment
    is enabled on it, but if one changes the socket buffer size by
    setsockopt(SO_{SND,RCV}BUF*) it becomes disabled.

    CRIU needs to call setsockopt(SO_{SND,RCV}BUF*) on each socket on
    restore as it first needs to increase buffer sizes for packet queues
    restore and second it needs to restore back original buffer sizes. So
    after CRIU restore all sockets become non-auto-adjustable, which can
    decrease network performance of restored applications significantly.

    CRIU need to be able to restore sockets with enabled/disabled adjustment
    to the same state it was before dump, so let's add special setsockopt
    for it.

    Let's also export SOCK_SNDBUF_LOCK and SOCK_RCVBUF_LOCK flags to uAPI so
    that using these interface one can reenable automatic socket buffer
    adjustment on their sockets.

    Signed-off-by: Pavel Tikhomirov
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Pavel Tikhomirov
     

01 Aug, 2021

1 commit

  • Conflicting commits, all resolutions pretty trivial:

    drivers/bus/mhi/pci_generic.c
    5c2c85315948 ("bus: mhi: pci-generic: configurable network interface MRU")
    56f6f4c4eb2a ("bus: mhi: pci_generic: Apply no-op for wake using sideband wake boolean")

    drivers/nfc/s3fwrn5/firmware.c
    a0302ff5906a ("nfc: s3fwrn5: remove unnecessary label")
    46573e3ab08f ("nfc: s3fwrn5: fix undefined parameter values in dev_err()")
    801e541c79bb ("nfc: s3fwrn5: fix undefined parameter values in dev_err()")

    MAINTAINERS
    7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver")
    8a7b46fa7902 ("MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver")

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     

31 Jul, 2021

2 commits

  • Pull networking fixes from Jakub Kicinski:
    "Networking fixes for 5.14-rc4, including fixes from bpf, can, WiFi
    (mac80211) and netfilter trees.

    Current release - regressions:

    - mac80211: fix starting aggregation sessions on mesh interfaces

    Current release - new code bugs:

    - sctp: send pmtu probe only if packet loss in Search Complete state

    - bnxt_en: add missing periodic PHC overflow check

    - devlink: fix phys_port_name of virtual port and merge error

    - hns3: change the method of obtaining default ptp cycle

    - can: mcba_usb_start(): add missing urb->transfer_dma initialization

    Previous releases - regressions:

    - set true network header for ECN decapsulation

    - mlx5e: RX, avoid possible data corruption w/ relaxed ordering and
    LRO

    - phy: re-add check for PHY_BRCM_DIS_TXCRXC_NOENRGY on the BCM54811
    PHY

    - sctp: fix return value check in __sctp_rcv_asconf_lookup

    Previous releases - always broken:

    - bpf:
    - more spectre corner case fixes, introduce a BPF nospec
    instruction for mitigating Spectre v4
    - fix OOB read when printing XDP link fdinfo
    - sockmap: fix cleanup related races

    - mac80211: fix enabling 4-address mode on a sta vif after assoc

    - can:
    - raw: raw_setsockopt(): fix raw_rcv panic for sock UAF
    - j1939: j1939_session_deactivate(): clarify lifetime of session
    object, avoid UAF
    - fix number of identical memory leaks in USB drivers

    - tipc:
    - do not blindly write skb_shinfo frags when doing decryption
    - fix sleeping in tipc accept routine"

    * tag 'net-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (91 commits)
    gve: Update MAINTAINERS list
    can: esd_usb2: fix memory leak
    can: ems_usb: fix memory leak
    can: usb_8dev: fix memory leak
    can: mcba_usb_start(): add missing urb->transfer_dma initialization
    can: hi311x: fix a signedness bug in hi3110_cmd()
    MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver
    bpf: Fix leakage due to insufficient speculative store bypass mitigation
    bpf: Introduce BPF nospec instruction for mitigating Spectre v4
    sis900: Fix missing pci_disable_device() in probe and remove
    net: let flow have same hash in two directions
    nfc: nfcsim: fix use after free during module unload
    tulip: windbond-840: Fix missing pci_disable_device() in probe and remove
    sctp: fix return value check in __sctp_rcv_asconf_lookup
    nfc: s3fwrn5: fix undefined parameter values in dev_err()
    net/mlx5: Fix mlx5_vport_tbl_attr chain from u16 to u32
    net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev()
    net/mlx5: Unload device upon firmware fatal error
    net/mlx5e: Fix page allocation failure for ptp-RQ over SF
    net/mlx5e: Fix page allocation failure for trap-RQ over SF
    ...

    Linus Torvalds
     
  • Pull libata fixlets from Jens Axboe:

    - A fix for PIO highmem (Christoph)

    - Kill HAVE_IDE as it's now unused (Lukas)

    * tag 'libata-5.14-2021-07-30' of git://git.kernel.dk/linux-block:
    arch: Kconfig: clean up obsolete use of HAVE_IDE
    libata: fix ata_pio_sector for CONFIG_HIGHMEM

    Linus Torvalds
     

30 Jul, 2021

2 commits

  • The arch-specific Kconfig files use HAVE_IDE to indicate if IDE is
    supported.

    As IDE support and the HAVE_IDE config vanishes with commit b7fb14d3ac63
    ("ide: remove the legacy ide driver"), there is no need to mention
    HAVE_IDE in all those arch-specific Kconfig files.

    The issue was identified with ./scripts/checkkconfigsymbols.py.

    Fixes: b7fb14d3ac63 ("ide: remove the legacy ide driver")
    Suggested-by: Randy Dunlap
    Signed-off-by: Lukas Bulwahn
    Acked-by: Randy Dunlap
    Link: https://lore.kernel.org/r/20210728182115.4401-1-lukas.bulwahn@gmail.com
    Reviewed-by: Christoph Hellwig
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Jens Axboe

    Lukas Bulwahn
     
  • Most architectures do not need a custom implementation, and in most
    cases the generic implementation is preferred, so change the polariy
    on these Kconfig symbols to require architectures to select them when
    they provide their own version.

    The new name is CONFIG_ARCH_HAS_{STRNCPY_FROM,STRNLEN}_USER.

    The remaining architectures at the moment are: ia64, mips, parisc,
    um and xtensa. We should probably convert these as well, but
    I was not sure how far to take this series. Thomas Bogendoerfer
    had some concerns about converting mips but may still do some
    more detailed measurements to see which version is better.

    Cc: "James E.J. Bottomley"
    Cc: Anton Ivanov
    Cc: Christian Borntraeger
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Jeff Dike
    Cc: Max Filippov
    Cc: Richard Weinberger
    Cc: Thomas Bogendoerfer
    Cc: Vasily Gorbik
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-mips@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: linux-um@lists.infradead.org
    Cc: linux-xtensa@linux-xtensa.org
    Acked-by: Geert Uytterhoeven
    Acked-by: Helge Deller # parisc
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

29 Jul, 2021

1 commit

  • In case of JITs, each of the JIT backends compiles the BPF nospec instruction
    /either/ to a machine instruction which emits a speculation barrier /or/ to
    /no/ machine instruction in case the underlying architecture is not affected
    by Speculative Store Bypass or has different mitigations in place already.

    This covers both x86 and (implicitly) arm64: In case of x86, we use 'lfence'
    instruction for mitigation. In case of arm64, we rely on the firmware mitigation
    as controlled via the ssbd kernel parameter. Whenever the mitigation is enabled,
    it works for all of the kernel code with no need to provide any additional
    instructions here (hence only comment in arm64 JIT). Other archs can follow
    as needed. The BPF nospec instruction is specifically targeting Spectre v4
    since i) we don't use a serialization barrier for the Spectre v1 case, and
    ii) mitigation instructions for v1 and v4 might be different on some archs.

    The BPF nospec is required for a future commit, where the BPF verifier does
    annotate intermediate BPF programs with speculation barriers.

    Co-developed-by: Piotr Krysiuk
    Co-developed-by: Benedict Schlueter
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Piotr Krysiuk
    Signed-off-by: Benedict Schlueter
    Acked-by: Alexei Starovoitov

    Daniel Borkmann
     

24 Jul, 2021

3 commits

  • Update the static assertions about siginfo_t to also describe
    it's alignment and size.

    While investigating if it was possible to add a 64bit field into
    siginfo_t[1] it became apparent that the alignment of siginfo_t
    is as much a part of the ABI as the size of the structure.

    If the alignment changes siginfo_t when embedded in another structure
    can move to a different offset. Which is not acceptable from an ABI
    structure.

    So document that fact and add static assertions to notify developers
    if they change change the alignment by accident.

    [1] https://lkml.kernel.org/r/YJEZdhe6JGFNYlum@elver.google.com
    Acked-by: Marco Elver
    v1: https://lkml.kernel.org/r/20210505141101.11519-4-ebiederm@xmission.co
    Link: https://lkml.kernel.org/r/875yxaxmyl.fsf_-_@disp2133
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • While reviewing the signal handlers on sparc it became clear that
    si_trapno is only set to a non-zero value when sending SIGILL with
    si_code ILL_ILLTRP.

    Add force_sig_fault_trapno and send SIGILL ILL_ILLTRP with it.

    Remove the define of __ARCH_SI_TRAPNO and remove the always zero
    si_trapno parameter from send_sig_fault and force_sig_fault.

    v1: https://lkml.kernel.org/r/m1eeers7q7.fsf_-_@fess.ebiederm.org
    v2: https://lkml.kernel.org/r/20210505141101.11519-7-ebiederm@xmission.com
    Link: https://lkml.kernel.org/r/87mtqnxx89.fsf_-_@disp2133
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • To help catch ABI breaks at compile-time, add compile-time assertions to
    verify the siginfo_t layout. Unlike other architectures, sparc64 is
    special, because it is one of few architectures requiring si_trapno.
    ABI breaks around that field would only be caught here.

    Link: https://lkml.kernel.org/r/m11rat9f85.fsf@fess.ebiederm.org
    Link: https://lkml.kernel.org/r/20210429190734.624918-1-elver@google.com
    Link: https://lkml.kernel.org/r/20210505141101.11519-1-ebiederm@xmission.com
    Link: https://lkml.kernel.org/r/874kcvzbuu.fsf_-_@disp2133
    Suggested-by: Eric W. Biederman
    Acked-by: David S. Miller
    Signed-off-by: Marco Elver
    Signed-off-by: Eric W. Biederman

    Marco Elver
     

23 Jul, 2021

1 commit

  • Parts of linux/compat.h are under an #ifdef, but we end up
    using more of those over time, moving things around bit by
    bit.

    To get it over with once and for all, make all of this file
    uncondititonal now so it can be accessed everywhere. There
    are only a few types left that are in asm/compat.h but not
    yet in the asm-generic version, so add those in the process.

    This requires providing a few more types in asm-generic/compat.h
    that were not already there. The only tricky one is
    compat_sigset_t, which needs a little help on 32-bit architectures
    and for x86.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

21 Jul, 2021

1 commit

  • The driver core ignores the return value of this callback because there
    is only little it can do when a device disappears.

    This is the final bit of a long lasting cleanup quest where several
    buses were converted to also return void from their remove callback.
    Additionally some resource leaks were fixed that were caused by drivers
    returning an error code in the expectation that the driver won't go
    away.

    With struct bus_type::remove returning void it's prevented that newly
    implemented buses return an ignored error code and so don't anticipate
    wrong expectations for driver authors.

    Reviewed-by: Tom Rix (For fpga)
    Reviewed-by: Mathieu Poirier
    Reviewed-by: Cornelia Huck (For drivers/s390 and drivers/vfio)
    Acked-by: Russell King (Oracle) (For ARM, Amba and related parts)
    Acked-by: Mark Brown
    Acked-by: Chen-Yu Tsai (for sunxi-rsb)
    Acked-by: Pali Rohár
    Acked-by: Mauro Carvalho Chehab (for media)
    Acked-by: Hans de Goede (For drivers/platform)
    Acked-by: Alexandre Belloni
    Acked-By: Vinod Koul
    Acked-by: Juergen Gross (For xen)
    Acked-by: Lee Jones (For mfd)
    Acked-by: Johannes Thumshirn (For mcb)
    Acked-by: Johan Hovold
    Acked-by: Srinivas Kandagatla (For slimbus)
    Acked-by: Kirti Wankhede (For vfio)
    Acked-by: Maximilian Luz
    Acked-by: Heikki Krogerus (For ulpi and typec)
    Acked-by: Samuel Iglesias Gonsálvez (For ipack)
    Acked-by: Geoff Levand (For ps3)
    Acked-by: Yehezkel Bernat (For thunderbolt)
    Acked-by: Alexander Shishkin (For intel_th)
    Acked-by: Dominik Brodowski (For pcmcia)
    Acked-by: Rafael J. Wysocki (For ACPI)
    Acked-by: Bjorn Andersson (rpmsg and apr)
    Acked-by: Srinivas Pandruvada (For intel-ish-hid)
    Acked-by: Dan Williams (For CXL, DAX, and NVDIMM)
    Acked-by: William Breathitt Gray (For isa)
    Acked-by: Stefan Richter (For firewire)
    Acked-by: Benjamin Tissoires (For hid)
    Acked-by: Thorsten Scherer (For siox)
    Acked-by: Sven Van Asbroeck (For anybuss)
    Acked-by: Ulf Hansson (For MMC)
    Acked-by: Wolfram Sang # for I2C
    Acked-by: Sudeep Holla
    Acked-by: Geert Uytterhoeven
    Acked-by: Dmitry Torokhov
    Acked-by: Finn Thain
    Signed-off-by: Uwe Kleine-König
    Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König