03 Mar, 2019

4 commits

  • Pull ARM SoC fixes from Arnd Bergmann:
    "One more set of simple ARM platform fixes:

    - A boot regression on qualcomm msm8998

    - Gemini display controllers got turned off by accident

    - incorrect reference counting in optee"

    * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
    tee: optee: add missing of_node_put after of_device_is_available
    arm64: dts: qcom: msm8998: Extend TZ reserved memory area
    ARM: dts: gemini: Re-enable display controller

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

    - Prevent value evaluation via functions happening in the user access
    enabled region of __put_user() (put another way: make sure to
    evaluate the value to be stored in user space _before_ enabling
    user space accesses)

    - Correct the definition of a Hyper-V hypercall constant"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/hyper-v: Fix definition of HV_MAX_FLUSH_REP_COUNT
    x86/uaccess: Don't leak the AC flag into __put_user() value evaluation

    Linus Torvalds
     
  • Pull networking fixes from David Miller:

    1) Fix refcount leak in act_ipt during replace, from Davide Caratti.

    2) Set task state properly in tun during blocking reads, from Timur
    Celik.

    3) Leaked reference in DSA, from Wen Yang.

    4) NULL deref in act_tunnel_key, from Vlad Buslov.

    5) cipso_v4_erro can reference the skb IPCB in inappropriate contexts
    thus referencing garbage, from Nazarov Sergey.

    6) Don't accept RTA_VIA and RTA_GATEWAY in contexts where those
    attributes make no sense.

    7) Fix hung sendto in tipc, from Tung Nguyen.

    8) Out-of-bounds access in netlabel, from Paul Moore.

    9) Grant reference leak in xen-netback, from Igor Druzhinin.

    10) Fix tx stalls with lan743x, from Bryan Whitehead.

    11) Fix interrupt storm with mv88e6xxx, from Hein Kallweit.

    12) Memory leak in sit on device registry failure, from Mao Wenan.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits)
    net: sit: fix memory leak in sit_init_net()
    net: dsa: mv88e6xxx: Fix statistics on mv88e6161
    geneve: correctly handle ipv6.disable module parameter
    net: dsa: mv88e6xxx: prevent interrupt storm caused by mv88e6390x_port_set_cmode
    bpf: fix sanitation rewrite in case of non-pointers
    ipv4: Add ICMPv6 support when parse route ipproto
    MIPS: eBPF: Fix icache flush end address
    lan743x: Fix TX Stall Issue
    net: phy: phylink: fix uninitialized variable in phylink_get_mac_state
    net: aquantia: regression on cpus with high cores: set mode with 8 queues
    selftests: fixes for UDP GRO
    bpf: drop refcount if bpf_map_new_fd() fails in map_create()
    net: dsa: mv88e6xxx: power serdes on/off for 10G interfaces on 6390X
    net: dsa: mv88e6xxx: Fix u64 statistics
    xen-netback: don't populate the hash cache on XenBus disconnect
    xen-netback: fix occasional leak of grant ref mappings under memory pressure
    sctp: chunk.c: correct format string for size_t in printk
    net: netem: fix skb length BUG_ON in __skb_to_sgvec
    netlabel: fix out-of-bounds memory accesses
    ipv4: Pass original device to ip_rcv_finish_core
    ...

    Linus Torvalds
     
  • Pull more crypto fixes from Herbert Xu:
    "This fixes a couple of issues in arm64/chacha that was introduced in
    5.0"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: arm64/chacha - fix hchacha_block_neon() for big endian
    crypto: arm64/chacha - fix chacha_4block_xor_neon() for big endian

    Linus Torvalds
     

02 Mar, 2019

1 commit

  • The MIPS eBPF JIT calls flush_icache_range() in order to ensure the
    icache observes the code that we just wrote. Unfortunately it gets the
    end address calculation wrong due to some bad pointer arithmetic.

    The struct jit_ctx target field is of type pointer to u32, and as such
    adding one to it will increment the address being pointed to by 4 bytes.
    Therefore in order to find the address of the end of the code we simply
    need to add the number of 4 byte instructions emitted, but we mistakenly
    add the number of instructions multiplied by 4. This results in the call
    to flush_icache_range() operating on a memory region 4x larger than
    intended, which is always wasteful and can cause crashes if we overrun
    into an unmapped page.

    Fix this by correcting the pointer arithmetic to remove the bogus
    multiplication, and use braces to remove the need for a set of brackets
    whilst also making it obvious that the target field is a pointer.

    Signed-off-by: Paul Burton
    Fixes: b6bd53f9c4e8 ("MIPS: Add missing file for eBPF JIT.")
    Cc: Alexei Starovoitov
    Cc: Daniel Borkmann
    Cc: Martin KaFai Lau
    Cc: Song Liu
    Cc: Yonghong Song
    Cc: netdev@vger.kernel.org
    Cc: bpf@vger.kernel.org
    Cc: linux-mips@vger.kernel.org
    Cc: stable@vger.kernel.org # v4.13+
    Signed-off-by: Daniel Borkmann

    Paul Burton
     

01 Mar, 2019

3 commits

  • …git/agross/linux into arm/fixes

    Qualcomm ARM64 Fixes for 5.0-rc8

    * Fix TZ memory area size to avoid crashes during boot

    * tag 'qcom-fixes-for-5.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux:
    arm64: dts: qcom: msm8998: Extend TZ reserved memory area

    Arnd Bergmann
     
  • Pull MIPS fixes from Paul Burton:
    "A few more MIPS fixes:

    - Fix 16b cmpxchg() operations which could erroneously fail if bits
    15:8 of the old value are non-zero. In practice I'm not aware of
    any actual users of 16b cmpxchg() on MIPS, but this fixes the
    support for it was was introduced in v4.13.

    - Provide a struct device to dma_alloc_coherent for Lantiq XWAY
    systems with a "Voice MIPS Macro Core" (VMMC) device.

    - Provide DMA masks for BCM63xx ethernet devices, fixing a regression
    introduced in v4.19.

    - Fix memblock reservation for the kernel when the system has a
    non-zero PHYS_OFFSET, correcting the memblock conversion performed
    in v4.20"

    * tag 'mips_fixes_5.0_4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
    MIPS: fix memory setup for platforms with PHYS_OFFSET != 0
    MIPS: BCM63XX: provide DMA masks for ethernet devices
    MIPS: lantiq: pass struct device to DMA API functions
    MIPS: fix truncation in __cmpxchg_small for short values

    Linus Torvalds
     
  • Pull crypto fixes from Herbert Xu:
    "This fixes a compiler warning introduced by a previous fix, as well as
    two crash bugs on ARM"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: sha512/arm - fix crash bug in Thumb2 build
    crypto: sha256/arm - fix crash bug in Thumb2 build
    crypto: ccree - add missing inline qualifier

    Linus Torvalds
     

28 Feb, 2019

4 commits

  • The max flush rep count of HvFlushGuestPhysicalAddressList hypercall is
    equal with how many entries of union hv_gpa_page_range can be populated
    into the input parameter page.

    The code lacks parenthesis around PAGE_SIZE - 2 * sizeof(u64) which results
    in bogus computations. Add them.

    Fixes: cc4edae4b924 ("x86/hyper-v: Add HvFlushGuestAddressList hypercall support")
    Signed-off-by: Lan Tianyu
    Signed-off-by: Thomas Gleixner
    Cc: kys@microsoft.com
    Cc: haiyangz@microsoft.com
    Cc: sthemmin@microsoft.com
    Cc: sashal@kernel.org
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: gregkh@linuxfoundation.org
    Cc: devel@linuxdriverproject.org
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190225143114.5149-1-Tianyu.Lan@microsoft.com

    Lan Tianyu
     
  • On big endian arm64 kernels, the xchacha20-neon and xchacha12-neon
    self-tests fail because hchacha_block_neon() outputs little endian words
    but the C code expects native endianness. Fix it to output the words in
    native endianness (which also makes it match the arm32 version).

    Fixes: cc7cf991e9eb ("crypto: arm64/chacha20 - add XChaCha20 support")
    Signed-off-by: Eric Biggers
    Reviewed-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Eric Biggers
     
  • The change to encrypt a fifth ChaCha block using scalar instructions
    caused the chacha20-neon, xchacha20-neon, and xchacha12-neon self-tests
    to start failing on big endian arm64 kernels. The bug is that the
    keystream block produced in 32-bit scalar registers is directly XOR'd
    with the data words, which are loaded and stored in native endianness.
    Thus in big endian mode the data bytes end up XOR'd with the wrong
    bytes. Fix it by byte-swapping the keystream words in big endian mode.

    Fixes: 2fe55987b262 ("crypto: arm64/chacha - use combined SIMD/ALU routine for more speed")
    Signed-off-by: Eric Biggers
    Reviewed-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Eric Biggers
     
  • For platforms, which use a PHYS_OFFSET != 0, symbol _end also
    contains that offset. So when calling memblock_reserve() for
    reserving kernel the size argument needs to be adjusted.

    Fixes: bcec54bf3118 ("mips: switch to NO_BOOTMEM")
    Acked-by: Mike Rapoport
    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Paul Burton
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: linux-mips@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Mike Rapoport
    Cc: stable@vger.kernel.org # v4.20+

    Thomas Bogendoerfer
     

27 Feb, 2019

1 commit

  • My console locks up as soon as Linux writes to [88800000,88f00000[
    AFAIU, that memory area is reserved for trustzone.

    Extend TZ reserved memory range, to prevent Linux from stepping on
    trustzone's toes.

    Cc: stable@vger.kernel.org # 4.20+
    Reviewed-by: Sibi Sankar
    Fixes: c7833949564ec ("arm64: dts: qcom: msm8998: Add smem related nodes")
    Signed-off-by: Marc Gonzalez
    Signed-off-by: Andy Gross

    Marc Gonzalez
     

26 Feb, 2019

3 commits

  • The switch to the generic dma ops made dma masks mandatory, breaking
    devices having them not set. In case of bcm63xx, it broke ethernet with
    the following warning when trying to up the device:

    [ 2.633123] ------------[ cut here ]------------
    [ 2.637949] WARNING: CPU: 0 PID: 325 at ./include/linux/dma-mapping.h:516 bcm_enetsw_open+0x160/0xbbc
    [ 2.647423] Modules linked in: gpio_button_hotplug
    [ 2.652361] CPU: 0 PID: 325 Comm: ip Not tainted 4.19.16 #0
    [ 2.658080] Stack : 80520000 804cd3ec 00000000 00000000 804ccc00 87085bdc 87d3f9d4 804f9a17
    [ 2.666707] 8049cf18 00000145 80a942a0 00000204 80ac0000 10008400 87085b90 eb3d5ab7
    [ 2.675325] 00000000 00000000 80ac0000 000022b0 00000000 00000000 00000007 00000000
    [ 2.683954] 0000007a 80500000 0013b381 00000000 80000000 00000000 804a1664 80289878
    [ 2.692572] 00000009 00000204 80ac0000 00000200 00000002 00000000 00000000 80a90000
    [ 2.701191] ...
    [ 2.703701] Call Trace:
    [ 2.706244] [] show_stack+0x58/0x100
    [ 2.710840] [] __warn+0xe4/0x118
    [ 2.715049] [] warn_slowpath_null+0x48/0x64
    [ 2.720237] [] bcm_enetsw_open+0x160/0xbbc
    [ 2.725347] [] __dev_open+0xf8/0x16c
    [ 2.729913] [] __dev_change_flags+0x100/0x1c4
    [ 2.735290] [] dev_change_flags+0x28/0x70
    [ 2.740326] [] devinet_ioctl+0x310/0x7b0
    [ 2.745250] [] inet_ioctl+0x1f8/0x224
    [ 2.749939] [] sock_ioctl+0x30c/0x488
    [ 2.754632] [] do_vfs_ioctl+0x740/0x7dc
    [ 2.759459] [] ksys_ioctl+0x50/0x94
    [ 2.763955] [] syscall_common+0x34/0x58
    [ 2.768782] ---[ end trace fb1a6b14d74e28b6 ]---
    [ 2.773544] bcm63xx_enetsw bcm63xx_enetsw.0: cannot allocate rx ring 512

    Fix this by adding appropriate DMA masks for the platform devices.

    Fixes: f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
    Signed-off-by: Jonas Gorski
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Florian Fainelli
    Signed-off-by: Paul Burton
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: stable@vger.kernel.org # v4.19+

    Jonas Gorski
     
  • When calling __put_user(foo(), ptr), the __put_user() macro would call
    foo() in between __uaccess_begin() and __uaccess_end(). If that code
    were buggy, then those bugs would be run without SMAP protection.

    Fortunately, there seem to be few instances of the problem in the
    kernel. Nevertheless, __put_user() should be fixed to avoid doing this.
    Therefore, evaluate __put_user()'s argument before setting AC.

    This issue was noticed when an objtool hack by Peter Zijlstra complained
    about genregs_get() and I compared the assembly output to the C source.

    [ bp: Massage commit message and fixed up whitespace. ]

    Fixes: 11f1a4b9755f ("x86: reorganize SMAP handling in user space accesses")
    Signed-off-by: Andy Lutomirski
    Signed-off-by: Borislav Petkov
    Acked-by: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Brian Gerst
    Cc: Josh Poimboeuf
    Cc: Denys Vlasenko
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20190225125231.845656645@infradead.org

    Andy Lutomirski
     
  • This reverts commit 9da3f2b74054406f87dff7101a569217ffceb29b.

    It was well-intentioned, but wrong. Overriding the exception tables for
    instructions for random reasons is just wrong, and that is what the new
    code did.

    It caused problems for tracing, and it caused problems for strncpy_from_user(),
    because the new checks made perfectly valid use cases break, rather than
    catch things that did bad things.

    Unchecked user space accesses are a problem, but that's not a reason to
    add invalid checks that then people have to work around with silly flags
    (in this case, that 'kernel_uaccess_faults_ok' flag, which is just an
    odd way to say "this commit was wrong" and was sprinked into random
    places to hide the wrongness).

    The real fix to unchecked user space accesses is to get rid of the
    special "let's not check __get_user() and __put_user() at all" logic.
    Make __{get|put}_user() be just aliases to the regular {get|put}_user()
    functions, and make it impossible to access user space without having
    the proper checks in places.

    The raison d'être of the special double-underscore versions used to be
    that the range check was expensive, and if you did multiple user
    accesses, you'd do the range check up front (like the signal frame
    handling code, for example). But SMAP (on x86) and PAN (on ARM) have
    made that optimization pointless, because the _real_ expense is the "set
    CPU flag to allow user space access".

    Do let's not break the valid cases to catch invalid cases that shouldn't
    even exist.

    Cc: Thomas Gleixner
    Cc: Kees Cook
    Cc: Tobin C. Harding
    Cc: Borislav Petkov
    Cc: Peter Zijlstra
    Cc: Andy Lutomirski
    Cc: Jann Horn
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

25 Feb, 2019

2 commits

  • commit 137cd7100ec6fa36d610e106df00acb4d8af99df
    "ARM: dts: Enable Gemini flash access" contained a bug
    by disabling the display controller, while the whole
    idea with the patch was to enable flash access AND
    the display controller, simultaneously. Fix it up.

    Fixes: 137cd7100ec6 ("ARM: dts: Enable Gemini flash access")
    Signed-off-by: Linus Walleij
    Signed-off-by: Arnd Bergmann

    Linus Walleij
     
  • Pull KVM fixes from Paolo Bonzini:
    "Bug fixes"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    KVM: MMU: record maximum physical address width in kvm_mmu_extended_role
    kvm: x86: Return LA57 feature based on hardware capability
    x86/kvm/mmu: fix switch between root and guest MMUs
    s390: vsie: Use effective CRYCBD.31 to check CRYCBD validity

    Linus Torvalds
     

24 Feb, 2019

1 commit


23 Feb, 2019

7 commits

  • Pull ARM SoC fixes from Arnd Bergmann:
    "Only a handful of device tree fixes, all simple enough:

    NVIDIA Tegra:
    - Fix a regression for booting on chromebooks

    TI OMAP:
    - Two fixes PHY mode on am335x reference boards

    Marvell mvebu:
    - A regression fix for Armada XP NAND flash controllers
    - An incorrect reset signal on the clearfog board"

    * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
    ARM: tegra: Restore DT ABI on Tegra124 Chromebooks
    ARM: dts: am335x-evm: Fix PHY mode for ethernet
    ARM: dts: am335x-evmsk: Fix PHY mode for ethernet
    arm64: dts: clearfog-gt-8k: fix SGMII PHY reset signal
    ARM: dts: armada-xp: fix Armada XP boards NAND description

    Linus Torvalds
     
  • Pull ARC fixes from Vineet Gupta:
    "Fixes for ARC for 5.0, bunch of those are stable fodder anyways so
    sooner the better.

    - Fix memcpy to prevent prefetchw beyond end of buffer [Eugeniy]

    - Enable unaligned access early to prevent exceptions given newer gcc
    code gen [Eugeniy]

    - Tighten up uboot arg checking to prevent false negatives and also
    allow both jtag and bootloading to coexist w/o config option as
    needed by kernelCi folks [Eugeniy]

    - Set slab alignment to 8 for ARC to avoid the atomic64_t unalign
    [Alexey]

    - Disable regfile auto save on interrupts on HSDK platform due to a
    silicon issue [Vineet]

    - Avoid HS38x boot printing crash by not reading HS48x only reg
    [Vineet]"

    * tag 'arc-5.0-final' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
    ARCv2: don't assume core 0x54 has dual issue
    ARC: define ARCH_SLAB_MINALIGN = 8
    ARC: enable uboot support unconditionally
    ARC: U-boot: check arguments paranoidly
    ARCv2: support manual regfile save on interrupts
    ARC: uacces: remove lp_start, lp_end from clobber list
    ARC: fix actionpoints configuration detection
    ARCv2: lib: memcpy: fix doing prefetchw outside of buffer
    ARCv2: Enable unaligned access in early ASM code

    Linus Torvalds
     
  • Pull parisc fixes from Helge Deller:
    "Fix ptrace syscall number modification which has been broken since
    kernel v4.5 and provide alternative email addresses for the remaining
    users of the retired parisc-linux.org email domain"

    * 'parisc-5.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    CREDITS/MAINTAINERS: Retire parisc-linux.org email domain
    parisc: Fix ptrace syscall number modification

    Linus Torvalds
     
  • …/masahiroy/linux-kbuild

    Pull more Kbuild fixes from Masahiro Yamada:

    - fix scripts/kallsyms.c to correctly check too long symbol names

    - fix sh build error for the combination of CONFIG_OF_EARLY_FLATTREE=y
    and CONFIG_USE_BUILTIN_DTB=n

    * tag 'kbuild-fixes-v5.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    sh: fix build error for invisible CONFIG_BUILTIN_DTB_SOURCE
    kallsyms: Handle too long symbols in kallsyms.c

    Linus Torvalds
     
  • Previously, commit 7dcd57552008 ("x86/kvm/mmu: check if tdp/shadow
    MMU reconfiguration is needed") offered some optimization to avoid
    the unnecessary reconfiguration. Yet one scenario is broken - when
    cpuid changes VM's maximum physical address width, reconfiguration
    is needed to reset the reserved bits. Also, the TDP may need to
    reset its shadow_root_level when this value is changed.

    To fix this, a new field, maxphyaddr, is introduced in the extended
    role structure to keep track of the configured guest physical address
    width.

    Signed-off-by: Yu Zhang
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    Yu Zhang
     
  • Previously, 'commit 372fddf70904 ("x86/mm: Introduce the 'no5lvl' kernel
    parameter")' cleared X86_FEATURE_LA57 in boot_cpu_data, if Linux chooses
    to not run in 5-level paging mode. Yet boot_cpu_data is queried by
    do_cpuid_ent() as the host capability later when creating vcpus, and Qemu
    will not be able to detect this feature and create VMs with LA57 feature.

    As discussed earlier, VMs can still benefit from extended linear address
    width, e.g. to enhance features like ASLR. So we would like to fix this,
    by return the true hardware capability when Qemu queries.

    Signed-off-by: Yu Zhang
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    Yu Zhang
     
  • Commit 14c07ad89f4d ("x86/kvm/mmu: introduce guest_mmu") brought one subtle
    change: previously, when switching back from L2 to L1, we were resetting
    MMU hooks (like mmu->get_cr3()) in kvm_init_mmu() called from
    nested_vmx_load_cr3() and now we do that in nested_ept_uninit_mmu_context()
    when we re-target vcpu->arch.mmu pointer.
    The change itself looks logical: if nested_ept_init_mmu_context() changes
    something than nested_ept_uninit_mmu_context() restores it back. There is,
    however, one thing: the following call chain:

    nested_vmx_load_cr3()
    kvm_mmu_new_cr3()
    __kvm_mmu_new_cr3()
    fast_cr3_switch()
    cached_root_available()

    now happens with MMU hooks pointing to the new MMU (root MMU in our case)
    while previously it was happening with the old one. cached_root_available()
    tries to stash current root but it is incorrect to read current CR3 with
    mmu->get_cr3(), we need to use old_mmu->get_cr3() which in case we're
    switching from L2 to L1 is guest_mmu. (BTW, in shadow page tables case this
    is a non-issue because we don't switch MMU).

    While we could've tried to guess that we're switching between MMUs and call
    the right ->get_cr3() from cached_root_available() this seems to be overly
    complicated. Instead, just stash the corresponding CR3 when setting
    root_hpa and make cached_root_available() use the stashed value.

    Fixes: 14c07ad89f4d ("x86/kvm/mmu: introduce guest_mmu")
    Signed-off-by: Vitaly Kuznetsov
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini

    Vitaly Kuznetsov
     

22 Feb, 2019

14 commits

  • mvebu fixes for 5.0 (part 2)

    Fix PHY reset signal on clearfog gt 8K (Armada 8040 based)
    Fix NAND description on Armada XP boards which was broken since a few
    release

    * tag 'mvebu-fixes-5.0-2' of git://git.infradead.org/linux-mvebu:
    arm64: dts: clearfog-gt-8k: fix SGMII PHY reset signal
    ARM: dts: armada-xp: fix Armada XP boards NAND description

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • …/kernel/git/tmlind/linux-omap into arm/fixes

    Two am335x ethernet phy mode fixes for v5.0-rc cycle

    Recent changes with commit cd28d1d6e52e: ("net: phy: at803x: Disable phy
    delay for RGMII mode") broke Ethernet on am335x-evmsk, and turns out some
    device driver fixes are needed.

    Even without the driver fixes, am335x needs to run in rgmii-id mode instead
    rgmii-txid mode. Things have been working based on luck as the broken driver
    has been configuring rgmii-id mode. Let's fix that as that way things work
    as they're supposed to work from hardware wiring point of view.

    * tag 'omap-for-v5.0/fixes-rc7-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
    ARM: dts: am335x-evm: Fix PHY mode for ethernet
    ARM: dts: am335x-evmsk: Fix PHY mode for ethernet

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     
  • The SHA512 code we adopted from the OpenSSL project uses a rather
    peculiar way to take the address of the round constant table: it
    takes the address of the sha256_block_data_order() routine, and
    substracts a constant known quantity to arrive at the base of the
    table, which is emitted by the same assembler code right before
    the routine's entry point.

    However, recent versions of binutils have helpfully changed the
    behavior of references emitted via an ADR instruction when running
    in Thumb2 mode: it now takes the Thumb execution mode bit into
    account, which is bit 0 af the address. This means the produced
    table address also has bit 0 set, and so we end up with an address
    value pointing 1 byte past the start of the table, which results
    in crashes such as

    Unable to handle kernel paging request at virtual address bf825000
    pgd = 42f44b11
    [bf825000] *pgd=80000040206003, *pmd=5f1bd003, *pte=00000000
    Internal error: Oops: 207 [#1] PREEMPT SMP THUMB2
    Modules linked in: sha256_arm(+) sha1_arm_ce sha1_arm ...
    CPU: 7 PID: 396 Comm: cryptomgr_test Not tainted 5.0.0-rc6+ #144
    Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
    PC is at sha256_block_data_order+0xaaa/0xb30 [sha256_arm]
    LR is at __this_module+0x17fd/0xffffe800 [sha256_arm]
    pc : [] lr : [] psr: 800b0033
    sp : ebc8bbe8 ip : faaabe1c fp : 2fdd3433
    r10: 4c5f1692 r9 : e43037df r8 : b04b0a5a
    r7 : c369d722 r6 : 39c3693e r5 : 7a013189 r4 : 1580d26b
    r3 : 8762a9b0 r2 : eea9c2cd r1 : 3e9ab536 r0 : 1dea4ae7
    Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
    Control: 70c5383d Table: 6b8467c0 DAC: dbadc0de
    Process cryptomgr_test (pid: 396, stack limit = 0x69e1fe23)
    Stack: (0xebc8bbe8 to 0xebc8c000)
    ...
    unwind: Unknown symbol address bf820bca
    unwind: Index not found bf820bca
    Code: 441a ea80 40f9 440a (f85e) 3b04
    ---[ end trace e560cce92700ef8a ]---

    Given that this affects older kernels as well, in case they are built
    with a recent toolchain, apply a minimal backportable fix, which is
    to emit another non-code label at the start of the routine, and
    reference that instead. (This is similar to the current upstream state
    of this file in OpenSSL)

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     
  • The SHA256 code we adopted from the OpenSSL project uses a rather
    peculiar way to take the address of the round constant table: it
    takes the address of the sha256_block_data_order() routine, and
    substracts a constant known quantity to arrive at the base of the
    table, which is emitted by the same assembler code right before
    the routine's entry point.

    However, recent versions of binutils have helpfully changed the
    behavior of references emitted via an ADR instruction when running
    in Thumb2 mode: it now takes the Thumb execution mode bit into
    account, which is bit 0 af the address. This means the produced
    table address also has bit 0 set, and so we end up with an address
    value pointing 1 byte past the start of the table, which results
    in crashes such as

    Unable to handle kernel paging request at virtual address bf825000
    pgd = 42f44b11
    [bf825000] *pgd=80000040206003, *pmd=5f1bd003, *pte=00000000
    Internal error: Oops: 207 [#1] PREEMPT SMP THUMB2
    Modules linked in: sha256_arm(+) sha1_arm_ce sha1_arm ...
    CPU: 7 PID: 396 Comm: cryptomgr_test Not tainted 5.0.0-rc6+ #144
    Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
    PC is at sha256_block_data_order+0xaaa/0xb30 [sha256_arm]
    LR is at __this_module+0x17fd/0xffffe800 [sha256_arm]
    pc : [] lr : [] psr: 800b0033
    sp : ebc8bbe8 ip : faaabe1c fp : 2fdd3433
    r10: 4c5f1692 r9 : e43037df r8 : b04b0a5a
    r7 : c369d722 r6 : 39c3693e r5 : 7a013189 r4 : 1580d26b
    r3 : 8762a9b0 r2 : eea9c2cd r1 : 3e9ab536 r0 : 1dea4ae7
    Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
    Control: 70c5383d Table: 6b8467c0 DAC: dbadc0de
    Process cryptomgr_test (pid: 396, stack limit = 0x69e1fe23)
    Stack: (0xebc8bbe8 to 0xebc8c000)
    ...
    unwind: Unknown symbol address bf820bca
    unwind: Index not found bf820bca
    Code: 441a ea80 40f9 440a (f85e) 3b04
    ---[ end trace e560cce92700ef8a ]---

    Given that this affects older kernels as well, in case they are built
    with a recent toolchain, apply a minimal backportable fix, which is
    to emit another non-code label at the start of the routine, and
    reference that instead. (This is similar to the current upstream state
    of this file in OpenSSL)

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     
  • The first release of core4 (0x54) was dual issue only (HS4x).
    Newer releases allow hardware to be configured as single issue (HS3x)
    or dual issue.

    Prevent accessing a HS4x only aux register in HS3x, which otherwise
    leads to illegal instruction exceptions

    Signed-off-by: Vineet Gupta

    Vineet Gupta
     
  • Commit 910cd32e552e ("parisc: Fix and enable seccomp filter support")
    introduced a regression in ptrace-based syscall tampering: when tracer
    changes syscall number to -1, the kernel fails to initialize %r28 with
    -ENOSYS and subsequently fails to return the error code of the failed
    syscall to userspace.

    This erroneous behaviour could be observed with a simple strace syscall
    fault injection command which is expected to print something like this:

    $ strace -a0 -ewrite -einject=write:error=enospc echo hello
    write(1, "hello\n", 6) = -1 ENOSPC (No space left on device) (INJECTED)
    write(2, "echo: ", 6) = -1 ENOSPC (No space left on device) (INJECTED)
    write(2, "write error", 11) = -1 ENOSPC (No space left on device) (INJECTED)
    write(2, "\n", 1) = -1 ENOSPC (No space left on device) (INJECTED)
    +++ exited with 1 +++

    After commit 910cd32e552ea09caa89cdbe328e468979b030dd it loops printing
    something like this instead:

    write(1, "hello\n", 6../strace: Failed to tamper with process 12345: unexpectedly got no error (return value 0, error 0)
    ) = 0 (INJECTED)

    This bug was found by strace test suite.

    Fixes: 910cd32e552e ("parisc: Fix and enable seccomp filter support")
    Cc: stable@vger.kernel.org # v4.5+
    Signed-off-by: Dmitry V. Levin
    Tested-by: Helge Deller
    Signed-off-by: Helge Deller

    Dmitry V. Levin
     
  • The default value of ARCH_SLAB_MINALIGN in "include/linux/slab.h" is
    "__alignof__(unsigned long long)" which for ARC unexpectedly turns out
    to be 4. This is not a compiler bug, but as defined by ARC ABI [1]

    Thus slab allocator would allocate a struct which is 32-bit aligned,
    which is generally OK even if struct has long long members.
    There was however potetial problem when it had any atomic64_t which
    use LLOCKD/SCONDD instructions which are required by ISA to take
    64-bit addresses. This is the problem we ran into

    [ 4.015732] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [ 4.167881] Misaligned Access
    [ 4.172356] Path: /bin/busybox.nosuid
    [ 4.176004] CPU: 2 PID: 171 Comm: rm Not tainted 4.19.14-yocto-standard #1
    [ 4.182851]
    [ 4.182851] [ECR ]: 0x000d0000 => Check Programmer's Manual
    [ 4.190061] [EFA ]: 0xbeaec3fc
    [ 4.190061] [BLINK ]: ext4_delete_entry+0x210/0x234
    [ 4.190061] [ERET ]: ext4_delete_entry+0x13e/0x234
    [ 4.202985] [STAT32]: 0x80080002 : IE K
    [ 4.207236] BTA: 0x9009329c SP: 0xbe5b1ec4 FP: 0x00000000
    [ 4.212790] LPS: 0x9074b118 LPE: 0x9074b120 LPC: 0x00000000
    [ 4.218348] r00: 0x00000040 r01: 0x00000021 r02: 0x00000001
    ...
    ...
    [ 4.270510] Stack Trace:
    [ 4.274510] ext4_delete_entry+0x13e/0x234
    [ 4.278695] ext4_rmdir+0xe0/0x238
    [ 4.282187] vfs_rmdir+0x50/0xf0
    [ 4.285492] do_rmdir+0x9e/0x154
    [ 4.288802] EV_Trap+0x110/0x114

    The fix is to make sure slab allocations are 64-bit aligned.

    Do note that atomic64_t is __attribute__((aligned(8)) which means gcc
    does generate 64-bit aligned references, relative to beginning of
    container struct. However the issue is if the container itself is not
    64-bit aligned, atomic64_t ends up unaligned which is what this patch
    ensures.

    [1] https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/wiki/files/ARCv2_ABI.pdf

    Signed-off-by: Alexey Brodkin
    Cc: # 4.8+
    Signed-off-by: Vineet Gupta
    [vgupta: reworked changelog, added dependency on LL64+LLSC]

    Alexey Brodkin
     
  • After reworking U-boot args handling code and adding paranoid
    arguments check we can eliminate CONFIG_ARC_UBOOT_SUPPORT and
    enable uboot support unconditionally.

    For JTAG case we can assume that core registers will come up
    reset value of 0 or in worst case we rely on user passing
    '-on=clear_regs' to Metaware debugger.

    Cc: stable@vger.kernel.org
    Tested-by: Corentin LABBE
    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Vineet Gupta

    Eugeniy Paltsev
     
  • Handle U-boot arguments paranoidly:
    * don't allow to pass unknown tag.
    * try to use external device tree blob only if corresponding tag
    (TAG_DTB) is set.
    * don't check uboot_tag if kernel build with no ARC_UBOOT_SUPPORT.

    NOTE:
    If U-boot args are invalid we skip them and try to use embedded device
    tree blob. We can't panic on invalid U-boot args as we really pass
    invalid args due to bug in U-boot code.
    This happens if we don't provide external DTB to U-boot and
    don't set 'bootargs' U-boot environment variable (which is default
    case at least for HSDK board) In that case we will pass
    {r0 = 1 (bootargs in r2); r1 = 0; r2 = 0;} to linux which is invalid.

    While I'm at it refactor U-boot arguments handling code.

    Cc: stable@vger.kernel.org
    Tested-by: Corentin LABBE
    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Vineet Gupta

    Eugeniy Paltsev
     
  • There's a hardware bug which affects the HSDK platform, triggered by
    micro-ops for auto-saving regfile on taken interrupt. The workaround is
    to inhibit autosave.

    Signed-off-by: Vineet Gupta

    Vineet Gupta
     
  • Newer ARC gcc handles lp_start, lp_end in a different way and doesn't
    like them in the clobber list.

    Signed-off-by: Vineet Gupta

    Vineet Gupta
     
  • Fix reversed logic while actionpoints configuration (full/min)
    detection.

    Fixies: 7dd380c338f1e ("ARC: boot log: print Action point details")
    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Vineet Gupta

    Eugeniy Paltsev
     
  • ARCv2 optimized memcpy uses PREFETCHW instruction for prefetching the
    next cache line but doesn't ensure that the line is not past the end of
    the buffer. PRETECHW changes the line ownership and marks it dirty,
    which can cause data corruption if this area is used for DMA IO.

    Fix the issue by avoiding the PREFETCHW. This leads to performance
    degradation but it is OK as we'll introduce new memcpy implementation
    optimized for unaligned memory access using.

    We also cut off all PREFETCH instructions at they are quite useless
    here:
    * we call PREFETCH right before LOAD instruction call.
    * we copy 16 or 32 bytes of data (depending on CONFIG_ARC_HAS_LL64)
    in a main logical loop. so we call PREFETCH 4 times (or 2 times)
    for each L1 cache line (in case of 64B L1 cache Line which is
    default case). Obviously this is not optimal.

    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Vineet Gupta

    Eugeniy Paltsev
     
  • It is currently done in arc_init_IRQ() which might be too late
    considering gcc 7.3.1 onwards (GNU 2018.03) generates unaligned
    memory accesses by default

    Cc: stable@vger.kernel.org #4.4+
    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Vineet Gupta
    [vgupta: rewrote changelog]

    Eugeniy Paltsev