05 Mar, 2020

1 commit

  • commit 9a6b55ac4a44060bcb782baf002859b2a2c63267 upstream.

    The function name suggests that this is a boolean checking whether the
    architecture asks for an update of the VDSO data, but it works the other
    way round. To spare further confusion invert the logic.

    Fixes: 44f57d788e7d ("timekeeping: Provide a generic update_vsyscall() implementation")
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20200114185946.656652824@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

11 Feb, 2020

1 commit

  • commit 0ed1325967ab5f7a4549a2641c6ebe115f76e228 upstream.

    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
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     

18 Jan, 2020

1 commit

  • commit 4f0bd808134d73184054ad09173821c84f31dd5d upstream.

    The commit c296d4dc13ae ("asm-generic: fix a compilation warning") changed
    asm-generic/cachflush.h to use static inlines instead of macros and as a
    result the nds32 build with CONFIG_CPU_CACHE_ALIASING=n fails:

    CC init/main.o
    In file included from arch/nds32/include/asm/cacheflush.h:43,
    from include/linux/highmem.h:12,
    from include/linux/pagemap.h:11,
    from include/linux/blkdev.h:16,
    from include/linux/blk-cgroup.h:23,
    from include/linux/writeback.h:14,
    from init/main.c:44:
    include/asm-generic/cacheflush.h:50:20: error: static declaration of 'flush_icache_range' follows non-static declaration
    static inline void flush_icache_range(unsigned long start, unsigned long end)
    ^~~~~~~~~~~~~~~~~~
    In file included from include/linux/highmem.h:12,
    from include/linux/pagemap.h:11,
    from include/linux/blkdev.h:16,
    from include/linux/blk-cgroup.h:23,
    from include/linux/writeback.h:14,
    from init/main.c:44:
    arch/nds32/include/asm/cacheflush.h:11:6: note: previous declaration of 'flush_icache_range' was here
    void flush_icache_range(unsigned long start, unsigned long end);
    ^~~~~~~~~~~~~~~~~~

    Surround the inline functions in asm-generic/cacheflush.h by ifdef's so
    that architectures could override them and add the required overrides to
    nds32.

    Fixes: c296d4dc13ae ("asm-generic: fix a compilation warning")
    Link: https://lore.kernel.org/lkml/201912212139.yptX8CsV%25lkp@intel.com/
    Reported-by: kbuild test robot
    Signed-off-by: Mike Rapoport
    Reviewed-by: Greentime Hu
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Mike Rapoport
     

05 Nov, 2019

1 commit

  • The update of the VDSO data is depending on __arch_use_vsyscall() returning
    True. This is a leftover from the attempt to map the features of various
    architectures 1:1 into generic code.

    The usage of __arch_use_vsyscall() in the actual vsyscall implementations
    got dropped and replaced by the requirement for the architecture code to
    return U64_MAX if the global clocksource is not usable in the VDSO.

    But the __arch_use_vsyscall() check in the update code stayed which causes
    the VDSO data to be stale or invalid when an architecture actually
    implements that function and returns False when the current clocksource is
    not usable in the VDSO.

    As a consequence the VDSO implementations of clock_getres(), time(),
    clock_gettime(CLOCK_.*_COARSE) operate on invalid data and return bogus
    information.

    Remove the __arch_use_vsyscall() check from the VDSO update function and
    update the VDSO data unconditionally.

    [ tglx: Massaged changelog and removed the now useless implementations in
    asm-generic/ARM64/MIPS ]

    Fixes: 44f57d788e7deecb50 ("timekeeping: Provide a generic update_vsyscall() implementation")
    Signed-off-by: Huacai Chen
    Signed-off-by: Thomas Gleixner
    Cc: Andy Lutomirski
    Cc: Vincenzo Frascino
    Cc: Arnd Bergmann
    Cc: Paul Burton
    Cc: linux-mips@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/1571887709-11447-1-git-send-email-chenhc@lemote.com

    Huacai Chen
     

28 Sep, 2019

1 commit

  • Pull kernel lockdown mode from James Morris:
    "This is the latest iteration of the kernel lockdown patchset, from
    Matthew Garrett, David Howells and others.

    From the original description:

    This patchset introduces an optional kernel lockdown feature,
    intended to strengthen the boundary between UID 0 and the kernel.
    When enabled, various pieces of kernel functionality are restricted.
    Applications that rely on low-level access to either hardware or the
    kernel may cease working as a result - therefore this should not be
    enabled without appropriate evaluation beforehand.

    The majority of mainstream distributions have been carrying variants
    of this patchset for many years now, so there's value in providing a
    doesn't meet every distribution requirement, but gets us much closer
    to not requiring external patches.

    There are two major changes since this was last proposed for mainline:

    - Separating lockdown from EFI secure boot. Background discussion is
    covered here: https://lwn.net/Articles/751061/

    - Implementation as an LSM, with a default stackable lockdown LSM
    module. This allows the lockdown feature to be policy-driven,
    rather than encoding an implicit policy within the mechanism.

    The new locked_down LSM hook is provided to allow LSMs to make a
    policy decision around whether kernel functionality that would allow
    tampering with or examining the runtime state of the kernel should be
    permitted.

    The included lockdown LSM provides an implementation with a simple
    policy intended for general purpose use. This policy provides a coarse
    level of granularity, controllable via the kernel command line:

    lockdown={integrity|confidentiality}

    Enable the kernel lockdown feature. If set to integrity, kernel features
    that allow userland to modify the running kernel are disabled. If set to
    confidentiality, kernel features that allow userland to extract
    confidential information from the kernel are also disabled.

    This may also be controlled via /sys/kernel/security/lockdown and
    overriden by kernel configuration.

    New or existing LSMs may implement finer-grained controls of the
    lockdown features. Refer to the lockdown_reason documentation in
    include/linux/security.h for details.

    The lockdown feature has had signficant design feedback and review
    across many subsystems. This code has been in linux-next for some
    weeks, with a few fixes applied along the way.

    Stephen Rothwell noted that commit 9d1f8be5cf42 ("bpf: Restrict bpf
    when kernel lockdown is in confidentiality mode") is missing a
    Signed-off-by from its author. Matthew responded that he is providing
    this under category (c) of the DCO"

    * 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (31 commits)
    kexec: Fix file verification on S390
    security: constify some arrays in lockdown LSM
    lockdown: Print current->comm in restriction messages
    efi: Restrict efivar_ssdt_load when the kernel is locked down
    tracefs: Restrict tracefs when the kernel is locked down
    debugfs: Restrict debugfs when the kernel is locked down
    kexec: Allow kexec_file() with appropriate IMA policy when locked down
    lockdown: Lock down perf when in confidentiality mode
    bpf: Restrict bpf when kernel lockdown is in confidentiality mode
    lockdown: Lock down tracing and perf kprobes when in confidentiality mode
    lockdown: Lock down /proc/kcore
    x86/mmiotrace: Lock down the testmmiotrace module
    lockdown: Lock down module params that specify hardware parameters (eg. ioport)
    lockdown: Lock down TIOCSSERIAL
    lockdown: Prohibit PCMCIA CIS storage when the kernel is locked down
    acpi: Disable ACPI table override if the kernel is locked down
    acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
    ACPI: Limit access to custom_method when the kernel is locked down
    x86/msr: Restrict MSR access when the kernel is locked down
    x86: Lock down IO port access when the kernel is locked down
    ...

    Linus Torvalds
     

27 Sep, 2019

1 commit

  • The naming of pgtable_page_{ctor,dtor}() seems to have confused a few
    people, and until recently arm64 used these erroneously/pointlessly for
    other levels of page table.

    To make it incredibly clear that these only apply to the PTE level, and to
    align with the naming of pgtable_pmd_page_{ctor,dtor}(), let's rename them
    to pgtable_pte_page_{ctor,dtor}().

    These changes were generated with the following shell script:

    ----
    git grep -lw 'pgtable_page_.tor' | while read FILE; do
    sed -i '{s/pgtable_page_ctor/pgtable_pte_page_ctor/}' $FILE;
    sed -i '{s/pgtable_page_dtor/pgtable_pte_page_dtor/}' $FILE;
    done
    ----

    ... with the documentation re-flowed to remain under 80 columns, and
    whitespace fixed up in macros to keep backslashes aligned.

    There should be no functional change as a result of this patch.

    Link: http://lkml.kernel.org/r/20190722141133.3116-1-mark.rutland@arm.com
    Signed-off-by: Mark Rutland
    Reviewed-by: Mike Rapoport
    Acked-by: Geert Uytterhoeven [m68k]
    Cc: Anshuman Khandual
    Cc: Matthew Wilcox
    Cc: Michal Hocko
    Cc: Yu Zhao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Rutland
     

26 Sep, 2019

6 commits

  • The original clean up of "cut here" missed the WARN_ON() case (that does
    not have a printk message), which was fixed recently by adding an explicit
    printk of "cut here". This had the downside of adding a printk() to every
    WARN_ON() caller, which reduces the utility of using an instruction
    exception to streamline the resulting code. By making this a new BUGFLAG,
    all of these can be removed and "cut here" can be handled by the exception
    handler.

    This was very pronounced on PowerPC, but the effect can be seen on x86 as
    well. The resulting text size of a defconfig build shows some small
    savings from this patch:

    text data bss dec hex filename
    19691167 5134320 1646664 26472151 193eed7 vmlinux.before
    19676362 5134260 1663048 26473670 193f4c6 vmlinux.after

    This change also opens the door for creating something like BUG_MSG(),
    where a custom printk() before issuing BUG(), without confusing the "cut
    here" line.

    Link: http://lkml.kernel.org/r/201908200943.601DD59DCE@keescook
    Fixes: 6b15f678fb7d ("include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures")
    Signed-off-by: Kees Cook
    Reported-by: Christophe Leroy
    Cc: Peter Zijlstra
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Arnd Bergmann
    Cc: "Steven Rostedt (VMware)"
    Cc: Feng Tang
    Cc: Petr Mladek
    Cc: Mauro Carvalho Chehab
    Cc: Borislav Petkov
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • Instead of having separate tests for __WARN_FLAGS, merge the two #ifdef
    blocks and replace the synonym WANT_WARN_ON_SLOWPATH macro.

    Link: http://lkml.kernel.org/r/20190819234111.9019-7-keescook@chromium.org
    Signed-off-by: Kees Cook
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Feng Tang
    Cc: Mauro Carvalho Chehab
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: "Steven Rostedt (VMware)"
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • In preparation for cleaning up "cut here" even more, this removes the
    __WARN_*TAINT() helpers, as they limit the ability to add new BUGFLAG_*
    flags to call sites. They are removed by expanding them into full
    __WARN_FLAGS() calls.

    Link: http://lkml.kernel.org/r/20190819234111.9019-6-keescook@chromium.org
    Signed-off-by: Kees Cook
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Feng Tang
    Cc: Mauro Carvalho Chehab
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: "Steven Rostedt (VMware)"
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • Instead of having a separate helper for no printk output, just consolidate
    the logic into warn_slowpath_fmt().

    Link: http://lkml.kernel.org/r/20190819234111.9019-4-keescook@chromium.org
    Signed-off-by: Kees Cook
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Feng Tang
    Cc: Mauro Carvalho Chehab
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: "Steven Rostedt (VMware)"
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • This just renames the helper to improve readability.

    Link: http://lkml.kernel.org/r/20190819234111.9019-3-keescook@chromium.org
    Signed-off-by: Kees Cook
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Feng Tang
    Cc: Mauro Carvalho Chehab
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: "Steven Rostedt (VMware)"
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • Patch series "Clean up WARN() "cut here" handling", v2.

    Christophe Leroy noticed that the fix for missing "cut here" in the WARN()
    case was adding explicit printk() calls instead of teaching the exception
    handler to add it. This refactors the bug/warn infrastructure to pass
    this information as a new BUGFLAG.

    Longer details repeated from the last patch in the series:

    bug: move WARN_ON() "cut here" into exception handler

    The original cleanup of "cut here" missed the WARN_ON() case (that does
    not have a printk message), which was fixed recently by adding an explicit
    printk of "cut here". This had the downside of adding a printk() to every
    WARN_ON() caller, which reduces the utility of using an instruction
    exception to streamline the resulting code. By making this a new BUGFLAG,
    all of these can be removed and "cut here" can be handled by the exception
    handler.

    This was very pronounced on PowerPC, but the effect can be seen on x86 as
    well. The resulting text size of a defconfig build shows some small
    savings from this patch:

    text data bss dec hex filename
    19691167 5134320 1646664 26472151 193eed7 vmlinux.before
    19676362 5134260 1663048 26473670 193f4c6 vmlinux.after

    This change also opens the door for creating something like BUG_MSG(),
    where a custom printk() before issuing BUG(), without confusing the "cut
    here" line.

    This patch (of 7):

    There's no reason to have specialized helpers for passing the warn taint
    down to __warn(). Consolidate and refactor helper macros, removing
    __WARN_printf() and warn_slowpath_fmt_taint().

    Link: http://lkml.kernel.org/r/20190819234111.9019-2-keescook@chromium.org
    Signed-off-by: Kees Cook
    Cc: Christophe Leroy
    Cc: Peter Zijlstra
    Cc: Christophe Leroy
    Cc: Drew Davenport
    Cc: Arnd Bergmann
    Cc: "Steven Rostedt (VMware)"
    Cc: Feng Tang
    Cc: Petr Mladek
    Cc: Mauro Carvalho Chehab
    Cc: Borislav Petkov
    Cc: YueHaibing
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

25 Sep, 2019

3 commits

  • According to 78ddc5347341 ("thp: rename split_huge_page_pmd() to
    split_huge_pmd()"), update related comment.

    Link: http://lkml.kernel.org/r/20190731033406.185285-1-wangkefeng.wang@huawei.com
    Signed-off-by: Kefeng Wang
    Cc: "Kirill A . Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kefeng Wang
     
  • Both pgtable_cache_init() and pgd_cache_init() are used to initialize kmem
    cache for page table allocations on several architectures that do not use
    PAGE_SIZE tables for one or more levels of the page table hierarchy.

    Most architectures do not implement these functions and use __weak default
    NOP implementation of pgd_cache_init(). Since there is no such default
    for pgtable_cache_init(), its empty stub is duplicated among most
    architectures.

    Rename the definitions of pgd_cache_init() to pgtable_cache_init() and
    drop empty stubs of pgtable_cache_init().

    Link: http://lkml.kernel.org/r/1566457046-22637-1-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Acked-by: Will Deacon [arm64]
    Acked-by: Thomas Gleixner [x86]
    Cc: Catalin Marinas
    Cc: Ingo Molnar
    Cc: Borislav Petkov
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Patch series "mm: remove quicklist page table caches".

    A while ago Nicholas proposed to remove quicklist page table caches [1].

    I've rebased his patch on the curren upstream and switched ia64 and sh to
    use generic versions of PTE allocation.

    [1] https://lore.kernel.org/linux-mm/20190711030339.20892-1-npiggin@gmail.com

    This patch (of 3):

    Remove page table allocator "quicklists". These have been around for a
    long time, but have not got much traction in the last decade and are only
    used on ia64 and sh architectures.

    The numbers in the initial commit look interesting but probably don't
    apply anymore. If anybody wants to resurrect this it's in the git
    history, but it's unhelpful to have this code and divergent allocator
    behaviour for minor archs.

    Also it might be better to instead make more general improvements to page
    allocator if this is still so slow.

    Link: http://lkml.kernel.org/r/1565250728-21721-2-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Mike Rapoport
    Cc: Tony Luck
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

23 Sep, 2019

1 commit

  • Pull modules updates from Jessica Yu:
    "The main bulk of this pull request introduces a new exported symbol
    namespaces feature. The number of exported symbols is increasingly
    growing with each release (we're at about 31k exports as of 5.3-rc7)
    and we currently have no way of visualizing how these symbols are
    "clustered" or making sense of this huge export surface.

    Namespacing exported symbols allows kernel developers to more
    explicitly partition and categorize exported symbols, as well as more
    easily limiting the availability of namespaced symbols to other parts
    of the kernel. For starters, we have introduced the USB_STORAGE
    namespace to demonstrate the API's usage. I have briefly summarized
    the feature and its main motivations in the tag below.

    Summary:

    - Introduce exported symbol namespaces.

    This new feature allows subsystem maintainers to partition and
    categorize their exported symbols into explicit namespaces. Module
    authors are now required to import the namespaces they need.

    Some of the main motivations of this feature include: allowing
    kernel developers to better manage the export surface, allow
    subsystem maintainers to explicitly state that usage of some
    exported symbols should only be limited to certain users (think:
    inter-module or inter-driver symbols, debugging symbols, etc), as
    well as more easily limiting the availability of namespaced symbols
    to other parts of the kernel.

    With the module import requirement, it is also easier to spot the
    misuse of exported symbols during patch review.

    Two new macros are introduced: EXPORT_SYMBOL_NS() and
    EXPORT_SYMBOL_NS_GPL(). The API is thoroughly documented in
    Documentation/kbuild/namespaces.rst.

    - Some small code and kbuild cleanups here and there"

    * tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    module: Remove leftover '#undef' from export header
    module: remove unneeded casts in cmp_name()
    module: move CONFIG_UNUSED_SYMBOLS to the sub-menu of MODULES
    module: remove redundant 'depends on MODULES'
    module: Fix link failure due to invalid relocation on namespace offset
    usb-storage: export symbols in USB_STORAGE namespace
    usb-storage: remove single-use define for debugging
    docs: Add documentation for Symbol Namespaces
    scripts: Coccinelle script for namespace dependencies.
    modpost: add support for generating namespace dependencies
    export: allow definition default namespaces in Makefiles or sources
    module: add config option MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
    modpost: add support for symbol namespaces
    module: add support for symbol namespaces.
    export: explicitly align struct kernel_symbol
    module: support reading multiple values per modinfo tag

    Linus Torvalds
     

19 Sep, 2019

1 commit

  • Pull crypto updates from Herbert Xu:
    "API:
    - Add the ability to abort a skcipher walk.

    Algorithms:
    - Fix XTS to actually do the stealing.
    - Add library helpers for AES and DES for single-block users.
    - Add library helpers for SHA256.
    - Add new DES key verification helper.
    - Add surrounding bits for ESSIV generator.
    - Add accelerations for aegis128.
    - Add test vectors for lzo-rle.

    Drivers:
    - Add i.MX8MQ support to caam.
    - Add gcm/ccm/cfb/ofb aes support in inside-secure.
    - Add ofb/cfb aes support in media-tek.
    - Add HiSilicon ZIP accelerator support.

    Others:
    - Fix potential race condition in padata.
    - Use unbound workqueues in padata"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (311 commits)
    crypto: caam - Cast to long first before pointer conversion
    crypto: ccree - enable CTS support in AES-XTS
    crypto: inside-secure - Probe transform record cache RAM sizes
    crypto: inside-secure - Base RD fetchcount on actual RD FIFO size
    crypto: inside-secure - Base CD fetchcount on actual CD FIFO size
    crypto: inside-secure - Enable extended algorithms on newer HW
    crypto: inside-secure: Corrected configuration of EIP96_TOKEN_CTRL
    crypto: inside-secure - Add EIP97/EIP197 and endianness detection
    padata: remove cpu_index from the parallel_queue
    padata: unbind parallel jobs from specific CPUs
    padata: use separate workqueues for parallel and serial work
    padata, pcrypt: take CPU hotplug lock internally in padata_alloc_possible
    crypto: pcrypt - remove padata cpumask notifier
    padata: make padata_do_parallel find alternate callback CPU
    workqueue: require CPU hotplug read exclusion for apply_workqueue_attrs
    workqueue: unconfine alloc/apply/free_workqueue_attrs()
    padata: allocate workqueue internally
    arm64: dts: imx8mq: Add CAAM node
    random: Use wait_event_freezable() in add_hwgenerator_randomness()
    crypto: ux500 - Fix COMPILE_TEST warnings
    ...

    Linus Torvalds
     

18 Sep, 2019

2 commits

  • Pull asm-generic updates from Arnd Bergmann:
    "Here are three small cleanup patches for the include/asm-generic
    directory.

    Christoph removes the __ioremap as part of a cleanup, Nico improves
    the constant do_div() optimization, and Denis changes BUG_ON() to be
    consistent with other implementations"

    * tag 'asm-generic-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    asm-generic: add unlikely to default BUG_ON(x)
    __div64_const32(): improve the generic C version
    asm-generic: don't provide __ioremap

    Linus Torvalds
     
  • Pull core timer updates from Thomas Gleixner:
    "Timers and timekeeping updates:

    - A large overhaul of the posix CPU timer code which is a preparation
    for moving the CPU timer expiry out into task work so it can be
    properly accounted on the task/process.

    An update to the bogus permission checks will come later during the
    merge window as feedback was not complete before heading of for
    travel.

    - Switch the timerqueue code to use cached rbtrees and get rid of the
    homebrewn caching of the leftmost node.

    - Consolidate hrtimer_init() + hrtimer_init_sleeper() calls into a
    single function

    - Implement the separation of hrtimers to be forced to expire in hard
    interrupt context even when PREEMPT_RT is enabled and mark the
    affected timers accordingly.

    - Implement a mechanism for hrtimers and the timer wheel to protect
    RT against priority inversion and live lock issues when a (hr)timer
    which should be canceled is currently executing the callback.
    Instead of infinitely spinning, the task which tries to cancel the
    timer blocks on a per cpu base expiry lock which is held and
    released by the (hr)timer expiry code.

    - Enable the Hyper-V TSC page based sched_clock for Hyper-V guests
    resulting in faster access to timekeeping functions.

    - Updates to various clocksource/clockevent drivers and their device
    tree bindings.

    - The usual small improvements all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits)
    posix-cpu-timers: Fix permission check regression
    posix-cpu-timers: Always clear head pointer on dequeue
    hrtimer: Add a missing bracket and hide `migration_base' on !SMP
    posix-cpu-timers: Make expiry_active check actually work correctly
    posix-timers: Unbreak CONFIG_POSIX_TIMERS=n build
    tick: Mark sched_timer to expire in hard interrupt context
    hrtimer: Add kernel doc annotation for HRTIMER_MODE_HARD
    x86/hyperv: Hide pv_ops access for CONFIG_PARAVIRT=n
    posix-cpu-timers: Utilize timerqueue for storage
    posix-cpu-timers: Move state tracking to struct posix_cputimers
    posix-cpu-timers: Deduplicate rlimit handling
    posix-cpu-timers: Remove pointless comparisons
    posix-cpu-timers: Get rid of 64bit divisions
    posix-cpu-timers: Consolidate timer expiry further
    posix-cpu-timers: Get rid of zero checks
    rlimit: Rewrite non-sensical RLIMIT_CPU comment
    posix-cpu-timers: Respect INFINITY for hard RTTIME limit
    posix-cpu-timers: Switch thread group sampling to array
    posix-cpu-timers: Restructure expiry array
    posix-cpu-timers: Remove cputime_expires
    ...

    Linus Torvalds
     

17 Sep, 2019

3 commits

  • Pull scheduler updates from Ingo Molnar:

    - MAINTAINERS: Add Mark Rutland as perf submaintainer, Juri Lelli and
    Vincent Guittot as scheduler submaintainers. Add Dietmar Eggemann,
    Steven Rostedt, Ben Segall and Mel Gorman as scheduler reviewers.

    As perf and the scheduler is getting bigger and more complex,
    document the status quo of current responsibilities and interests,
    and spread the review pain^H^H^H^H fun via an increase in the Cc:
    linecount generated by scripts/get_maintainer.pl. :-)

    - Add another series of patches that brings the -rt (PREEMPT_RT) tree
    closer to mainline: split the monolithic CONFIG_PREEMPT dependencies
    into a new CONFIG_PREEMPTION category that will allow the eventual
    introduction of CONFIG_PREEMPT_RT. Still a few more hundred patches
    to go though.

    - Extend the CPU cgroup controller with uclamp.min and uclamp.max to
    allow the finer shaping of CPU bandwidth usage.

    - Micro-optimize energy-aware wake-ups from O(CPUS^2) to O(CPUS).

    - Improve the behavior of high CPU count, high thread count
    applications running under cpu.cfs_quota_us constraints.

    - Improve balancing with SCHED_IDLE (SCHED_BATCH) tasks present.

    - Improve CPU isolation housekeeping CPU allocation NUMA locality.

    - Fix deadline scheduler bandwidth calculations and logic when cpusets
    rebuilds the topology, or when it gets deadline-throttled while it's
    being offlined.

    - Convert the cpuset_mutex to percpu_rwsem, to allow it to be used from
    setscheduler() system calls without creating global serialization.
    Add new synchronization between cpuset topology-changing events and
    the deadline acceptance tests in setscheduler(), which were broken
    before.

    - Rework the active_mm state machine to be less confusing and more
    optimal.

    - Rework (simplify) the pick_next_task() slowpath.

    - Improve load-balancing on AMD EPYC systems.

    - ... and misc cleanups, smaller fixes and improvements - please see
    the Git log for more details.

    * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (53 commits)
    sched/psi: Correct overly pessimistic size calculation
    sched/fair: Speed-up energy-aware wake-ups
    sched/uclamp: Always use 'enum uclamp_id' for clamp_id values
    sched/uclamp: Update CPU's refcount on TG's clamp changes
    sched/uclamp: Use TG's clamps to restrict TASK's clamps
    sched/uclamp: Propagate system defaults to the root group
    sched/uclamp: Propagate parent clamps
    sched/uclamp: Extend CPU's cgroup controller
    sched/topology: Improve load balancing on AMD EPYC systems
    arch, ia64: Make NUMA select SMP
    sched, perf: MAINTAINERS update, add submaintainers and reviewers
    sched/fair: Use rq_lock/unlock in online_fair_sched_group
    cpufreq: schedutil: fix equation in comment
    sched: Rework pick_next_task() slow-path
    sched: Allow put_prev_task() to drop rq->lock
    sched/fair: Expose newidle_balance()
    sched: Add task_struct pointer to sched_class::set_curr_task
    sched: Rework CPU hotplug task selection
    sched/{rt,deadline}: Fix set_next_task vs pick_next_task
    sched: Fix kerneldoc comment for ia64_set_curr_task
    ...

    Linus Torvalds
     
  • Pull header documentation fix from Ingo Molnar:
    "Fix the parameter description "

    * 'core-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    asm-generic/div64: Fix documentation of do_div() parameter

    Linus Torvalds
     
  • Pull arm64 updates from Will Deacon:
    "Although there isn't tonnes of code in terms of line count, there are
    a fair few headline features which I've noted both in the tag and also
    in the merge commits when I pulled everything together.

    The part I'm most pleased with is that we had 35 contributors this
    time around, which feels like a big jump from the usual small group of
    core arm64 arch developers. Hopefully they all enjoyed it so much that
    they'll continue to contribute, but we'll see.

    It's probably worth highlighting that we've pulled in a branch from
    the risc-v folks which moves our CPU topology code out to where it can
    be shared with others.

    Summary:

    - 52-bit virtual addressing in the kernel

    - New ABI to allow tagged user pointers to be dereferenced by
    syscalls

    - Early RNG seeding by the bootloader

    - Improve robustness of SMP boot

    - Fix TLB invalidation in light of recent architectural
    clarifications

    - Support for i.MX8 DDR PMU

    - Remove direct LSE instruction patching in favour of static keys

    - Function error injection using kprobes

    - Support for the PPTT "thread" flag introduced by ACPI 6.3

    - Move PSCI idle code into proper cpuidle driver

    - Relaxation of implicit I/O memory barriers

    - Build with RELR relocations when toolchain supports them

    - Numerous cleanups and non-critical fixes"

    * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (114 commits)
    arm64: remove __iounmap
    arm64: atomics: Use K constraint when toolchain appears to support it
    arm64: atomics: Undefine internal macros after use
    arm64: lse: Make ARM64_LSE_ATOMICS depend on JUMP_LABEL
    arm64: asm: Kill 'asm/atomic_arch.h'
    arm64: lse: Remove unused 'alt_lse' assembly macro
    arm64: atomics: Remove atomic_ll_sc compilation unit
    arm64: avoid using hard-coded registers for LSE atomics
    arm64: atomics: avoid out-of-line ll/sc atomics
    arm64: Use correct ll/sc atomic constraints
    jump_label: Don't warn on __exit jump entries
    docs/perf: Add documentation for the i.MX8 DDR PMU
    perf/imx_ddr: Add support for AXI ID filtering
    arm64: kpti: ensure patched kernel text is fetched from PoU
    arm64: fix fixmap copy for 16K pages and 48-bit VA
    perf/smmuv3: Validate groups for global filtering
    perf/smmuv3: Validate group size
    arm64: Relax Documentation/arm64/tagged-pointers.rst
    arm64: kvm: Replace hardcoded '1' with SYS_PAR_EL1_F
    arm64: mm: Ignore spurious translation faults taken from the kernel
    ...

    Linus Torvalds
     

12 Sep, 2019

2 commits

  • Commit 7290d5809571 ("module: use relative references for __ksymtab
    entries") converted the '__put' #define into an assembly macro in
    asm-generic/export.h but forgot to remove the corresponding '#undef'.

    Remove the leftover '#undef'.

    Cc: Ard Biesheuvel
    Cc: Jessica Yu
    Signed-off-by: Will Deacon
    Signed-off-by: Jessica Yu

    Will Deacon
     
  • Commit 8651ec01daed ("module: add support for symbol namespaces.")
    broke linking for arm64 defconfig:

    | lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey':
    | arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
    | lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt':
    | arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol'

    This is because the dummy initialisation of the 'namespace_offset' field
    in 'struct kernel_symbol' when using EXPORT_SYMBOL on architectures with
    support for PREL32 locations uses an offset from an absolute address (0)
    in an effort to trick 'offset_to_pointer' into behaving as a NOP,
    allowing non-namespaced symbols to be treated in the same way as those
    belonging to a namespace.

    Unfortunately, place-relative relocations require a symbol reference
    rather than an absolute value and, although x86 appears to get away with
    this due to placing the kernel text at the top of the address space, it
    almost certainly results in a runtime failure if the kernel is relocated
    dynamically as a result of KASLR.

    Rework 'namespace_offset' so that a value of 0, which cannot occur for a
    valid namespaced symbol, indicates that the corresponding symbol does
    not belong to a namespace.

    Cc: Matthias Maennich
    Cc: Jessica Yu
    Cc: Ard Biesheuvel
    Cc: Catalin Marinas
    Fixes: 8651ec01daed ("module: add support for symbol namespaces.")
    Reported-by: kbuild test robot
    Tested-by: Matthias Maennich
    Tested-by: Ard Biesheuvel
    Reviewed-by: Matthias Maennich
    Acked-by: Ard Biesheuvel
    Signed-off-by: Will Deacon
    Signed-off-by: Jessica Yu

    Will Deacon
     

10 Sep, 2019

2 commits

  • The EXPORT_SYMBOL_NS() and EXPORT_SYMBOL_NS_GPL() macros can be used to
    export a symbol to a specific namespace. There are no _GPL_FUTURE and
    _UNUSED variants because these are currently unused, and I'm not sure
    they are necessary.

    I didn't add EXPORT_SYMBOL_NS() for ASM exports; this patch sets the
    namespace of ASM exports to NULL by default. In case of relative
    references, it will be relocatable to NULL. If there's a need, this
    should be pretty easy to add.

    A module that wants to use a symbol exported to a namespace must add a
    MODULE_IMPORT_NS() statement to their module code; otherwise, modpost
    will complain when building the module, and the kernel module loader
    will emit an error and fail when loading the module.

    MODULE_IMPORT_NS() adds a modinfo tag 'import_ns' to the module. That
    tag can be observed by the modinfo command, modpost and kernel/module.c
    at the time of loading the module.

    The ELF symbols are renamed to include the namespace with an asm label;
    for example, symbol 'usb_stor_suspend' in namespace USB_STORAGE becomes
    'usb_stor_suspend.USB_STORAGE'. This allows modpost to do namespace
    checking, without having to go through all the effort of parsing ELF and
    relocation records just to get to the struct kernel_symbols.

    On x86_64 I saw no difference in binary size (compression), but at
    runtime this will require a word of memory per export to hold the
    namespace. An alternative could be to store namespaced symbols in their
    own section and use a separate 'struct namespaced_kernel_symbol' for
    that section, at the cost of making the module loader more complex.

    Co-developed-by: Martijn Coenen
    Signed-off-by: Martijn Coenen
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Matthias Maennich
    Signed-off-by: Jessica Yu

    Matthias Maennich
     
  • This change allows growing struct kernel_symbol without wasting bytes to
    alignment. It also concretized the alignment of ksymtab entries if
    relative references are used for ksymtab entries.

    struct kernel_symbol was already implicitly being aligned to the word
    size, except on x86_64 and m68k, where it is aligned to 16 and 2 bytes,
    respectively.

    As far as I can tell there is no requirement for aligning struct
    kernel_symbol to 16 bytes on x86_64, but gcc aligns structs to their
    size, and the linker aligns the custom __ksymtab sections to the largest
    data type contained within, so setting KSYM_ALIGN to 16 was necessary to
    stay consistent with the code generated for non-ASM EXPORT_SYMBOL(). Now
    that non-ASM EXPORT_SYMBOL() explicitly aligns to word size (8),
    KSYM_ALIGN is no longer necessary.

    In case of relative references, the alignment has been changed
    accordingly to not waste space when adding new struct members.

    As for m68k, struct kernel_symbol is aligned to 2 bytes even though the
    structure itself is 8 bytes; using a 4-byte alignment shouldn't hurt.

    I manually verified the output of the __ksymtab sections didn't change
    on x86, x86_64, arm, arm64 and m68k. As expected, the section contents
    didn't change, and the ELF section alignment only changed on x86_64 and
    m68k. Feedback from other archs more than welcome.

    Co-developed-by: Martijn Coenen
    Signed-off-by: Martijn Coenen
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Matthias Maennich
    Signed-off-by: Jessica Yu

    Matthias Maennich
     

02 Sep, 2019

2 commits


31 Aug, 2019

1 commit

  • __ioremap is not a kernel API, but used for helpers with differing
    semantics in arch code. We should not provide it in as-generic.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Paul Walmsley
    Tested-by: Paul Walmsley # rv32, rv64 boot
    Acked-by: Paul Walmsley # arch/riscv
    Signed-off-by: Arnd Bergmann

    Christoph Hellwig
     

28 Aug, 2019

1 commit


23 Aug, 2019

1 commit

  • Hyper-V guests use the default native_sched_clock() in
    pv_ops.time.sched_clock on x86. But native_sched_clock() directly uses the
    raw TSC value, which can be discontinuous in a Hyper-V VM.

    Add the generic hv_setup_sched_clock() to set the sched clock function
    appropriately. On x86, this sets pv_ops.time.sched_clock to read the
    Hyper-V reference TSC value that is scaled and adjusted to be continuous.

    Also move the Hyper-V reference TSC initialization much earlier in the boot
    process so no discontinuity is observed when pv_ops.time.sched_clock
    calculates its offset.

    [ tglx: Folded build fix ]

    Signed-off-by: Tianyu Lan
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Kelley
    Link: https://lkml.kernel.org/r/20190814123216.32245-3-Tianyu.Lan@microsoft.com

    Tianyu Lan
     

20 Aug, 2019

1 commit

  • The lockdown module is intended to allow for kernels to be locked down
    early in boot - sufficiently early that we don't have the ability to
    kmalloc() yet. Add support for early initialisation of some LSMs, and
    then add them to the list of names when we do full initialisation later.
    Early LSMs are initialised in link order and cannot be overridden via
    boot parameters, and cannot make use of kmalloc() (since the allocator
    isn't initialised yet).

    (Fixed by Stephen Rothwell to include a stub to fix builds when
    !CONFIG_SECURITY)

    Signed-off-by: Matthew Garrett
    Acked-by: Kees Cook
    Acked-by: Casey Schaufler
    Cc: Stephen Rothwell
    Signed-off-by: James Morris

    Matthew Garrett
     

14 Aug, 2019

1 commit

  • A compiler throws a warning on an arm64 system since commit 9849a5697d3d
    ("arch, mm: convert all architectures to use 5level-fixup.h"),

    mm/kasan/init.c: In function 'kasan_free_p4d':
    mm/kasan/init.c:344:9: warning: variable 'p4d' set but not used [-Wunused-but-set-variable]
    p4d_t *p4d;
    ^~~

    because p4d_none() in "5level-fixup.h" is compiled away while it is a
    static inline function in "pgtable-nopud.h".

    However, if converted p4d_none() to a static inline there, powerpc would
    be unhappy as it reads those in assembler language in
    "arch/powerpc/include/asm/book3s/64/pgtable.h", so it needs to skip
    assembly include for the static inline C function.

    While at it, converted a few similar functions to be consistent with the
    ones in "pgtable-nopud.h".

    Link: http://lkml.kernel.org/r/20190806232917.881-1-cai@lca.pw
    Signed-off-by: Qian Cai
    Acked-by: Arnd Bergmann
    Cc: Kirill A. Shutemov
    Cc: Michal Hocko
    Cc: Jason Gunthorpe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Qian Cai
     

07 Aug, 2019

1 commit

  • The function override_function_with_return() is defined separately for
    each architecture and every architecture's definition is almost same
    with each other. E.g. x86 and powerpc both define function in its own
    asm/error-injection.h header and override_function_with_return() has
    the same definition, the only difference is that x86 defines an extra
    function just_return_func() but it is specific for x86 and is only used
    by x86's override_function_with_return(), so don't need to export this
    function.

    This patch consolidates override_function_with_return() definition into
    asm-generic/error-injection.h header, thus all architectures can use the
    common definition. As result, the architecture specific headers are
    removed; the include/linux/error-injection.h header also changes to
    include asm-generic/error-injection.h header rather than architecture
    header, furthermore, it includes linux/compiler.h for successful
    compilation.

    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Leo Yan
    Signed-off-by: Will Deacon

    Leo Yan
     

03 Aug, 2019

1 commit

  • Commit d66acc39c7ce ("bitops: Optimise get_order()") introduced a
    compilation warning because "rx_frag_size" is an "ushort" while
    PAGE_SHIFT here is 16.

    The commit changed the get_order() to be a multi-line macro where
    compilers insist to check all statements in the macro even when
    __builtin_constant_p(rx_frag_size) will return false as "rx_frag_size"
    is a module parameter.

    In file included from ./arch/powerpc/include/asm/page_64.h:107,
    from ./arch/powerpc/include/asm/page.h:242,
    from ./arch/powerpc/include/asm/mmu.h:132,
    from ./arch/powerpc/include/asm/lppaca.h:47,
    from ./arch/powerpc/include/asm/paca.h:17,
    from ./arch/powerpc/include/asm/current.h:13,
    from ./include/linux/thread_info.h:21,
    from ./arch/powerpc/include/asm/processor.h:39,
    from ./include/linux/prefetch.h:15,
    from drivers/net/ethernet/emulex/benet/be_main.c:14:
    drivers/net/ethernet/emulex/benet/be_main.c: In function 'be_rx_cqs_create':
    ./include/asm-generic/getorder.h:54:9: warning: comparison is always
    true due to limited range of data type [-Wtype-limits]
    (((n) < (1UL << PAGE_SHIFT)) ? 0 : \
    ^
    drivers/net/ethernet/emulex/benet/be_main.c:3138:33: note: in expansion
    of macro 'get_order'
    adapter->big_page_size = (1 << get_order(rx_frag_size)) * PAGE_SIZE;
    ^~~~~~~~~

    Fix it by moving all of this multi-line macro into a proper function,
    and killing __get_order() off.

    [akpm@linux-foundation.org: remove __get_order() altogether]
    [cai@lca.pw: v2]
    Link: http://lkml.kernel.org/r/1564000166-31428-1-git-send-email-cai@lca.pw
    Link: http://lkml.kernel.org/r/1563914986-26502-1-git-send-email-cai@lca.pw
    Fixes: d66acc39c7ce ("bitops: Optimise get_order()")
    Signed-off-by: Qian Cai
    Reviewed-by: Nathan Chancellor
    Cc: David S. Miller
    Cc: Arnd Bergmann
    Cc: David Howells
    Cc: Jakub Jelinek
    Cc: Nick Desaulniers
    Cc: Bill Wendling
    Cc: James Y Knight
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Qian Cai
     

01 Aug, 2019

1 commit

  • CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by
    CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same
    functionality which today depends on CONFIG_PREEMPT.

    Switch the preemption code, scheduler and init task over to use
    CONFIG_PREEMPTION.

    That's the first step towards RT in that area. The more complex changes are
    coming separately.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Masami Hiramatsu
    Cc: Paolo Bonzini
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20190726212124.117528401@linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

31 Jul, 2019

1 commit

  • The generic aegis128 software crypto driver recently gained support
    for using SIMD intrinsics to increase performance, for which it
    uncondionally #include's the header. Unfortunately,
    this header does not exist on many architectures, resulting in
    build failures.

    Since asm-generic already has a version of simd.h, let's make it
    a mandatory header so that it gets instantiated on all architectures
    that don't provide their own version.

    Signed-off-by: Ard Biesheuvel
    Acked-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     

22 Jul, 2019

1 commit


18 Jul, 2019

1 commit

  • Pull thermal management updates from Zhang Rui:

    - Convert thermal documents to ReST (Mauro Carvalho Chehab)

    - Fix a cyclic depedency in between thermal core and governors (Daniel
    Lezcano)

    - Fix processor_thermal_device driver to re-evaluate power limits after
    resume (Srinivas Pandruvada, Zhang Rui)

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
    drivers: thermal: processor_thermal_device: Fix build warning
    docs: thermal: convert to ReST
    thermal/drivers/core: Use governor table to initialize
    thermal/drivers/core: Add init section table for self-encapsulation
    drivers: thermal: processor_thermal: Read PPCC on resume

    Linus Torvalds
     

17 Jul, 2019

1 commit

  • For architectures using __WARN_TAINT, the WARN_ON macro did not print
    out the "cut here" string. The other WARN_XXX macros would print "cut
    here" inside __warn_printk, which is not called for WARN_ON since it
    doesn't have a message to print.

    Link: http://lkml.kernel.org/r/20190624154831.163888-1-ddavenport@chromium.org
    Fixes: a7bed27af194 ("bug: fix "cut here" location for __WARN_TAINT architectures")
    Signed-off-by: Drew Davenport
    Acked-by: Kees Cook
    Tested-by: Kees Cook
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Drew Davenport