17 Jan, 2021

1 commit

  • commit 2ca408d9c749c32288bc28725f9f12ba30299e8f upstream.

    Commit

    121b32a58a3a ("x86/entry/32: Use IA32-specific wrappers for syscalls taking 64-bit arguments")

    converted native x86-32 which take 64-bit arguments to use the
    compat handlers to allow conversion to passing args via pt_regs.
    sys_fanotify_mark() was however missed, as it has a general compat
    handler. Add a config option that will use the syscall wrapper that
    takes the split args for native 32-bit.

    [ bp: Fix typo in Kconfig help text. ]

    Fixes: 121b32a58a3a ("x86/entry/32: Use IA32-specific wrappers for syscalls taking 64-bit arguments")
    Reported-by: Paweł Jasiak
    Signed-off-by: Brian Gerst
    Signed-off-by: Borislav Petkov
    Acked-by: Jan Kara
    Acked-by: Andy Lutomirski
    Link: https://lkml.kernel.org/r/20201130223059.101286-1-brgerst@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Brian Gerst
     

30 Dec, 2020

1 commit

  • commit adab66b71abfe206a020f11e561f4df41f0b2aba upstream.

    It was believed that metag was the only architecture that required the ring
    buffer to keep 8 byte words aligned on 8 byte architectures, and with its
    removal, it was assumed that the ring buffer code did not need to handle
    this case. It appears that sparc64 also requires this.

    The following was reported on a sparc64 boot up:

    kernel: futex hash table entries: 65536 (order: 9, 4194304 bytes, linear)
    kernel: Running postponed tracer tests:
    kernel: Testing tracer function:
    kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
    kernel: Kernel unaligned access at TPC[552a24] trace_function+0x44/0x140
    kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
    kernel: Kernel unaligned access at TPC[552a24] trace_function+0x44/0x140
    kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
    kernel: PASSED

    Need to put back the 64BIT aligned code for the ring buffer.

    Link: https://lore.kernel.org/r/CADxRZqzXQRYgKc=y-KV=S_yHL+Y8Ay2mh5ezeZUnpRvg+syWKw@mail.gmail.com

    Cc: stable@vger.kernel.org
    Fixes: 86b3de60a0b6 ("ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS")
    Reported-by: Anatoly Pugachev
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     

01 Dec, 2020

1 commit

  • Currently, '--orphan-handling=warn' is spread out across four different
    architectures in their respective Makefiles, which makes it a little
    unruly to deal with in case it needs to be disabled for a specific
    linker version (in this case, ld.lld 10.0.1).

    To make it easier to control this, hoist this warning into Kconfig and
    the main Makefile so that disabling it is simpler, as the warning will
    only be enabled in a couple places (main Makefile and a couple of
    compressed boot folders that blow away LDFLAGS_vmlinx) and making it
    conditional is easier due to Kconfig syntax. One small additional
    benefit of this is saving a call to ld-option on incremental builds
    because we will have already evaluated it for CONFIG_LD_ORPHAN_WARN.

    To keep the list of supported architectures the same, introduce
    CONFIG_ARCH_WANT_LD_ORPHAN_WARN, which an architecture can select to
    gain this automatically after all of the sections are specified and size
    asserted. A special thanks to Kees Cook for the help text on this
    config.

    Link: https://github.com/ClangBuiltLinux/linux/issues/1187
    Acked-by: Kees Cook
    Acked-by: Michael Ellerman (powerpc)
    Reviewed-by: Nick Desaulniers
    Tested-by: Nick Desaulniers
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Masahiro Yamada

    Nathan Chancellor
     

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
     

17 Oct, 2020

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - A series from Nick adding ARCH_WANT_IRQS_OFF_ACTIVATE_MM & selecting
    it for powerpc, as well as a related fix for sparc.

    - Remove support for PowerPC 601.

    - Some fixes for watchpoints & addition of a new ptrace flag for
    detecting ISA v3.1 (Power10) watchpoint features.

    - A fix for kernels using 4K pages and the hash MMU on bare metal
    Power9 systems with > 16TB of RAM, or RAM on the 2nd node.

    - A basic idle driver for shallow stop states on Power10.

    - Tweaks to our sched domains code to better inform the scheduler about
    the hardware topology on Power9/10, where two SMT4 cores can be
    presented by firmware as an SMT8 core.

    - A series doing further reworks & cleanups of our EEH code.

    - Addition of a filter for RTAS (firmware) calls done via sys_rtas(),
    to prevent root from overwriting kernel memory.

    - Other smaller features, fixes & cleanups.

    Thanks to: Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V,
    Athira Rajeev, Biwen Li, Cameron Berkenpas, Cédric Le Goater, Christophe
    Leroy, Christoph Hellwig, Colin Ian King, Daniel Axtens, David Dai, Finn
    Thain, Frederic Barrat, Gautham R. Shenoy, Greg Kurz, Gustavo Romero,
    Ira Weiny, Jason Yan, Joel Stanley, Jordan Niethe, Kajol Jain, Konrad
    Rzeszutek Wilk, Laurent Dufour, Leonardo Bras, Liu Shixin, Luca
    Ceresoli, Madhavan Srinivasan, Mahesh Salgaonkar, Nathan Lynch, Nicholas
    Mc Guire, Nicholas Piggin, Nick Desaulniers, Oliver O'Halloran, Pedro
    Miraglia Franco de Carvalho, Pratik Rajesh Sampat, Qian Cai, Qinglang
    Miao, Ravi Bangoria, Russell Currey, Satheesh Rajendran, Scott Cheloha,
    Segher Boessenkool, Srikar Dronamraju, Stan Johnson, Stephen Kitt,
    Stephen Rothwell, Thiago Jung Bauermann, Tyrel Datwyler, Vaibhav Jain,
    Vaidyanathan Srinivasan, Vasant Hegde, Wang Wensheng, Wolfram Sang, Yang
    Yingliang, zhengbin.

    * tag 'powerpc-5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (228 commits)
    Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
    selftests/powerpc: Fix eeh-basic.sh exit codes
    cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier
    powerpc/time: Make get_tb() common to PPC32 and PPC64
    powerpc/time: Make get_tbl() common to PPC32 and PPC64
    powerpc/time: Remove get_tbu()
    powerpc/time: Avoid using get_tbl() and get_tbu() internally
    powerpc/time: Make mftb() common to PPC32 and PPC64
    powerpc/time: Rename mftbl() to mftb()
    powerpc/32s: Remove #ifdef CONFIG_PPC_BOOK3S_32 in head_book3s_32.S
    powerpc/32s: Rename head_32.S to head_book3s_32.S
    powerpc/32s: Setup the early hash table at all time.
    powerpc/time: Remove ifdef in get_dec() and set_dec()
    powerpc: Remove get_tb_or_rtc()
    powerpc: Remove __USE_RTC()
    powerpc: Tidy up a bit after removal of PowerPC 601.
    powerpc: Remove support for PowerPC 601
    powerpc: Remove PowerPC 601
    powerpc: Drop SYNC_601() ISYNC_601() and SYNC()
    powerpc: Remove CONFIG_PPC601_SYNC_FIX
    ...

    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
     

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
     

16 Sep, 2020

1 commit

  • Reading and modifying current->mm and current->active_mm and switching
    mm should be done with irqs off, to prevent races seeing an intermediate
    state.

    This is similar to commit 38cf307c1f20 ("mm: fix kthread_use_mm() vs TLB
    invalidate"). At exec-time when the new mm is activated, the old one
    should usually be single-threaded and no longer used, unless something
    else is holding an mm_users reference (which may be possible).

    Absent other mm_users, there is also a race with preemption and lazy tlb
    switching. Consider the kernel_execve case where the current thread is
    using a lazy tlb active mm:

    call_usermodehelper()
    kernel_execve()
    old_mm = current->mm;
    active_mm = current->active_mm;
    *** preempt *** --------------------> schedule()
    prev->active_mm = NULL;
    mmdrop(prev active_mm);
    ...
    mm = mm;
    current->active_mm = mm;
    if (!old_mm)
    mmdrop(active_mm);

    If we switch back to the kernel thread from a different mm, there is a
    double free of the old active_mm, and a missing free of the new one.

    Closing this race only requires interrupts to be disabled while ->mm
    and ->active_mm are being switched, but the TLB problem requires also
    holding interrupts off over activate_mm. Unfortunately not all archs
    can do that yet, e.g., arm defers the switch if irqs are disabled and
    expects finish_arch_post_lock_switch() to be called to complete the
    flush; um takes a blocking lock in activate_mm().

    So as a first step, disable interrupts across the mm/active_mm updates
    to close the lazy tlb preempt race, and provide an arch option to
    extend that to activate_mm which allows architectures doing IPI based
    TLB shootdowns to close the second race.

    This is a bit ugly, but in the interest of fixing the bug and backporting
    before all architectures are converted this is a compromise.

    Signed-off-by: Nicholas Piggin
    Acked-by: Peter Zijlstra (Intel)
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200914045219.3736466-2-npiggin@gmail.com

    Nicholas Piggin
     

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
     

01 Sep, 2020

3 commits

  • Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Link: https://lore.kernel.org/r/20200818135804.922581202@infradead.org

    Peter Zijlstra
     
  • Add infrastructure for an arch-specific CONFIG_HAVE_STATIC_CALL_INLINE
    option, which is a faster version of CONFIG_HAVE_STATIC_CALL. At
    runtime, the static call sites are patched directly, rather than using
    the out-of-line trampolines.

    Compared to out-of-line static calls, the performance benefits are more
    modest, but still measurable. Steven Rostedt did some tracepoint
    measurements:

    https://lkml.kernel.org/r/20181126155405.72b4f718@gandalf.local.home

    This code is heavily inspired by the jump label code (aka "static
    jumps"), as some of the concepts are very similar.

    For more details, see the comments in include/linux/static_call.h.

    [peterz: simplified interface; merged trampolines]

    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Reviewed-by: Steven Rostedt (VMware)
    Cc: Linus Torvalds
    Link: https://lore.kernel.org/r/20200818135804.684334440@infradead.org

    Josh Poimboeuf
     
  • Static calls are a replacement for global function pointers. They use
    code patching to allow direct calls to be used instead of indirect
    calls. They give the flexibility of function pointers, but with
    improved performance. This is especially important for cases where
    retpolines would otherwise be used, as retpolines can significantly
    impact performance.

    The concept and code are an extension of previous work done by Ard
    Biesheuvel and Steven Rostedt:

    https://lkml.kernel.org/r/20181005081333.15018-1-ard.biesheuvel@linaro.org
    https://lkml.kernel.org/r/20181006015110.653946300@goodmis.org

    There are two implementations, depending on arch support:

    1) out-of-line: patched trampolines (CONFIG_HAVE_STATIC_CALL)
    2) basic function pointers

    For more details, see the comments in include/linux/static_call.h.

    [peterz: simplified interface]

    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Reviewed-by: Steven Rostedt (VMware)
    Cc: Linus Torvalds
    Link: https://lore.kernel.org/r/20200818135804.623259796@infradead.org

    Josh Poimboeuf
     

15 Aug, 2020

1 commit

  • Pull timekeeping updates from Thomas Gleixner:
    "A set of timekeeping/VDSO updates:

    - Preparatory work to allow S390 to switch over to the generic VDSO
    implementation.

    S390 requires that the VDSO data pointer is handed in to the
    counter read function when time namespace support is enabled.
    Adding the pointer is a NOOP for all other architectures because
    the compiler is supposed to optimize that out when it is unused in
    the architecture specific inline. The change also solved a similar
    problem for MIPS which fortunately has time namespaces not yet
    enabled.

    S390 needs to update clock related VDSO data independent of the
    timekeeping updates. This was solved so far with yet another
    sequence counter in the S390 implementation. A better solution is
    to utilize the already existing VDSO sequence count for this. The
    core code now exposes helper functions which allow to serialize
    against the timekeeper code and against concurrent readers.

    S390 needs extra data for their clock readout function. The initial
    common VDSO data structure did not provide a way to add that. It
    now has an embedded architecture specific struct embedded which
    defaults to an empty struct.

    Doing this now avoids tree dependencies and conflicts post rc1 and
    allows all other architectures which work on generic VDSO support
    to work from a common upstream base.

    - A trivial comment fix"

    * tag 'timers-urgent-2020-08-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    time: Delete repeated words in comments
    lib/vdso: Allow to add architecture-specific vdso data
    timekeeping/vsyscall: Provide vdso_update_begin/end()
    vdso/treewide: Add vdso_data pointer argument to __arch_get_hw_counter()

    Linus Torvalds
     

10 Aug, 2020

1 commit

  • 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
     

06 Aug, 2020

1 commit

  • The initial assumption that all VDSO related data can be completely generic
    does not hold. S390 needs architecture specific storage to access the clock
    steering information.

    Add struct arch_vdso_data to the vdso data struct. For architectures which
    do not need extra data this defaults to an empty struct. Architectures
    which require it, enable CONFIG_ARCH_HAS_VDSO_DATA and provide their
    specific struct in asm/vdso/data.h.

    Signed-off-by: Sven Schnelle
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20200804150124.41692-2-svens@linux.ibm.com

    Sven Schnelle
     

05 Aug, 2020

2 commits

  • Pull documentation updates from Jonathan Corbet:
    "It's been a busy cycle for documentation - hopefully the busiest for a
    while to come. Changes include:

    - Some new Chinese translations

    - Progress on the battle against double words words and non-HTTPS
    URLs

    - Some block-mq documentation

    - More RST conversions from Mauro. At this point, that task is
    essentially complete, so we shouldn't see this kind of churn again
    for a while. Unless we decide to switch to asciidoc or
    something...:)

    - Lots of typo fixes, warning fixes, and more"

    * tag 'docs-5.9' of git://git.lwn.net/linux: (195 commits)
    scripts/kernel-doc: optionally treat warnings as errors
    docs: ia64: correct typo
    mailmap: add entry for
    doc/zh_CN: add cpu-load Chinese version
    Documentation/admin-guide: tainted-kernels: fix spelling mistake
    MAINTAINERS: adjust kprobes.rst entry to new location
    devices.txt: document rfkill allocation
    PCI: correct flag name
    docs: filesystems: vfs: correct flag name
    docs: filesystems: vfs: correct sync_mode flag names
    docs: path-lookup: markup fixes for emphasis
    docs: path-lookup: more markup fixes
    docs: path-lookup: fix HTML entity mojibake
    CREDITS: Replace HTTP links with HTTPS ones
    docs: process: Add an example for creating a fixes tag
    doc/zh_CN: add Chinese translation prefer section
    doc/zh_CN: add clearing-warn-once Chinese version
    doc/zh_CN: add admin-guide index
    doc:it_IT: process: coding-style.rst: Correct __maybe_unused compiler label
    futex: MAINTAINERS: Re-add selftests directory
    ...

    Linus Torvalds
     
  • Pull generic kernel entry/exit code from Thomas Gleixner:
    "Generic implementation of common syscall, interrupt and exception
    entry/exit functionality based on the recent X86 effort to ensure
    correctness of entry/exit vs RCU and instrumentation.

    As this functionality and the required entry/exit sequences are not
    architecture specific, sharing them allows other architectures to
    benefit instead of copying the same code over and over again.

    This branch was kept standalone to allow others to work on it. The
    conversion of x86 comes in a seperate pull request which obviously is
    based on this branch"

    * tag 'core-entry-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    entry: Correct __secure_computing() stub
    entry: Correct 'noinstr' attributes
    entry: Provide infrastructure for work before transitioning to guest mode
    entry: Provide generic interrupt entry/exit code
    entry: Provide generic syscall exit function
    entry: Provide generic syscall entry functionality
    seccomp: Provide stub for __secure_computing()

    Linus Torvalds
     

24 Jul, 2020

1 commit

  • On syscall entry certain work needs to be done:

    - Establish state (lockdep, context tracking, tracing)
    - Conditional work (ptrace, seccomp, audit...)

    This code is needlessly duplicated and different in all
    architectures.

    Provide a generic version based on the x86 implementation which has all the
    RCU and instrumentation bits right.

    As interrupt/exception entry from user space needs parts of the same
    functionality, provide a function for this as well.

    syscall_enter_from_user_mode() and irqentry_enter_from_user_mode() must be
    called right after the low level ASM entry. The calling code must be
    non-instrumentable. After the functions returns state is correct and the
    subsequent functions can be instrumented.

    Signed-off-by: Thomas Gleixner
    Acked-by: Kees Cook
    Link: https://lkml.kernel.org/r/20200722220519.513463269@linutronix.de

    Thomas Gleixner
     

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
     

05 Jul, 2020

1 commit

  • All architectures support copy_thread_tls() now, so remove the legacy
    copy_thread() function and the HAVE_COPY_THREAD_TLS config option. Everyone
    uses the same process creation calling convention based on
    copy_thread_tls() and struct kernel_clone_args. This will make it easier to
    maintain the core process creation code under kernel/, simplifies the
    callpaths and makes the identical for all architectures.

    Cc: linux-arch@vger.kernel.org
    Acked-by: Thomas Bogendoerfer
    Acked-by: Greentime Hu
    Acked-by: Geert Uytterhoeven
    Reviewed-by: Kees Cook
    Signed-off-by: Christian Brauner

    Christian Brauner
     

27 Jun, 2020

1 commit

  • There are a number of random documents that seem to be
    describing some aspects of the core-api. Move them to such
    directory, adding them at the core-api/index.rst file.

    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/86d979ed183adb76af93a92f20189bccf97f0055.1592918949.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

14 Jun, 2020

1 commit

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

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

    There are a variety of indentation styles found.

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

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

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

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Jun, 2020

1 commit

  • Pull clk updates from Stephen Boyd:
    "This time around we have four lines of diff in the core framework,
    removing a function that isn't used anymore. Otherwise the main new
    thing for the common clk framework is that it is selectable in the
    Kconfig language now. Hopefully this will let clk drivers and clk
    consumers be testable on more than the architectures that support the
    clk framework. The goal is to introduce some Kunit tests for the
    framework.

    Outside of the core framework we have the usual set of various driver
    updates and non-critical fixes. The dirstat shows that the new
    Baikal-T1 driver is the largest addition this time around in terms of
    lines of code. After that the x86 (Intel), Qualcomm, and Mediatek
    drivers introduce many lines to support new or upcoming SoCs. After
    that the dirstat shows the usual suspects working on their SoC support
    by fixing minor bugs, correcting data and converting some of their DT
    bindings to YAML.

    Core:
    - Allow the COMMON_CLK config to be selectable

    New Drivers:
    - Clk driver for Baikal-T1 SoCs
    - Mediatek MT6765 clock support
    - Support for Intel Agilex clks
    - Add support for X1830 and X1000 Ingenic SoC clk controllers
    - Add support for the new Renesas RZ/G1H (R8A7742) SoC
    - Add support for Qualcomm's MSM8939 Generic Clock Controller

    Updates:
    - Support IDT VersaClock 5P49V5925
    - Bunch of updates for HSDK clock generation unit (CGU) driver
    - Start making audio and GPU clks work on Marvell MMP2/MMP3 SoCs
    - Add some GPU, NPU, and UFS clks to Qualcomm SM8150 driver
    - Enable supply regulators for GPU gdscs on Qualcomm SoCs
    - Add support for Si5342, Si5344 and Si5345 chips
    - Support custom flags in Xilinx zynq firmware
    - Various small fixes to the Xilinx clk driver
    - A single minor rounding fix for the legacy Allwinner clock support
    - A few patches from Abel Vesa as preparation of adding audiomix
    clock support on i.MX
    - A couple of cleanups from Anson Huang for i.MX clk-sscg-pll and
    clk-pllv3 drivers
    - Drop dependency on ARM64 for i.MX8M clock driver, to support
    aarch32 mode on aarch64 hardware
    - A series from Peng Fan to improve i.MX8M clock drivers, using
    composite clock for core and bus clk slice
    - Set a better parent clock for flexcan on i.MX6UL to support CiA102
    defined bit rates
    - A couple changes for EMC frequency scaling on Tegra210
    - Support for CPU frequency scaling on Tegra20/Tegra30
    - New clk gate for CSI test pattern generator on Tegra210
    - Regression fixes for Samsung exynos542x and exynos5433 SoCs
    - Use of fallthrough; attribute for Samsung s3c24xx
    - Updates and fixup HDMI and video clocks on Meson8b
    - Fixup reset polarity on Meson8b
    - Fix GPU glitch free mux switch on Meson gx and g12
    - A minor fix for the currently unused suspend/resume handling on
    Renesas RZ/A1 and RZ/A2
    - Two more conversions of Renesas DT bindings to json-schema
    - Add support for the USB 2.0 clock selector on Renesas R-Car M3-W+"

    * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (155 commits)
    clk: mediatek: Remove ifr{0,1}_cfg_regs structures
    clk: baikal-t1: remove redundant assignment to variable 'divider'
    clk: baikal-t1: fix spelling mistake "Uncompatible" -> "Incompatible"
    dt-bindings: clock: Add a missing include to MMP Audio Clock binding
    dt: Add bindings for IDT VersaClock 5P49V5925
    clk: vc5: Add support for IDT VersaClock 5P49V6965
    clk: Add Baikal-T1 CCU Dividers driver
    clk: Add Baikal-T1 CCU PLLs driver
    dt-bindings: clk: Add Baikal-T1 CCU Dividers binding
    dt-bindings: clk: Add Baikal-T1 CCU PLLs binding
    clk: mediatek: assign the initial value to clk_init_data of mtk_mux
    clk: mediatek: Add MT6765 clock support
    clk: mediatek: add mt6765 clock IDs
    dt-bindings: clock: mediatek: document clk bindings vcodecsys for Mediatek MT6765 SoC
    dt-bindings: clock: mediatek: document clk bindings mipi0a for Mediatek MT6765 SoC
    dt-bindings: clock: mediatek: document clk bindings for Mediatek MT6765 SoC
    CLK: HSDK: CGU: add support for 148.5MHz clock
    CLK: HSDK: CGU: support PLL bypassing
    CLK: HSDK: CGU: check if PLL is bypassed first
    clk: clk-si5341: Add support for the Si5345 series
    ...

    Linus Torvalds
     

19 May, 2020

1 commit


15 May, 2020

2 commits

  • The graph tracer hooks returns by modifying frame records on the
    (regular) stack, but with SCS the return address is taken from the
    shadow stack, and the value in the frame record has no effect. As we
    don't currently have a mechanism to determine the corresponding slot
    on the shadow stack (and to pass this through the ftrace
    infrastructure), for now let's disable SCS when the graph tracer is
    enabled.

    With SCS the return address is taken from the shadow stack and the
    value in the frame record has no effect. The mcount based graph tracer
    hooks returns by modifying frame records on the (regular) stack, and
    thus is not compatible. The patchable-function-entry graph tracer
    used for DYNAMIC_FTRACE_WITH_REGS modifies the LR before it is saved
    to the shadow stack, and is compatible.

    Modifying the mcount based graph tracer to work with SCS would require
    a mechanism to determine the corresponding slot on the shadow stack
    (and to pass this through the ftrace infrastructure), and we expect
    that everyone will eventually move to the patchable-function-entry
    based graph tracer anyway, so for now let's disable SCS when the
    mcount-based graph tracer is enabled.

    SCS and patchable-function-entry are both supported from LLVM 10.x.

    Signed-off-by: Sami Tolvanen
    Reviewed-by: Kees Cook
    Reviewed-by: Mark Rutland
    Signed-off-by: Will Deacon

    Sami Tolvanen
     
  • This change adds generic support for Clang's Shadow Call Stack,
    which uses a shadow stack to protect return addresses from being
    overwritten by an attacker. Details are available here:

    https://clang.llvm.org/docs/ShadowCallStack.html

    Note that security guarantees in the kernel differ from the ones
    documented for user space. The kernel must store addresses of
    shadow stacks in memory, which means an attacker capable reading
    and writing arbitrary memory may be able to locate them and hijack
    control flow by modifying the stacks.

    Signed-off-by: Sami Tolvanen
    Reviewed-by: Kees Cook
    Reviewed-by: Miguel Ojeda
    [will: Numerous cosmetic changes]
    Signed-off-by: Will Deacon

    Sami Tolvanen
     

13 May, 2020

1 commit

  • The implementation of 'struct clk' is not really an architectual detail
    anymore now that most architectures have migrated to the common clk
    framework. To sway new architecture ports away from trying to implement
    their own 'struct clk', move the config next to the common clk framework
    config.

    Cc: Russell King
    Cc: Arnd Bergmann
    Signed-off-by: Stephen Boyd
    Link: https://lkml.kernel.org/r/20200409064416.83340-11-sboyd@kernel.org
    Reviewed-by: Arnd Bergmann

    Stephen Boyd
     

05 Apr, 2020

1 commit

  • Pull dma-mapping updates from Christoph Hellwig:

    - fix an integer overflow in the coherent pool (Kevin Grandemange)

    - provide support for in-place uncached remapping and use that for
    openrisc

    - fix the arm coherent allocator to take the bus limit into account

    * tag 'dma-mapping-5.7' of git://git.infradead.org/users/hch/dma-mapping:
    ARM/dma-mapping: merge __dma_supported into arm_dma_supported
    ARM/dma-mapping: take the bus limit into account in __dma_alloc
    ARM/dma-mapping: remove get_coherent_dma_mask
    openrisc: use the generic in-place uncached DMA allocator
    dma-direct: provide a arch_dma_clear_uncached hook
    dma-direct: make uncached_kernel_address more general
    dma-direct: consolidate the error handling in dma_direct_alloc_pages
    dma-direct: remove the cached_kernel_address hook
    dma-coherent: fix integer overflow in the reserved-memory dma allocation

    Linus Torvalds
     

31 Mar, 2020

1 commit

  • Pull NOHZ update from Thomas Gleixner:
    "Remove TIF_NOHZ from three architectures

    These architectures use a static key to decide whether context
    tracking needs to be invoked and the TIF_NOHZ flag just causes a
    pointless slowpath execution for nothing"

    * tag 'timers-nohz-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    arm64: Remove TIF_NOHZ
    arm: Remove TIF_NOHZ
    x86: Remove TIF_NOHZ
    context-tracking: Introduce CONFIG_HAVE_TIF_NOHZ
    x86/entry: Remove _TIF_NOHZ from _TIF_WORK_SYSCALL_ENTRY

    Linus Torvalds
     

16 Mar, 2020

3 commits


06 Mar, 2020

1 commit

  • save_stack_trace_tsk_reliable() is not the only function providing the
    reliable stack traces anymore. Architecture might define ARCH_STACKWALK
    which provides a newer stack walking interface and has
    arch_stack_walk_reliable() function. Update the description accordingly.

    Signed-off-by: Andrew Morton
    Signed-off-by: Miroslav Benes
    Acked-by: Josh Poimboeuf
    Link: http://lkml.kernel.org/r/20200120154042.9934-1-mbenes@suse.cz
    Signed-off-by: Linus Torvalds

    Miroslav Benes
     

14 Feb, 2020

1 commit

  • A few archs (x86, arm, arm64) don't rely anymore on TIF_NOHZ to call
    into context tracking on user entry/exit but instead use static keys
    (or not) to optimize those calls. Ideally every arch should migrate to
    that behaviour in the long run.

    Settle a config option to let those archs remove their TIF_NOHZ
    definitions.

    Signed-off-by: Frederic Weisbecker
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Borislav Petkov
    Cc: Andy Lutomirski
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Ralf Baechle
    Cc: Paul Burton
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: David S. Miller

    Frederic Weisbecker
     

04 Feb, 2020

6 commits

  • As described in the comment, the correct order for freeing pages is:

    1) unhook page
    2) TLB invalidate page
    3) free page

    This order equally applies to page directories.

    Currently there are two correct options:

    - use tlb_remove_page(), when all page directores are full pages and
    there are no futher contraints placed by things like software
    walkers (HAVE_FAST_GUP).

    - use MMU_GATHER_RCU_TABLE_FREE and tlb_remove_table() when the
    architecture does not do IPI based TLB invalidate and has
    HAVE_FAST_GUP (or software TLB fill).

    This however leaves architectures that don't have page based directories
    but don't need RCU in a bind. For those, provide MMU_GATHER_TABLE_FREE,
    which provides the independent batching for directories without the
    additional RCU freeing.

    Link: http://lkml.kernel.org/r/20200116064531.483522-10-aneesh.kumar@linux.ibm.com
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Aneesh Kumar K.V
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Towards a more consistent naming scheme.

    Link: http://lkml.kernel.org/r/20200116064531.483522-9-aneesh.kumar@linux.ibm.com
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Aneesh Kumar K.V
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Towards a more consistent naming scheme.

    Link: http://lkml.kernel.org/r/20200116064531.483522-8-aneesh.kumar@linux.ibm.com
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Aneesh Kumar K.V
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Towards a more consistent naming scheme.

    [akpm@linux-foundation.org: fix sparc64 Kconfig]
    Link: http://lkml.kernel.org/r/20200116064531.483522-7-aneesh.kumar@linux.ibm.com
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Aneesh Kumar K.V
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Without this the symbol will not actually end up in .config files.

    Link: http://lkml.kernel.org/r/20200116064531.483522-6-aneesh.kumar@linux.ibm.com
    Fixes: a30e32bd79e9 ("asm-generic/tlb: Provide generic tlb_flush() based on flush_tlb_mm()")
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Aneesh Kumar K.V
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Architectures for which we have hardware walkers of Linux page table
    should flush TLB on mmu gather batch allocation failures and batch flush.
    Some architectures like POWER supports multiple translation modes (hash
    and radix) and in the case of POWER only radix translation mode needs the
    above TLBI. This is because for hash translation mode kernel wants to
    avoid this extra flush since there are no hardware walkers of linux page
    table. With radix translation, the hardware also walks linux page table
    and with that, kernel needs to make sure to TLB invalidate page walk cache
    before page table pages are freed.

    More details in commit d86564a2f085 ("mm/tlb, x86/mm: Support invalidating
    TLB caches for RCU_TABLE_FREE")

    The changes to sparc are to make sure we keep the old behavior since we
    are now removing HAVE_RCU_TABLE_NO_INVALIDATE. The default value for
    tlb_needs_table_invalidate is to always force an invalidate and sparc can
    avoid the table invalidate. Hence we define tlb_needs_table_invalidate to
    false for sparc architecture.

    Link: http://lkml.kernel.org/r/20200116064531.483522-3-aneesh.kumar@linux.ibm.com
    Fixes: a46cc7a90fd8 ("powerpc/mm/radix: Improve TLB/PWC flushes")
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Michael Ellerman [powerpc]
    Cc: [4.14+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra