01 Jun, 2020

2 commits

  • Pull x86 fixes from Thomas Gleixner:
    "A pile of x86 fixes:

    - Prevent a memory leak in ioperm which was caused by the stupid
    assumption that the exit cleanup is always called for current,
    which is not the case when fork fails after taking a reference on
    the ioperm bitmap.

    - Fix an arithmething overflow in the DMA code on 32bit systems

    - Fill gaps in the xstate copy with defaults instead of leaving them
    uninitialized

    - Revert: "Make __X32_SYSCALL_BIT be unsigned long" as it turned out
    that existing user space fails to build"

    * tag 'x86-urgent-2020-05-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/ioperm: Prevent a memory leak when fork fails
    x86/dma: Fix max PFN arithmetic overflow on 32 bit systems
    copy_xstate_to_kernel(): don't leave parts of destination uninitialized
    x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"

    Linus Torvalds
     
  • Pull networking fixes from David Miller:
    "Another week, another set of bug fixes:

    1) Fix pskb_pull length in __xfrm_transport_prep(), from Xin Long.

    2) Fix double xfrm_state put in esp{4,6}_gro_receive(), also from Xin
    Long.

    3) Re-arm discovery timer properly in mac80211 mesh code, from Linus
    Lüssing.

    4) Prevent buffer overflows in nf_conntrack_pptp debug code, from
    Pablo Neira Ayuso.

    5) Fix race in ktls code between tls_sw_recvmsg() and
    tls_decrypt_done(), from Vinay Kumar Yadav.

    6) Fix crashes on TCP fallback in MPTCP code, from Paolo Abeni.

    7) More validation is necessary of untrusted GSO packets coming from
    virtualization devices, from Willem de Bruijn.

    8) Fix endianness of bnxt_en firmware message length accesses, from
    Edwin Peer.

    9) Fix infinite loop in sch_fq_pie, from Davide Caratti.

    10) Fix lockdep splat in DSA by setting lockless TX in netdev features
    for slave ports, from Vladimir Oltean.

    11) Fix suspend/resume crashes in mlx5, from Mark Bloch.

    12) Fix use after free in bpf fmod_ret, from Alexei Starovoitov.

    13) ARP retransmit timer guard uses wrong offset, from Hongbin Liu.

    14) Fix leak in inetdev_init(), from Yang Yingliang.

    15) Don't try to use inet hash and unhash in l2tp code, results in
    crashes. From Eric Dumazet"

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
    l2tp: add sk_family checks to l2tp_validate_socket
    l2tp: do not use inet_hash()/inet_unhash()
    net: qrtr: Allocate workqueue before kernel_bind
    mptcp: remove msk from the token container at destruction time.
    mptcp: fix race between MP_JOIN and close
    mptcp: fix unblocking connect()
    net/sched: act_ct: add nat mangle action only for NAT-conntrack
    devinet: fix memleak in inetdev_init()
    virtio_vsock: Fix race condition in virtio_transport_recv_pkt
    drivers/net/ibmvnic: Update VNIC protocol version reporting
    NFC: st21nfca: add missed kfree_skb() in an error path
    neigh: fix ARP retransmit timer guard
    bpf, selftests: Add a verifier test for assigning 32bit reg states to 64bit ones
    bpf, selftests: Verifier bounds tests need to be updated
    bpf: Fix a verifier issue when assigning 32bit reg states to 64bit ones
    bpf: Fix use-after-free in fmod_ret check
    net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta()
    net/mlx5e: Fix MLX5_TC_CT dependencies
    net/mlx5e: Properly set default values when disabling adaptive moderation
    net/mlx5e: Fix arch depending casting issue in FEC
    ...

    Linus Torvalds
     

31 May, 2020

1 commit

  • Pull powerpc fixes from Michael Ellerman:

    - a fix for the recent change to how we restore non-volatile GPRs,
    which broke our emulation of reading from the DSCR (Data Stream
    Control Register).

    - a fix for the recent rewrite of interrupt/syscall exit in C, we need
    to exclude KCOV from that code, otherwise it can lead to
    unrecoverable faults.

    Thanks to Daniel Axtens.

    * tag 'powerpc-5.7-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
    powerpc/64s: Disable sanitisers for C syscall/interrupt entry/exit code
    powerpc/64s: Fix restore of NV GPRs after facility unavailable exception

    Linus Torvalds
     

30 May, 2020

5 commits

  • Pull ARM SoC fixes from Arnd Bergmann:
    "This time there is one fix for the error path in the mediatek cmdq
    driver (used by their video driver) and a couple of devicetree fixes,
    mostly for 32-bit ARM, and fairly harmless:

    - On OMAP2 there were a few regressions in the ethernet drivers, one
    of them leading to an external abort trap

    - One Raspberry Pi version had a misconfigured LED

    - Interrupts on Broadcom NSP were slightly misconfigured

    - One i.MX6q board had issues with graphics mode setting

    - On mmp3 there are some minor fixes that were submitted for v5.8
    with a cc:stable tag, so I ended up picking them up here as well

    - The Mediatek Video Codec needs to run at a higher frequency than
    configured originally"

    * tag 'armsoc-fixes-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
    ARM: dts: mmp3: Drop usb-nop-xceiv from HSIC phy
    ARM: dts: mmp3-dell-ariel: Fix the SPI devices
    ARM: dts: mmp3: Use the MMP3 compatible string for /clocks
    ARM: dts: bcm: HR2: Fix PPI interrupt types
    ARM: dts: bcm2835-rpi-zero-w: Fix led polarity
    ARM: dts/imx6q-bx50v3: Set display interface clock parents
    soc: mediatek: cmdq: return send msg error code
    arm64: dts: mt8173: fix vcodec-enc clock
    ARM: dts: Fix wrong mdio clock for dm814x
    ARM: dts: am437x: fix networking on boards with ksz9031 phy
    ARM: dts: am57xx: fix networking on boards with ksz9031 phy

    Linus Torvalds
     
  • Alexei Starovoitov says:

    ====================
    pull-request: bpf 2020-05-29

    The following pull-request contains BPF updates for your *net* tree.

    We've added 6 non-merge commits during the last 7 day(s) which contain
    a total of 4 files changed, 55 insertions(+), 34 deletions(-).

    The main changes are:

    1) minor verifier fix for fmod_ret progs, from Alexei.

    2) af_xdp overflow check, from Bjorn.

    3) minor verifier fix for 32bit assignment, from John.

    4) powerpc has non-overlapping addr space, from Petr.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Pull arm64 fix from Catalin Marinas:
    "Ensure __cpu_up() returns an error if cpu_online() is false after
    waiting for completion on cpu_running"

    * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    arm64/kernel: Fix return value when cpu_online() fails in __cpu_up()

    Linus Torvalds
     
  • Pull parisc fix from Helge Deller:
    "Fix a kernel panic at boot time for some HP-PARISC machines"

    * 'parisc-5.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Fix kernel panic in mem_init()

    Linus Torvalds
     
  • Pull iommu fixes from Joerg Roedel:

    - Two build fixes for issues introduced during the merge window

    - A fix for a reference count leak in an error path of
    iommu_group_alloc()

    * tag 'iommu-fixes-v5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
    iommu: Fix reference count leak in iommu_group_alloc.
    x86: Hide the archdata.iommu field behind generic IOMMU_API
    ia64: Hide the archdata.iommu field behind generic IOMMU_API

    Linus Torvalds
     

29 May, 2020

6 commits

  • The Debian kernel v5.6 triggers this kernel panic:

    Kernel panic - not syncing: Bad Address (null pointer deref?)
    Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at addr 0000000000000000
    CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
    IAOQ[0]: mem_init+0xb0/0x150
    IAOQ[1]: mem_init+0xb4/0x150
    RP(r2): start_kernel+0x6c8/0x1190
    Backtrace:
    [] start_kernel+0x6c8/0x1190
    [] start_parisc+0x158/0x1b8

    on a HP-PARISC rp3440 machine with this memory layout:
    Memory Ranges:
    0) Start 0x0000000000000000 End 0x000000003fffffff Size 1024 MB
    1) Start 0x0000004040000000 End 0x00000040ffdfffff Size 3070 MB

    Fix the crash by avoiding virt_to_page() and similar functions in
    mem_init() until the memory zones have been fully set up.

    Signed-off-by: Helge Deller
    Cc: stable@vger.kernel.org # v5.0+

    Helge Deller
     
  • syzkaller is picking up a bunch of crashes that look like this:

    Unrecoverable exception 380 at c00000000037ed60 (msr=8000000000001031)
    Oops: Unrecoverable exception, sig: 6 [#1]
    LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
    Modules linked in:
    CPU: 0 PID: 874 Comm: syz-executor.0 Not tainted 5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e #0
    NIP: c00000000037ed60 LR: c00000000004bac8 CTR: c000000000030990
    REGS: c0000000555a7230 TRAP: 0380 Not tainted (5.7.0-rc7-syzkaller-00016-gb0c3ba31be3e)
    MSR: 8000000000001031 CR: 48222882 XER: 20000000
    CFAR: c00000000004bac4 IRQMASK: 0
    GPR00: c00000000004bb68 c0000000555a74c0 c0000000024b3500 0000000000000005
    GPR04: 0000000000000000 0000000000000000 c00000000004bb88 c008000000910000
    GPR08: 00000000000b0000 c00000000004bac8 0000000000016000 c000000002503500
    GPR12: c000000000030990 c000000003190000 00000000106a5898 00000000106a0000
    GPR16: 00000000106a5890 c000000007a92000 c000000008180e00 c000000007a8f700
    GPR20: c000000007a904b0 0000000010110000 c00000000259d318 5deadbeef0000100
    GPR24: 5deadbeef0000122 c000000078422700 c000000009ee88b8 c000000078422778
    GPR28: 0000000000000001 800000000280b033 0000000000000000 c0000000555a75a0
    NIP [c00000000037ed60] __sanitizer_cov_trace_pc+0x40/0x50
    LR [c00000000004bac8] interrupt_exit_kernel_prepare+0x118/0x310
    Call Trace:
    [c0000000555a74c0] [c00000000004bb68] interrupt_exit_kernel_prepare+0x1b8/0x310 (unreliable)
    [c0000000555a7530] [c00000000000f9a8] interrupt_return+0x118/0x1c0
    --- interrupt: 900 at __sanitizer_cov_trace_pc+0x0/0x50
    ......

    This is caused by __sanitizer_cov_trace_pc() causing an SLB fault
    after MSR[RI] has been cleared by __hard_EE_RI_disable(), which we
    can not recover from.

    Do not instrument the new syscall/interrupt entry/exit code with KCOV,
    GCOV or UBSAN.

    Reported-by: syzbot-ppc64
    Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic in C")
    Signed-off-by: Daniel Axtens
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    Daniel Axtens
     
  • Pick up FPU register dump fixes from Al Viro.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • In the copy_process() routine called by _do_fork(), failure to allocate
    a PID (or further along in the function) will trigger an invocation to
    exit_thread(). This is done to clean up from an earlier call to
    copy_thread_tls(). Naturally, the child task is passed into exit_thread(),
    however during the process, io_bitmap_exit() nullifies the parent's
    io_bitmap rather than the child's.

    As copy_thread_tls() has been called ahead of the failure, the reference
    count on the calling thread's io_bitmap is incremented as we would expect.
    However, io_bitmap_exit() doesn't accept any arguments, and thus assumes
    it should trash the current thread's io_bitmap reference rather than the
    child's. This is pretty sneaky in practice, because in all instances but
    this one, exit_thread() is called with respect to the current task and
    everything works out.

    A determined attacker can issue an appropriate ioctl (i.e. KDENABIO) to
    get a bitmap allocated, and force a clone3() syscall to fail by passing
    in a zeroed clone_args structure. The kernel handles the erroneous struct
    and the buggy code path is followed, and even though the parent's reference
    to the io_bitmap is trashed, the child still holds a reference and thus
    the structure will never be freed.

    Fix this by tweaking io_bitmap_exit() and its subroutines to accept a
    task_struct argument which to operate on.

    Fixes: ea5f1cd7ab49 ("x86/ioperm: Remove bitmap if all permissions dropped")
    Signed-off-by: Jay Lang
    Signed-off-by: Thomas Gleixner
    Cc: stable#@vger.kernel.org
    Link: https://lkml.kernel.org/r/20200524162742.253727-1-jaytlang@mit.edu

    Jay Lang
     
  • Pull csky fixes from Guo Ren:
    "Another four fixes for csky:

    - fix req_syscall debug

    - fix abiv2 syscall_trace

    - fix preempt enable

    - clean up regs usage in entry.S"

    * tag 'csky-for-linus-5.7-rc8' of git://github.com/c-sky/csky-linux:
    csky: Fixup CONFIG_DEBUG_RSEQ
    csky: Coding convention in entry.S
    csky: Fixup abiv2 syscall_trace break a4 & a5
    csky: Fixup CONFIG_PREEMPT panic

    Linus Torvalds
     
  • The intermediate result of the old term (4UL * 1024 * 1024 * 1024) is
    4 294 967 296 or 0x100000000 which is no problem on 64 bit systems.
    The patch does not change the later overall result of 0x100000 for
    MAX_DMA32_PFN (after it has been shifted by PAGE_SHIFT). The new
    calculation yields the same result, but does not require 64 bit
    arithmetic.

    On 32 bit systems the old calculation suffers from an arithmetic
    overflow in that intermediate term in braces: 4UL aka unsigned long int
    is 4 byte wide and an arithmetic overflow happens (the 0x100000000 does
    not fit in 4 bytes), the in braces result is truncated to zero, the
    following right shift does not alter that, so MAX_DMA32_PFN evaluates to
    0 on 32 bit systems.

    That wrong value is a problem in a comparision against MAX_DMA32_PFN in
    the init code for swiotlb in pci_swiotlb_detect_4gb() to decide if
    swiotlb should be active. That comparison yields the opposite result,
    when compiling on 32 bit systems.

    This was not possible before

    1b7e03ef7570 ("x86, NUMA: Enable emulation on 32bit too")

    when that MAX_DMA32_PFN was first made visible to x86_32 (and which
    landed in v3.0).

    In practice this wasn't a problem, unless CONFIG_SWIOTLB is active on
    x86-32.

    However if one has set CONFIG_IOMMU_INTEL, since

    c5a5dc4cbbf4 ("iommu/vt-d: Don't switch off swiotlb if bounce page is used")

    there's a dependency on CONFIG_SWIOTLB, which was not necessarily
    active before. That landed in v5.4, where we noticed it in the fli4l
    Linux distribution. We have CONFIG_IOMMU_INTEL active on both 32 and 64
    bit kernel configs there (I could not find out why, so let's just say
    historical reasons).

    The effect is at boot time 64 MiB (default size) were allocated for
    bounce buffers now, which is a noticeable amount of memory on small
    systems like pcengines ALIX 2D3 with 256 MiB memory, which are still
    frequently used as home routers.

    We noticed this effect when migrating from kernel v4.19 (LTS) to v5.4
    (LTS) in fli4l and got that kernel messages for example:

    Linux version 5.4.22 (buildroot@buildroot) (gcc version 7.3.0 (Buildroot 2018.02.8)) #1 SMP Mon Nov 26 23:40:00 CET 2018

    Memory: 183484K/261756K available (4594K kernel code, 393K rwdata, 1660K rodata, 536K init, 456K bss , 78272K reserved, 0K cma-reserved, 0K highmem)

    PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
    software IO TLB: mapped [mem 0x0bb78000-0x0fb78000] (64MB)

    The initial analysis and the suggested fix was done by user 'sourcejedi'
    at stackoverflow and explicitly marked as GPLv2 for inclusion in the
    Linux kernel:

    https://unix.stackexchange.com/a/520525/50007

    The new calculation, which does not suffer from that overflow, is the
    same as for arch/mips now as suggested by Robin Murphy.

    The fix was tested by fli4l users on round about two dozen different
    systems, including both 32 and 64 bit archs, bare metal and virtualized
    machines.

    [ bp: Massage commit message. ]

    Fixes: 1b7e03ef7570 ("x86, NUMA: Enable emulation on 32bit too")
    Reported-by: Alan Jenkins
    Suggested-by: Robin Murphy
    Signed-off-by: Alexander Dahl
    Signed-off-by: Borislav Petkov
    Reviewed-by: Greg Kroah-Hartman
    Cc: stable@vger.kernel.org
    Link: https://unix.stackexchange.com/q/520065/50007
    Link: https://web.nettworks.org/bugs/browse/FFL-2560
    Link: https://lkml.kernel.org/r/20200526175749.20742-1-post@lespocky.de

    Alexander Dahl
     

28 May, 2020

7 commits

  • The commit 0ebeea8ca8a4d1d453a ("bpf: Restrict bpf_probe_read{, str}() only
    to archs where they work") caused that bpf_probe_read{, str}() functions
    were not longer available on architectures where the same logical address
    might have different content in kernel and user memory mapping. These
    architectures should use probe_read_{user,kernel}_str helpers.

    For backward compatibility, the problematic functions are still available
    on architectures where the user and kernel address spaces are not
    overlapping. This is defined CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE.

    At the moment, these backward compatible functions are enabled only on x86_64,
    arm, and arm64. Let's do it also on powerpc that has the non overlapping
    address space as well.

    Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
    Signed-off-by: Petr Mladek
    Signed-off-by: Daniel Borkmann
    Acked-by: Michael Ellerman
    Link: https://lore.kernel.org/lkml/20200527122844.19524-1-pmladek@suse.com

    Petr Mladek
     
  • If boot_secondary() was successful, and cpu_online() was an error in
    __cpu_up(), -EIO was returned, but 0 is returned by commit d22b115cbfbb7
    ("arm64/kernel: Simplify __cpu_up() by bailing out early").
    Therefore, bringup_wait_for_ap() causes the primary core to wait for a
    long time, which may cause boot failure.
    This commit sets -EIO to return code under the same conditions.

    Fixes: d22b115cbfbb ("arm64/kernel: Simplify __cpu_up() by bailing out early")
    Signed-off-by: Nobuhiro Iwamatsu
    Tested-by: Yuji Ishikawa
    Acked-by: Will Deacon
    Cc: Gavin Shan
    Cc: Mark Rutland
    Link: https://lore.kernel.org/r/20200527233457.2531118-1-nobuhiro1.iwamatsu@toshiba.co.jp
    [catalin.marinas@arm.com: return -EIO at the end of the function]
    Signed-off-by: Catalin Marinas

    Nobuhiro Iwamatsu
     
  • Put the rseq_syscall check point at the prologue of the syscall
    will break the a0 ... a7. This will casue system call bug when
    DEBUG_RSEQ is enabled.

    So move it to the epilogue of syscall, but before syscall_trace.

    Signed-off-by: Guo Ren

    Guo Ren
     
  • There is no fixup or feature in the patch, we only cleanup with:

    - Remove unnecessary reg used (r11, r12), just use r9 & r10 &
    syscallid regs as temp useage.
    - Add _TIF_SYSCALL_WORK and _TIF_WORK_MASK to gather macros.

    Signed-off-by: Guo Ren

    Guo Ren
     
  • Current implementation could destory a4 & a5 when strace, so we need to get them
    from pt_regs by SAVE_ALL.

    Signed-off-by: Guo Ren

    Guo Ren
     
  • log:
    [    0.13373200] Calibrating delay loop...
    [    0.14077600] ------------[ cut here ]------------
    [    0.14116700] WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:3790 preempt_count_add+0xc8/0x11c
    [    0.14348000] DEBUG_LOCKS_WARN_ON((preempt_count() < 0))Modules linked in:
    [    0.14395100] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0 #7
    [    0.14410800]
    [    0.14427400] Call Trace:
    [    0.14450700] [] dump_stack+0x8a/0xe4
    [    0.14473500] [] __warn+0x10e/0x15c
    [    0.14495900] [] warn_slowpath_fmt+0x72/0xc0
    [    0.14518600] [] preempt_count_add+0xc8/0x11c
    [    0.14544900] [] _raw_spin_lock+0x28/0x68
    [    0.14572600] [] vprintk_emit+0x84/0x2d8
    [    0.14599000] [] vprintk_default+0x2e/0x44
    [    0.14625100] [] vprintk_func+0x12a/0x1d0
    [    0.14651300] [] printk+0x30/0x48
    [    0.14677600] [] lockdep_init+0x12/0xb0
    [    0.14703800] [] start_kernel+0x558/0x7f8
    [    0.14730000] [] csky_start+0x58/0x94
    [    0.14756600] irq event stamp: 34
    [    0.14775100] hardirqs last  enabled at (33): [] ret_from_exception+0x2c/0x72
    [    0.14793700] hardirqs last disabled at (34): [] vprintk_emit+0x7a/0x2d8
    [    0.14812300] softirqs last  enabled at (32): [] __do_softirq+0x578/0x6d8
    [    0.14830800] softirqs last disabled at (25): [] irq_exit+0xec/0x128

    The preempt_count of reg could be destroyed after csky_do_IRQ without reload
    from memory.

    After reference to other architectures (arm64, riscv), we move preempt entry
    into ret_from_exception and disable irq at the beginning of
    ret_from_exception instead of RESTORE_ALL.

    Signed-off-by: Guo Ren
    Reported-by: Lu Baoquan

    Guo Ren
     
  • copy the corresponding pieces of init_fpstate into the gaps instead.

    Cc: stable@kernel.org
    Tested-by: Alexander Potapenko
    Acked-by: Borislav Petkov
    Signed-off-by: Al Viro

    Al Viro
     

27 May, 2020

2 commits

  • There is a generic, kernel wide configuration symbol for enabling the
    IOMMU specific bits: CONFIG_IOMMU_API. Implementations (including
    INTEL_IOMMU and AMD_IOMMU driver) select it so use it here as well.

    This makes the conditional archdata.iommu field consistent with other
    platforms and also fixes any compile test builds of other IOMMU drivers,
    when INTEL_IOMMU or AMD_IOMMU are not selected).

    For the case when INTEL_IOMMU/AMD_IOMMU and COMPILE_TEST are not
    selected, this should create functionally equivalent code/choice. With
    COMPILE_TEST this field could appear if other IOMMU drivers are chosen
    but neither INTEL_IOMMU nor AMD_IOMMU are not.

    Reported-by: kbuild test robot
    Fixes: e93a1695d7fb ("iommu: Enable compile testing for some of drivers")
    Signed-off-by: Krzysztof Kozlowski
    Acked-by: Borislav Petkov
    Link: https://lore.kernel.org/r/20200518120855.27822-2-krzk@kernel.org
    Signed-off-by: Joerg Roedel

    Krzysztof Kozlowski
     
  • There is a generic, kernel wide configuration symbol for enabling the
    IOMMU specific bits: CONFIG_IOMMU_API. Implementations (including
    INTEL_IOMMU driver) select it so use it here as well.

    This makes the conditional archdata.iommu field consistent with other
    platforms and also fixes any compile test builds of other IOMMU drivers,
    when INTEL_IOMMU is not selected).

    For the case when INTEL_IOMMU and COMPILE_TEST are not selected, this
    should create functionally equivalent code/choice. With COMPILE_TEST
    this field could appear if other IOMMU drivers are chosen but
    INTEL_IOMMU not.

    Reported-by: kbuild test robot
    Fixes: e93a1695d7fb ("iommu: Enable compile testing for some of drivers")
    Signed-off-by: Krzysztof Kozlowski

    Link: https://lore.kernel.org/r/20200518120855.27822-1-krzk@kernel.org
    Signed-off-by: Joerg Roedel

    Krzysztof Kozlowski
     

26 May, 2020

4 commits

  • Revert

    45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")

    and add a comment to discourage someone else from making the same
    mistake again.

    It turns out that some user code fails to compile if __X32_SYSCALL_BIT
    is unsigned long. See, for example [1] below.

    [ bp: Massage and do the same thing in the respective tools/ header. ]

    Fixes: 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
    Reported-by: Thorsten Glaser
    Signed-off-by: Andy Lutomirski
    Signed-off-by: Borislav Petkov
    Cc: stable@kernel.org
    Link: [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294
    Link: https://lkml.kernel.org/r/92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org

    Andy Lutomirski
     
  • Commit 702f09805222 ("powerpc/64s/exception: Remove lite interrupt
    return") changed the interrupt return path to not restore non-volatile
    registers by default, and explicitly restore them in paths where it is
    required.

    But it missed that the facility unavailable exception can sometimes
    modify user registers, ie. when it does emulation of move from DSCR.

    This is seen as a failure of the dscr_sysfs_thread_test:
    test: dscr_sysfs_thread_test
    [cpu 0] User DSCR should be 1 but is 0
    failure: dscr_sysfs_thread_test

    So restore non-volatile GPRs after facility unavailable exceptions.

    Currently the hypervisor facility unavailable exception is also wired
    up to call facility_unavailable_exception().

    In practice we should never take a hypervisor facility unavailable
    exception for the DSCR. On older bare metal systems we set HFSCR_DSCR
    unconditionally in __init_HFSCR, or on newer systems it should be
    enabled via the "data-stream-control-register" device tree CPU
    feature.

    Even if it's not, since commit f3c99f97a3cd ("KVM: PPC: Book3S HV:
    Don't access HFSCR, LPIDR or LPCR when running nested"), the KVM code
    has unconditionally set HFSCR_DSCR when running guests.

    So we should only get a hypervisor facility unavailable for the DSCR
    if skiboot has disabled the "data-stream-control-register" feature,
    and we are somehow in guest context but not via KVM.

    Given all that, it should be unnecessary to add a restore of
    non-volatile GPRs after the hypervisor facility exception, because we
    never expect to hit that path. But equally we may as well add the
    restore, because we never expect to hit that path, and if we ever did,
    at least we would correctly restore the registers to their post
    emulation state.

    In future we can split the non-HV and HV facility unavailable handling
    so that there is no emulation in the HV handler, and then remove the
    restore for the HV case.

    Fixes: 702f09805222 ("powerpc/64s/exception: Remove lite interrupt return")
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200526061808.2472279-1-mpe@ellerman.id.au

    Michael Ellerman
     
  • Pull ARM fixes from Russell King:

    - correct value of decompressor tag size in header

    - fix DACR value when we have nested exceptions

    - fix a missing newline on a kernel message

    - fix mask for ptrace thumb breakpoint hook

    * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
    ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook
    ARM: 8973/1: Add missing newline terminator to kernel message
    ARM: uaccess: fix DACR mismatch with nested exceptions
    ARM: uaccess: integrate uaccess_save and uaccess_restore
    ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h
    ARM: 8970/1: decompressor: increase tag size

    Linus Torvalds
     
  • …x/kernel/git/tmlind/linux-omap into arm/fixes

    Few cpsw related dts fixes for omaps

    Recent cpsw driver changes exposed few regressions in the cpsw related
    dts configuration that would be good to fix:

    - Few more boards still need to be updated to use rgmii-rxid phy caused
    by the fallout from commit bcf3440c6dd7 ("net: phy: micrel: add phy-mode
    support for the KSZ9031 PHY" as the rx delay is now disabled unless we
    use rgmii-rxid.

    - On dm814x we have been using a wrong clock for mdio that now can produce
    external abort on some boards

    * tag 'omap-for-v5.7/cpsw-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
    ARM: dts: Fix wrong mdio clock for dm814x
    ARM: dts: am437x: fix networking on boards with ksz9031 phy
    ARM: dts: am57xx: fix networking on boards with ksz9031 phy

    Link: https://lore.kernel.org/r/pull-1589472123-367692@atomide.com
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

25 May, 2020

3 commits

  • …dcom/stblinux into arm/fixes

    This pull request contains Broadcom ARM-based SoCs Device Tree fixes for
    5.7, please pull the following:

    - Vincent fixes the polarity of the ACT LED on the Raspberry Pi Zero W
    board

    - Hamish fixes the ARM PPI interrupts sensitivy for the Hurricane 2
    SoCs

    * tag 'arm-soc/for-5.7/devicetree-fixes-part2-v2' of https://github.com/Broadcom/stblinux:
    ARM: dts: bcm: HR2: Fix PPI interrupt types
    ARM: dts: bcm2835-rpi-zero-w: Fix led polarity

    Link: https://lore.kernel.org/r/20200524203714.17035-1-f.fainelli@gmail.com
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     
  • Pull EFI fixes from Thomas Gleixner:
    "A set of EFI fixes:

    - Don't return a garbage screen info when EFI framebuffer is not
    available

    - Make the early EFI console work properly with wider fonts instead
    of drawing garbage

    - Prevent a memory buffer leak in allocate_e820()

    - Print the firmware error record properly so it can be decoded by
    users

    - Fix a symbol clash in the host tool build which only happens with
    newer compilers.

    - Add a missing check for the event log version of TPM which caused
    boot failures on several Dell systems due to an attempt to decode
    SHA-1 format with the crypto agile algorithm"

    * tag 'efi-urgent-2020-05-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    tpm: check event log version before reading final events
    efi: Pull up arch-specific prototype efi_systab_show_arch()
    x86/boot: Mark global variables as static
    efi: cper: Add support for printing Firmware Error Record Reference
    efi/libstub/x86: Avoid EFI map buffer alloc in allocate_e820()
    efi/earlycon: Fix early printk for wider fonts
    efi/libstub: Avoid returning uninitialized data from setup_graphics()

    Linus Torvalds
     
  • Pull x86 fixes from Thomas Gleixner:
    "Two fixes for x86:

    - Unbreak stack dumps for inactive tasks by interpreting the special
    first frame left by __switch_to_asm() correctly.

    The recent change not to skip the first frame so ORC and frame
    unwinder behave in the same way caused all entries to be
    unreliable, i.e. prepended with '?'.

    - Use cpumask_available() instead of an implicit NULL check of a
    cpumask_var_t in mmio trace to prevent a Clang build warning"

    * tag 'x86-urgent-2020-05-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks
    x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables

    Linus Torvalds
     

24 May, 2020

6 commits

  • The srmmu_nocache_init() uses __nocache_fix() macro to add an offset to
    page table entry to access srmmu_nocache_pool.

    But since sparc32 has only three actual page table levels, pgd, p4d and
    pud are essentially the same thing and pgd_offset() and p4d_offset() are
    no-ops, the __nocache_fix() should be done only at PUD level.

    Remove __nocache_fix() for p4d_offset() and pud_offset() and keep it
    only for PUD and lower levels.

    Fixes: c2bc26f7ca1f ("sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init()")
    Signed-off-by: Mike Rapoport
    Cc: David S. Miller
    Cc: Anatoly Pugachev
    Cc:
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Merge misc fixes from Andrew Morton:
    "11 fixes"

    * emailed patches from Andrew Morton :
    MAINTAINERS: add files related to kdump
    z3fold: fix use-after-free when freeing handles
    sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init()
    MAINTAINERS: update email address for Naoya Horiguchi
    sh: include linux/time_types.h for sockios
    kasan: disable branch tracing for core runtime
    selftests/vm/write_to_hugetlbfs.c: fix unused variable warning
    selftests/vm/.gitignore: add mremap_dontunmap
    rapidio: fix an error in get_user_pages_fast() error handling
    x86: bitops: fix build regression
    device-dax: don't leak kernel memory to user space after unloading kmem

    Linus Torvalds
     
  • Pull s390 fixes from Vasily Gorbik:

    - Add missing R_390_JMP_SLOT relocation type in KASLR code.

    - Fix set_huge_pte_at for empty ptes issue which has been uncovered
    with arch page table helper tests.

    - Correct initrd location for kdump kernel.

    - Fix s390_mmio_read/write with MIO in PCI code.

    * tag 's390-5.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
    s390/kaslr: add support for R_390_JMP_SLOT relocation type
    s390/mm: fix set_huge_pte_at() for empty ptes
    s390/kexec_file: fix initrd location for kdump kernel
    s390/pci: Fix s390_mmio_read/write with MIO

    Linus Torvalds
     
  • The kbuild test robot reported the following warning:

    arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init': arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used [-Werror=unused-but-set-variable]
    300 | pud_t *pud;

    This warning is caused by misprint in the page table traversal in
    srmmu_nocache_init() function which accessed a PMD entry using PGD
    rather than PUD.

    Since sparc32 has only 3 page table levels, the PGD and PUD are
    essentially the same and usage of __nocache_fix() removed the type
    checking.

    Use PUD for the consistency and to silence the compiler warning.

    Fixes: 7235db268a2777bc38 ("sparc32: use pgtable-nopud instead of 4level-fixup")
    Reported-by: kbuild test robot
    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Cc: David S. Miller
    Cc: Anatoly Pugachev
    Cc:
    Link: http://lkml.kernel.org/r/20200520132005.GM1059226@linux.ibm.com
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Using the socket ioctls on arch/sh (and only there) causes build time
    problems when __kernel_old_timeval/__kernel_old_timespec are not already
    visible to the compiler.

    Add an explict include line for the header that defines these
    structures.

    Fixes: 8c709f9a0693 ("y2038: sh: remove timeval/timespec usage from headers")
    Fixes: 0768e17073dc ("net: socket: implement 64-bit timestamps")
    Reported-by: John Paul Adrian Glaubitz
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Tested-by: John Paul Adrian Glaubitz
    Cc: Yoshinori Sato
    Cc: Rich Felker
    Cc: "David S. Miller"
    Cc: John Paul Adrian Glaubitz
    Cc:
    Link: http://lkml.kernel.org/r/20200519131327.1836482-1-arnd@arndb.de
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     
  • This is easily reproducible via CC=clang + CONFIG_STAGING=y +
    CONFIG_VT6656=m.

    It turns out that if your config tickles __builtin_constant_p via
    differences in choices to inline or not, these statements produce
    invalid assembly:

    $ cat foo.c
    long a(long b, long c) {
    asm("orb %1, %0" : "+q"(c): "r"(b));
    return c;
    }
    $ gcc foo.c
    foo.c: Assembler messages:
    foo.c:2: Error: `%rax' not allowed with `orb'

    Use the `%b` "x86 Operand Modifier" to instead force register allocation
    to select a lower-8-bit GPR operand.

    The "q" constraint only has meaning on -m32 otherwise is treated as
    "r". Not all GPRs have low-8-bit aliases for -m32.

    Fixes: 1651e700664b4 ("x86: Fix bitops.h warning with a moved cast")
    Reported-by: kernelci.org bot
    Suggested-by: Andy Shevchenko
    Suggested-by: Brian Gerst
    Suggested-by: H. Peter Anvin
    Suggested-by: Ilie Halip
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Andrew Morton
    Tested-by: Sedat Dilek
    Tested-by: Nathan Chancellor [build, clang-11]
    Reviewed-by: Nathan Chancellor
    Reviewed-By: Brian Gerst
    Reviewed-by: Jesse Brandeburg
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Borislav Petkov
    Cc: Marco Elver
    Cc: "Paul E. McKenney"
    Cc: Andrey Ryabinin
    Cc: Luc Van Oostenryck
    Cc: Masahiro Yamada
    Cc: Daniel Axtens
    Cc: "Peter Zijlstra (Intel)"
    Link: http://lkml.kernel.org/r/20200508183230.229464-1-ndesaulniers@google.com
    Link: https://github.com/ClangBuiltLinux/linux/issues/961
    Link: https://lore.kernel.org/lkml/20200504193524.GA221287@google.com/
    Link: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers
    Signed-off-by: Linus Torvalds

    Nick Desaulniers
     

23 May, 2020

4 commits

  • Pull RISC-V fixes from Palmer Dabbelt:
    "Two fixes:

    - Another !MMU build fix that was a straggler from last week

    - A fix to use the "register" keyword for the GP global register
    variable"

    * tag 'riscv-for-linus-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
    RISC-V: gp_in_global needs register keyword
    riscv: Fix print_vm_layout build error if NOMMU

    Linus Torvalds
     
  • …git/efi/efi into efi/urgent

    Pull EFI fixes from Ard Biesheuvel:

    "- fix EFI framebuffer earlycon for wide fonts
    - avoid filling screen_info with garbage if the EFI framebuffer is not
    available
    - fix a potential host tool build error due to a symbol clash on x86
    - work around a EFI firmware bug regarding the binary format of the TPM
    final events table
    - fix a missing memory free by reworking the E820 table sizing routine to
    not do the allocation in the first place
    - add CPER parsing for firmware errors"

    Borislav Petkov
     
  • Normally, show_trace_log_lvl() scans the stack, looking for text
    addresses to print. In parallel, it unwinds the stack with
    unwind_next_frame(). If the stack address matches the pointer returned
    by unwind_get_return_address_ptr() for the current frame, the text
    address is printed normally without a question mark. Otherwise it's
    considered a breadcrumb (potentially from a previous call path) and it's
    printed with a question mark to indicate that the address is unreliable
    and typically can be ignored.

    Since the following commit:

    f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")

    ... for inactive tasks, show_trace_log_lvl() prints *only* unreliable
    addresses (prepended with '?').

    That happens because, for the first frame of an inactive task,
    unwind_get_return_address_ptr() returns the wrong return address
    pointer: one word *below* the task stack pointer. show_trace_log_lvl()
    starts scanning at the stack pointer itself, so it never finds the first
    'reliable' address, causing only guesses to being printed.

    The first frame of an inactive task isn't a normal stack frame. It's
    actually just an instance of 'struct inactive_task_frame' which is left
    behind by __switch_to_asm(). Now that this inactive frame is actually
    exposed to callers, fix unwind_get_return_address_ptr() to interpret it
    properly.

    Fixes: f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
    Reported-by: Tetsuo Handa
    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20200522135435.vbxs7umku5pyrdbk@treble

    Josh Poimboeuf
     
  • Pull arm64 fixes from Catalin Marinas:

    - Bring the PTRACE_SYSEMU semantics in line with the man page.

    - Annotate variable assignment in get_user() with the type to avoid
    sparse warnings.

    * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    arm64: Add get_user() type annotation on the !access_ok() path
    arm64: Fix PTRACE_SYSEMU semantics

    Linus Torvalds