25 Jan, 2021

1 commit


13 Jan, 2021

1 commit

  • [ Upstream commit 87dbc209ea04645fd2351981f09eff5d23f8e2e9 ]

    Make mandatory in include/asm-generic/Kbuild and
    remove all arch/*/include/asm/local64.h arch-specific files since they
    only #include .

    This fixes build errors on arch/c6x/ and arch/nios2/ for
    block/blk-iocost.c.

    Build-tested on 21 of 25 arch-es. (tools problems on the others)

    Yes, we could even rename to
    and change all #includes to use
    instead.

    Link: https://lkml.kernel.org/r/20201227024446.17018-1-rdunlap@infradead.org
    Signed-off-by: Randy Dunlap
    Suggested-by: Christoph Hellwig
    Reviewed-by: Masahiro Yamada
    Cc: Jens Axboe
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Aurelien Jacquiot
    Cc: Peter Zijlstra
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Randy Dunlap
     

22 Dec, 2020

1 commit

  • To enable seccomp constant action bitmaps, we need to have a static
    mapping to the audit architecture and system call table size. Add these
    for csky.

    Signed-off-by: YiFei Zhu
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/f9219026d4803b22f3e57e3768b4e42e004ef236.1605101222.git.yifeifz2@illinois.edu
    (cherry picked from commit 6e9ae6f98809e0d123ff4d769ba2e6f652119138)
    Signed-off-by: Jeff Vander Stoep
    Bug: 176068146
    Change-Id: I1fea89150f06be98ea4ee4357ad441e60aa6589f

    YiFei Zhu
     

30 Nov, 2020

1 commit


24 Nov, 2020

1 commit

  • We call arch_cpu_idle() with RCU disabled, but then use
    local_irq_{en,dis}able(), which invokes tracing, which relies on RCU.

    Switch all arch_cpu_idle() implementations to use
    raw_local_irq_{en,dis}able() and carefully manage the
    lockdep,rcu,tracing state like we do in entry.

    (XXX: we really should change arch_cpu_idle() to not return with
    interrupts enabled)

    Reported-by: Sven Schnelle
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Mark Rutland
    Tested-by: Mark Rutland
    Link: https://lkml.kernel.org/r/20201120114925.594122626@infradead.org

    Peter Zijlstra
     

10 Nov, 2020

1 commit

  • struct perf_sample_data lives on-stack, we should be careful about it's
    size. Furthermore, the pt_regs copy in there is only because x86_64 is a
    trainwreck, solve it differently.

    Reported-by: Thomas Gleixner
    Signed-off-by: Peter Zijlstra (Intel)
    Tested-by: Steven Rostedt
    Link: https://lkml.kernel.org/r/20201030151955.258178461@infradead.org

    Peter Zijlstra
     

26 Oct, 2020

1 commit

  • Use a more generic form for __section that requires quotes to avoid
    complications with clang and gcc differences.

    Remove the quote operator # from compiler_attributes.h __section macro.

    Convert all unquoted __section(foo) uses to quoted __section("foo").
    Also convert __attribute__((section("foo"))) uses to __section("foo")
    even if the __attribute__ has multiple list entry forms.

    Conversion done using the script at:

    https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.pl

    Signed-off-by: Joe Perches
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Miguel Ojeda
    Signed-off-by: Linus Torvalds

    Joe Perches
     

24 Oct, 2020

1 commit

  • Pull arch task_work cleanups from Jens Axboe:
    "Two cleanups that don't fit other categories:

    - Finally get the task_work_add() cleanup done properly, so we don't
    have random 0/1/false/true/TWA_SIGNAL confusing use cases. Updates
    all callers, and also fixes up the documentation for
    task_work_add().

    - While working on some TIF related changes for 5.11, this
    TIF_NOTIFY_RESUME cleanup fell out of that. Remove some arch
    duplication for how that is handled"

    * tag 'arch-cleanup-2020-10-22' of git://git.kernel.dk/linux-block:
    task_work: cleanup notification modes
    tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume()

    Linus Torvalds
     

23 Oct, 2020

1 commit

  • Pull initial set_fs() removal from Al Viro:
    "Christoph's set_fs base series + fixups"

    * 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Allow a NULL pos pointer to __kernel_read
    fs: Allow a NULL pos pointer to __kernel_write
    powerpc: remove address space overrides using set_fs()
    powerpc: use non-set_fs based maccess routines
    x86: remove address space overrides using set_fs()
    x86: make TASK_SIZE_MAX usable from assembly code
    x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32,64}_types.h
    lkdtm: remove set_fs-based tests
    test_bitmap: remove user bitmap tests
    uaccess: add infrastructure for kernel builds with set_fs()
    fs: don't allow splice read/write without explicit ops
    fs: don't allow kernel reads and writes without iter ops
    sysctl: Convert to iter interfaces
    proc: add a read_iter method to proc proc_ops
    proc: cleanup the compat vs no compat file ops
    proc: remove a level of indentation in proc_get_inode

    Linus Torvalds
     

18 Oct, 2020

1 commit


16 Oct, 2020

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - rework the non-coherent DMA allocator

    - move private definitions out of

    - lower CMA_ALIGNMENT (Paul Cercueil)

    - remove the omap1 dma address translation in favor of the common code

    - make dma-direct aware of multiple dma offset ranges (Jim Quinlan)

    - support per-node DMA CMA areas (Barry Song)

    - increase the default seg boundary limit (Nicolin Chen)

    - misc fixes (Robin Murphy, Thomas Tai, Xu Wang)

    - various cleanups

    * tag 'dma-mapping-5.10' of git://git.infradead.org/users/hch/dma-mapping: (63 commits)
    ARM/ixp4xx: add a missing include of dma-map-ops.h
    dma-direct: simplify the DMA_ATTR_NO_KERNEL_MAPPING handling
    dma-direct: factor out a dma_direct_alloc_from_pool helper
    dma-direct check for highmem pages in dma_direct_alloc_pages
    dma-mapping: merge into
    dma-mapping: move large parts of to kernel/dma
    dma-mapping: move dma-debug.h to kernel/dma/
    dma-mapping: remove
    dma-mapping: merge into
    dma-contiguous: remove dma_contiguous_set_default
    dma-contiguous: remove dev_set_cma_area
    dma-contiguous: remove dma_declare_contiguous
    dma-mapping: split
    cma: decrease CMA_ALIGNMENT lower limit to 2
    firewire-ohci: use dma_alloc_pages
    dma-iommu: implement ->alloc_noncoherent
    dma-mapping: add new {alloc,free}_noncoherent dma_map_ops methods
    dma-mapping: add a new dma_alloc_pages API
    dma-mapping: remove dma_cache_sync
    53c700: convert to dma_alloc_noncoherent
    ...

    Linus Torvalds
     

14 Oct, 2020

1 commit

  • Pull seccomp updates from Kees Cook:
    "The bulk of the changes are with the seccomp selftests to accommodate
    some powerpc-specific behavioral characteristics. Additional cleanups,
    fixes, and improvements are also included:

    - heavily refactor seccomp selftests (and clone3 selftests
    dependency) to fix powerpc (Kees Cook, Thadeu Lima de Souza
    Cascardo)

    - fix style issue in selftests (Zou Wei)

    - upgrade "unknown action" from KILL_THREAD to KILL_PROCESS (Rich
    Felker)

    - replace task_pt_regs(current) with current_pt_regs() (Denis
    Efremov)

    - fix corner-case race in USER_NOTIF (Jann Horn)

    - make CONFIG_SECCOMP no longer per-arch (YiFei Zhu)"

    * tag 'seccomp-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (23 commits)
    seccomp: Make duplicate listener detection non-racy
    seccomp: Move config option SECCOMP to arch/Kconfig
    selftests/clone3: Avoid OS-defined clone_args
    selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit
    selftests/seccomp: Allow syscall nr and ret value to be set separately
    selftests/seccomp: Record syscall during ptrace entry
    selftests/seccomp: powerpc: Fix seccomp return value testing
    selftests/seccomp: Remove SYSCALL_NUM_RET_SHARE_REG in favor of SYSCALL_RET_SET
    selftests/seccomp: Avoid redundant register flushes
    selftests/seccomp: Convert REGSET calls into ARCH_GETREG/ARCH_SETREG
    selftests/seccomp: Convert HAVE_GETREG into ARCH_GETREG/ARCH_SETREG
    selftests/seccomp: Remove syscall setting #ifdefs
    selftests/seccomp: mips: Remove O32-specific macro
    selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro
    selftests/seccomp: arm: Define SYSCALL_NUM_SET macro
    selftests/seccomp: mips: Define SYSCALL_NUM_SET macro
    selftests/seccomp: Provide generic syscall setting macro
    selftests/seccomp: Refactor arch register macros to avoid xtensa special case
    selftests/seccomp: Use __NR_mknodat instead of __NR_mknod
    selftests/seccomp: Use bitwise instead of arithmetic operator for flags
    ...

    Linus Torvalds
     

13 Oct, 2020

2 commits

  • Pull perf/kprobes updates from Ingo Molnar:
    "This prepares to unify the kretprobe trampoline handler and make
    kretprobe lockless (those patches are still work in progress)"

    * tag 'perf-kprobes-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()
    kprobes: Make local functions static
    kprobes: Free kretprobe_instance with RCU callback
    kprobes: Remove NMI context check
    sparc: kprobes: Use generic kretprobe trampoline handler
    sh: kprobes: Use generic kretprobe trampoline handler
    s390: kprobes: Use generic kretprobe trampoline handler
    powerpc: kprobes: Use generic kretprobe trampoline handler
    parisc: kprobes: Use generic kretprobe trampoline handler
    mips: kprobes: Use generic kretprobe trampoline handler
    ia64: kprobes: Use generic kretprobe trampoline handler
    csky: kprobes: Use generic kretprobe trampoline handler
    arc: kprobes: Use generic kretprobe trampoline handler
    arm64: kprobes: Use generic kretprobe trampoline handler
    arm: kprobes: Use generic kretprobe trampoline handler
    x86/kprobes: Use generic kretprobe trampoline handler
    kprobes: Add generic kretprobe trampoline handler

    Linus Torvalds
     
  • Pull orphan section checking from Ingo Molnar:
    "Orphan link sections were a long-standing source of obscure bugs,
    because the heuristics that various linkers & compilers use to handle
    them (include these bits into the output image vs discarding them
    silently) are both highly idiosyncratic and also version dependent.

    Instead of this historically problematic mess, this tree by Kees Cook
    (et al) adds build time asserts and build time warnings if there's any
    orphan section in the kernel or if a section is not sized as expected.

    And because we relied on so many silent assumptions in this area, fix
    a metric ton of dependencies and some outright bugs related to this,
    before we can finally enable the checks on the x86, ARM and ARM64
    platforms"

    * tag 'core-build-2020-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    x86/boot/compressed: Warn on orphan section placement
    x86/build: Warn on orphan section placement
    arm/boot: Warn on orphan section placement
    arm/build: Warn on orphan section placement
    arm64/build: Warn on orphan section placement
    x86/boot/compressed: Add missing debugging sections to output
    x86/boot/compressed: Remove, discard, or assert for unwanted sections
    x86/boot/compressed: Reorganize zero-size section asserts
    x86/build: Add asserts for unwanted sections
    x86/build: Enforce an empty .got.plt section
    x86/asm: Avoid generating unused kprobe sections
    arm/boot: Handle all sections explicitly
    arm/build: Assert for unwanted sections
    arm/build: Add missing sections
    arm/build: Explicitly keep .ARM.attributes sections
    arm/build: Refactor linker script headers
    arm64/build: Assert for unwanted sections
    arm64/build: Add missing DWARF sections
    arm64/build: Use common DISCARDS in linker script
    arm64/build: Remove .eh_frame* sections due to unwind tables
    ...

    Linus Torvalds
     

09 Oct, 2020

1 commit

  • In order to make adding configurable features into seccomp easier,
    it's better to have the options at one single location, considering
    especially that the bulk of seccomp code is arch-independent. An quick
    look also show that many SECCOMP descriptions are outdated; they talk
    about /proc rather than prctl.

    As a result of moving the config option and keeping it default on,
    architectures arm, arm64, csky, riscv, sh, and xtensa did not have SECCOMP
    on by default prior to this and SECCOMP will be default in this change.

    Architectures microblaze, mips, powerpc, s390, sh, and sparc have an
    outdated depend on PROC_FS and this dependency is removed in this change.

    Suggested-by: Jann Horn
    Link: https://lore.kernel.org/lkml/CAG48ez1YWz9cnp08UZgeieYRhHdqh-ch7aNwc4JRBnGyrmgfMg@mail.gmail.com/
    Signed-off-by: YiFei Zhu
    [kees: added HAVE_ARCH_SECCOMP help text, tweaked wording]
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/9ede6ef35c847e58d61e476c6a39540520066613.1600951211.git.yifeifz2@illinois.edu

    YiFei Zhu
     

06 Oct, 2020

2 commits


09 Sep, 2020

1 commit

  • Add a CONFIG_SET_FS option that is selected by architecturess that
    implement set_fs, which is all of them initially. If the option is not
    set stubs for routines related to overriding the address space are
    provided so that architectures can start to opt out of providing set_fs.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Kees Cook
    Signed-off-by: Al Viro

    Christoph Hellwig
     

08 Sep, 2020

1 commit


01 Sep, 2020

1 commit

  • The .comment section doesn't belong in STABS_DEBUG. Split it out into a
    new macro named ELF_DETAILS. This will gain other non-debug sections
    that need to be accounted for when linking with --orphan-handling=warn.

    Signed-off-by: Kees Cook
    Signed-off-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org
    Link: https://lore.kernel.org/r/20200821194310.3089815-5-keescook@chromium.org

    Kees Cook
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

13 Aug, 2020

3 commits

  • Use the general page fault accounting by passing regs into
    handle_mm_fault(). It naturally solve the issue of multiple page fault
    accounting when page fault retry happened.

    Signed-off-by: Peter Xu
    Signed-off-by: Andrew Morton
    Acked-by: Guo Ren
    Link: http://lkml.kernel.org/r/20200707225021.200906-7-peterx@redhat.com
    Signed-off-by: Linus Torvalds

    Peter Xu
     
  • Patch series "mm: Page fault accounting cleanups", v5.

    This is v5 of the pf accounting cleanup series. It originates from Gerald
    Schaefer's report on an issue a week ago regarding to incorrect page fault
    accountings for retried page fault after commit 4064b9827063 ("mm: allow
    VM_FAULT_RETRY for multiple times"):

    https://lore.kernel.org/lkml/20200610174811.44b94525@thinkpad/

    What this series did:

    - Correct page fault accounting: we do accounting for a page fault
    (no matter whether it's from #PF handling, or gup, or anything else)
    only with the one that completed the fault. For example, page fault
    retries should not be counted in page fault counters. Same to the
    perf events.

    - Unify definition of PERF_COUNT_SW_PAGE_FAULTS: currently this perf
    event is used in an adhoc way across different archs.

    Case (1): for many archs it's done at the entry of a page fault
    handler, so that it will also cover e.g. errornous faults.

    Case (2): for some other archs, it is only accounted when the page
    fault is resolved successfully.

    Case (3): there're still quite some archs that have not enabled
    this perf event.

    Since this series will touch merely all the archs, we unify this
    perf event to always follow case (1), which is the one that makes most
    sense. And since we moved the accounting into handle_mm_fault, the
    other two MAJ/MIN perf events are well taken care of naturally.

    - Unify definition of "major faults": the definition of "major
    fault" is slightly changed when used in accounting (not
    VM_FAULT_MAJOR). More information in patch 1.

    - Always account the page fault onto the one that triggered the page
    fault. This does not matter much for #PF handlings, but mostly for
    gup. More information on this in patch 25.

    Patchset layout:

    Patch 1: Introduced the accounting in handle_mm_fault(), not enabled.
    Patch 2-23: Enable the new accounting for arch #PF handlers one by one.
    Patch 24: Enable the new accounting for the rest outliers (gup, iommu, etc.)
    Patch 25: Cleanup GUP task_struct pointer since it's not needed any more

    This patch (of 25):

    This is a preparation patch to move page fault accountings into the
    general code in handle_mm_fault(). This includes both the per task
    flt_maj/flt_min counters, and the major/minor page fault perf events. To
    do this, the pt_regs pointer is passed into handle_mm_fault().

    PERF_COUNT_SW_PAGE_FAULTS should still be kept in per-arch page fault
    handlers.

    So far, all the pt_regs pointer that passed into handle_mm_fault() is
    NULL, which means this patch should have no intented functional change.

    Suggested-by: Linus Torvalds
    Signed-off-by: Peter Xu
    Signed-off-by: Andrew Morton
    Cc: Albert Ou
    Cc: Alexander Gordeev
    Cc: Andy Lutomirski
    Cc: Benjamin Herrenschmidt
    Cc: Borislav Petkov
    Cc: Brian Cain
    Cc: Catalin Marinas
    Cc: Christian Borntraeger
    Cc: Chris Zankel
    Cc: Dave Hansen
    Cc: David S. Miller
    Cc: Geert Uytterhoeven
    Cc: Gerald Schaefer
    Cc: Greentime Hu
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Ivan Kokshaysky
    Cc: James E.J. Bottomley
    Cc: John Hubbard
    Cc: Jonas Bonn
    Cc: Ley Foon Tan
    Cc: "Luck, Tony"
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Nick Hu
    Cc: Palmer Dabbelt
    Cc: Paul Mackerras
    Cc: Paul Walmsley
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Richard Henderson
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Stefan Kristiansson
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Vasily Gorbik
    Cc: Vincent Chen
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200707225021.200906-1-peterx@redhat.com
    Link: http://lkml.kernel.org/r/20200707225021.200906-2-peterx@redhat.com
    Signed-off-by: Linus Torvalds

    Peter Xu
     
  • segment_eq is only used to implement uaccess_kernel. Just open code
    uaccess_kernel in the arch uaccess headers and remove one layer of
    indirection.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Acked-by: Linus Torvalds
    Acked-by: Greentime Hu
    Acked-by: Geert Uytterhoeven
    Cc: Nick Hu
    Cc: Vincent Chen
    Cc: Paul Walmsley
    Cc: Palmer Dabbelt
    Link: http://lkml.kernel.org/r/20200710135706.537715-5-hch@lst.de
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

08 Aug, 2020

4 commits

  • Merge misc updates from Andrew Morton:

    - a few MM hotfixes

    - kthread, tools, scripts, ntfs and ocfs2

    - some of MM

    Subsystems affected by this patch series: kthread, tools, scripts, ntfs,
    ocfs2 and mm (hofixes, pagealloc, slab-generic, slab, slub, kcsan,
    debug, pagecache, gup, swap, shmem, memcg, pagemap, mremap, mincore,
    sparsemem, vmalloc, kasan, pagealloc, hugetlb and vmscan).

    * emailed patches from Andrew Morton : (162 commits)
    mm: vmscan: consistent update to pgrefill
    mm/vmscan.c: fix typo
    khugepaged: khugepaged_test_exit() check mmget_still_valid()
    khugepaged: retract_page_tables() remember to test exit
    khugepaged: collapse_pte_mapped_thp() protect the pmd lock
    khugepaged: collapse_pte_mapped_thp() flush the right range
    mm/hugetlb: fix calculation of adjust_range_if_pmd_sharing_possible
    mm: thp: replace HTTP links with HTTPS ones
    mm/page_alloc: fix memalloc_nocma_{save/restore} APIs
    mm/page_alloc.c: skip setting nodemask when we are in interrupt
    mm/page_alloc: fallbacks at most has 3 elements
    mm/page_alloc: silence a KASAN false positive
    mm/page_alloc.c: remove unnecessary end_bitidx for [set|get]_pfnblock_flags_mask()
    mm/page_alloc.c: simplify pageblock bitmap access
    mm/page_alloc.c: extract the common part in pfn_to_bitidx()
    mm/page_alloc.c: replace the definition of NR_MIGRATETYPE_BITS with PB_migratetype_bits
    mm/shuffle: remove dynamic reconfiguration
    mm/memory_hotplug: document why shuffle_zone() is relevant
    mm/page_alloc: remove nr_free_pagecache_pages()
    mm: remove vm_total_pages
    ...

    Linus Torvalds
     
  • Most architectures define pgd_free() as a wrapper for free_page().

    Provide a generic version in asm-generic/pgalloc.h and enable its use for
    most architectures.

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Reviewed-by: Pekka Enberg
    Acked-by: Geert Uytterhoeven [m68k]
    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: Matthew Wilcox
    Link: http://lkml.kernel.org/r/20200627143453.31835-7-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Patch series "mm: cleanup usage of "

    Most architectures have very similar versions of pXd_alloc_one() and
    pXd_free_one() for intermediate levels of page table. These patches add
    generic versions of these functions in and enable
    use of the generic functions where appropriate.

    In addition, functions declared and defined in headers are
    used mostly by core mm and early mm initialization in arch and there is no
    actual reason to have the included all over the place.
    The first patch in this series removes unneeded includes of

    In the end it didn't work out as neatly as I hoped and moving
    pXd_alloc_track() definitions to would require
    unnecessary changes to arches that have custom page table allocations, so
    I've decided to move lib/ioremap.c to mm/ and make pgalloc-track.h local
    to mm/.

    This patch (of 8):

    In most cases header is required only for allocations of
    page table memory. Most of the .c files that include that header do not
    use symbols declared in and do not require that header.

    As for the other header files that used to include , it is
    possible to move that include into the .c file that actually uses symbols
    from and drop the include from the header file.

    The process was somewhat automated using

    sed -i -E '/[
    Signed-off-by: Andrew Morton
    Reviewed-by: Pekka Enberg
    Acked-by: Geert Uytterhoeven [m68k]
    Cc: Abdul Haleem
    Cc: Andy Lutomirski
    Cc: Arnd Bergmann
    Cc: Christophe Leroy
    Cc: Joerg Roedel
    Cc: Max Filippov
    Cc: Peter Zijlstra
    Cc: Satheesh Rajendran
    Cc: Stafford Horne
    Cc: Stephen Rothwell
    Cc: Steven Rostedt
    Cc: Joerg Roedel
    Cc: Matthew Wilcox
    Link: http://lkml.kernel.org/r/20200627143453.31835-1-rppt@kernel.org
    Link: http://lkml.kernel.org/r/20200627143453.31835-2-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Pull ptrace regset updates from Al Viro:
    "Internal regset API changes:

    - regularize copy_regset_{to,from}_user() callers

    - switch to saner calling conventions for ->get()

    - kill user_regset_copyout()

    The ->put() side of things will have to wait for the next cycle,
    unfortunately.

    The balance is about -1KLoC and replacements for ->get() instances are
    a lot saner"

    * 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (41 commits)
    regset: kill user_regset_copyout{,_zero}()
    regset(): kill ->get_size()
    regset: kill ->get()
    csky: switch to ->regset_get()
    xtensa: switch to ->regset_get()
    parisc: switch to ->regset_get()
    nds32: switch to ->regset_get()
    nios2: switch to ->regset_get()
    hexagon: switch to ->regset_get()
    h8300: switch to ->regset_get()
    openrisc: switch to ->regset_get()
    riscv: switch to ->regset_get()
    c6x: switch to ->regset_get()
    ia64: switch to ->regset_get()
    arc: switch to ->regset_get()
    arm: switch to ->regset_get()
    sh: convert to ->regset_get()
    arm64: switch to ->regset_get()
    mips: switch to ->regset_get()
    sparc: switch to ->regset_get()
    ...

    Linus Torvalds
     

07 Aug, 2020

1 commit

  • Pull arch/csky updates from Guo Ren:
    "New features:
    - seccomp-filter
    - err-injection
    - top-down&random mmap-layout
    - irq_work
    - show_ipi
    - context-tracking

    Fixes & Optimizations:
    - kprobe_on_ftrace
    - optimize panic print"

    * tag 'csky-for-linus-5.9-rc1' of https://github.com/c-sky/csky-linux:
    csky: Add context tracking support
    csky: Add arch_show_interrupts for IPI interrupts
    csky: Add irq_work support
    csky: Fixup warning by EXPORT_SYMBOL(kmap)
    csky: Set CONFIG_NR_CPU 4 as default
    csky: Use top-down mmap layout
    csky: Optimize the trap processing flow
    csky: Add support for function error injection
    csky: Fixup kprobes handler couldn't change pc
    csky: Fixup duplicated restore sp in RESTORE_REGS_FTRACE
    csky: Add cpu feature register hint for smp
    csky: Add SECCOMP_FILTER supported
    csky: remove unusued thread_saved_pc and *_segments functions/macros

    Linus Torvalds
     

01 Aug, 2020

1 commit

  • This patch support context tracking with no hz full.

    Here is the test result with dynticks-testing (see tick_stop):

    cat /sys/kernel/debug/tracing/per_cpu/cpu0/trace
    tracer: nop

    entries-in-buffer/entries-written: 356/356 #P:1

    _-----=> irqs-off
    / _----=> need-resched
    | / _---=> hardirq/softirq
    || / _--=> preempt-depth
    ||| / delay
    TASK-PID CPU# |||| TIMESTAMP FUNCTION
    | | | |||| | |
    ...
    sleep-192 [000] d.h. 167.088270: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=166436355700
    sleep-192 [000] d.h. 167.092279: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=166440365700
    -0 [000] d.h2 167.096492: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=166444578400
    -0 [000] d..1 167.097876: tick_stop: success=1 dependency=NONE
    ^^^^^^^^^
    -0 [000] d.h1 168.818206: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=168166280900
    kworker/u2:0-7 [000] .... 168.821760: workqueue_execute_start: work struct (ptrval): function wb_workfn
    kworker/u2:0-7 [000] d.h1 168.824464: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=168172547100
    kworker/0:1-18 [000] .... 168.825053: workqueue_execute_start: work struct (ptrval): function vmstat_update
    kworker/0:1-18 [000] .... 168.825238: workqueue_execute_start: work struct (ptrval): function vmstat_shepherd
    kworker/0:1-18 [000] .... 168.825516: workqueue_execute_start: work struct (ptrval): function neigh_periodic_work
    -0 [000] d..1 168.826121: tick_stop: success=1 dependency=NONE
    kworker/u2:0-7 [000] .... 169.377327: workqueue_execute_start: work struct (ptrval): function flush_to_ldisc
    -0 [000] d..1 169.379832: tick_stop: success=1 dependency=NONE
    kworker/u2:0-7 [000] .... 169.607935: workqueue_execute_start: work struct (ptrval): function flush_to_ldisc
    kworker/u2:0-7 [000] d.h1 169.608148: hrtimer_expire_entry: hrtimer=(ptrval) function=tick_sched_timer now=168956235500
    -0 [000] d..1 169.608654: tick_stop: success=1 dependency=NONE

    Signed-off-by: Guo Ren
    Cc: Greentime Hu
    Cc: Arnd Bergmann

    Guo Ren
     

31 Jul, 2020

10 commits

  • Here is the result:

    cat /proc/interrupts
    CPU0 CPU1 CPU2 CPU3
    15: 1348 1299 952 1076 C-SKY SMP Intc 15 IPI Interrupt
    16: 1203 1825 1598 1307 C-SKY SMP Intc 16 csky_mp_timer
    43: 292 0 0 0 C-SKY SMP Intc 43 ttyS0
    57: 106 0 0 0 C-SKY SMP Intc 57 virtio0
    IPI0: 0 0 0 0 Empty interrupts
    IPI1: 19 41 45 27 Rescheduling interrupts
    IPI2: 1330 1259 908 1050 Function call interrupts
    IPI3: 0 0 0 0 Irq work interrupts

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • Running work in hardware interrupt context for csky. Implement:
    - arch_irq_work_raise()
    - arch_irq_work_has_interrupt()

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • This a wrong code, and no kmap symbol for export.

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • The C860 processors support 4 cores smp for maximum, so set NR_CPU
    to 4 as default

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • Follow riscv mmap layout with commit "riscv: make mmap allocation
    top-down by default (54c95a11cc1b)".

    Before:
    cat /proc/self/maps
    00008000-000dc000 r-xp 00000000 fe:00 17 /bin/busybox
    000dc000-000dd000 r--p 000d3000 fe:00 17 /bin/busybox
    000dd000-000de000 rw-p 000d4000 fe:00 17 /bin/busybox
    2aaa8000-2aac6000 r-xp 00000000 fe:00 196 /lib/ld-2.28.9000.so
    2aac6000-2aac7000 r-xp 00000000 00:00 0 [vdso]
    2aac7000-2aac8000 r--p 0001e000 fe:00 196 /lib/ld-2.28.9000.so
    2aac8000-2aac9000 rw-p 0001f000 fe:00 196 /lib/ld-2.28.9000.so
    2aac9000-2aad9000 r-xp 00000000 fe:00 219 /lib/libresolv-2.28.9000.so
    2aad9000-2aada000 r--p 0000f000 fe:00 219 /lib/libresolv-2.28.9000.so
    2aada000-2aadb000 rw-p 00010000 fe:00 219 /lib/libresolv-2.28.9000.so
    2aadb000-2aadd000 rw-p 00000000 00:00 0
    2aadd000-2ac27000 r-xp 00000000 fe:00 203 /lib/libc-2.28.9000.so
    2ac27000-2ac28000 ---p 0014a000 fe:00 203 /lib/libc-2.28.9000.so
    2ac28000-2ac2a000 r--p 0014a000 fe:00 203 /lib/libc-2.28.9000.so
    2ac2a000-2ac2b000 rw-p 0014c000 fe:00 203 /lib/libc-2.28.9000.so
    2ac2b000-2ac2e000 rw-p 00000000 00:00 0
    7fb99000-7fbba000 rwxp 00000000 00:00 0 [stack]

    After:
    cat /proc/self/maps
    00008000-000dc000 r-xp 00000000 fe:00 17 /bin/busybox
    000dc000-000dd000 r--p 000d3000 fe:00 17 /bin/busybox
    000dd000-000de000 rw-p 000d4000 fe:00 17 /bin/busybox
    77e13000-77f5d000 r-xp 00000000 fe:00 203 /lib/libc-2.28.9000.so
    77f5d000-77f5e000 ---p 0014a000 fe:00 203 /lib/libc-2.28.9000.so
    77f5e000-77f60000 r--p 0014a000 fe:00 203 /lib/libc-2.28.9000.so
    77f60000-77f61000 rw-p 0014c000 fe:00 203 /lib/libc-2.28.9000.so
    77f61000-77f66000 rw-p 00000000 00:00 0
    77f66000-77f76000 r-xp 00000000 fe:00 219 /lib/libresolv-2.28.9000.so
    77f76000-77f77000 r--p 0000f000 fe:00 219 /lib/libresolv-2.28.9000.so
    77f77000-77f78000 rw-p 00010000 fe:00 219 /lib/libresolv-2.28.9000.so
    77f78000-77f96000 r-xp 00000000 fe:00 196 /lib/ld-2.28.9000.so
    77f96000-77f97000 r-xp 00000000 00:00 0 [vdso]
    77f97000-77f98000 r--p 0001e000 fe:00 196 /lib/ld-2.28.9000.so
    77f98000-77f99000 rw-p 0001f000 fe:00 196 /lib/ld-2.28.9000.so
    7fd7b000-7fd9c000 rwxp 00000000 00:00 0 [stack]

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • - Seperate different trap functions
    - Add trap_no()
    - Remove panic code print
    - Redesign die_if_kerenl to die with riscv's
    - Print exact trap info for app segment fault

    [ 17.389321] gzip[126]: unhandled signal 11 code 0x3 at 0x0007835a in busybox[8000+d4000]
    [ 17.393882]
    [ 17.393882] CURRENT PROCESS:
    [ 17.393882]
    [ 17.394309] COMM=gzip PID=126
    [ 17.394513] TEXT=00008000-000db2e4 DATA=000dcf14-000dd1ad BSS=000dd1ad-000ff000
    [ 17.395499] USER-STACK=7f888e50 KERNEL-STACK=bf130300
    [ 17.395499]
    [ 17.396801] PC: 0x0007835a (0x7835a)
    [ 17.397048] LR: 0x000058b4 (0x58b4)
    [ 17.397285] SP: 0xbe519f68
    [ 17.397555] orig_a0: 0x00002852
    [ 17.397886] PSR: 0x00020341
    [ 17.398356] a0: 0x00002852 a1: 0x000f2f5a a2: 0x0000d7ae a3: 0x0000005d
    [ 17.399289] r4: 0x000de150 r5: 0x00000002 r6: 0x00000102 r7: 0x00007efa
    [ 17.399800] r8: 0x7f888bc4 r9: 0x00000001 r10: 0x000002eb r11: 0x0000aac1
    [ 17.400166] r12: 0x00002ef2 r13: 0x00000007 r15: 0x000058b4
    [ 17.400531] r16: 0x0000004c r17: 0x00000031 r18: 0x000f5816 r19: 0x000e8068
    [ 17.401006] r20: 0x000f5818 r21: 0x000e8068 r22: 0x000f5918 r23: 0x90000000
    [ 17.401721] r24: 0x00000031 r25: 0x000000c8 r26: 0x00000000 r27: 0x00000000
    [ 17.402199] r28: 0x2ac2a000 r29: 0x00000000 r30: 0x00000000 tls: 0x2aadbaa8
    [ 17.402686] hi: 0x00120340 lo: 0x7f888bec
    /etc/init.ci/ntfs3g_run: line 61: 126 Segmentation fault gzip -c -9 /mnt/test.bin > /mnt/test_bin.gz

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • Inspired by the commit 42d038c4fb00 ("arm64: Add support for function
    error injection"), this patch supports function error injection for
    csky.

    This patch mainly support two functions: one is regs_set_return_value()
    which is used to overwrite the return value; the another function is
    override_function_with_return() which is to override the probed
    function returning and jump to its caller.

    Test log:

    cd /sys/kernel/debug/fail_function/
    echo sys_clone > inject
    echo 100 > probability
    echo 1 > interval
    ls /
    [ 108.644163] FAULT_INJECTION: forcing a failure.
    [ 108.644163] name fail_function, interval 1, probability 100, space 0, times 1
    [ 108.647799] CPU: 0 PID: 104 Comm: sh Not tainted 5.8.0-rc5+ #46
    [ 108.648384] Call Trace:
    [ 108.649339] [] walk_stackframe+0x0/0xf0
    [ 108.649679] [] show_stack+0x32/0x5c
    [ 108.649927] [] dump_stack+0x6e/0x9c
    [ 108.650271] [] should_fail+0x15e/0x1ac
    [ 108.650720] [] fei_kprobe_handler+0x28/0x5c
    [ 108.651519] [] kprobe_breakpoint_handler+0x144/0x1cc
    [ 108.652289] [] trap_c+0x8e/0x110
    [ 108.652816] [] csky_trap+0x5c/0x70
    -sh: can't fork: Invalid argument

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • The "Changing Execution Path" section in the Documentation/kprobes.txt
    said:

    Since kprobes can probe into a running kernel code, it can change the
    register set, including instruction pointer.

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • There is no user return for RESTORE_REGS_FTRACE, so it's no need to
    save sp into ss0 as RESTORE_REGS_ALL.

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren
     
  • CPU features registers are setup by customers' bootloader, but
    Linux must help transfer them from the primary to secondary cores.
    This patch add hint2 CPU feature register supported.

    Signed-off-by: Guo Ren
    Cc: Arnd Bergmann

    Guo Ren