01 Dec, 2018

3 commits

  • (commit 4ea7bdc6b5b33427bbd3f41c333e21c1825462a3 upstream)

    As documented in GCC naked functions should only use basic ASM
    syntax. The extended ASM or mixture of basic ASM and "C" code is
    not guaranteed. Currently this works because it was hard coded
    to follow and check GCC behavior for arguments and register
    placement.

    Furthermore with clang using parameters in Extended asm in a
    naked function is not supported:
    arch/arm/firmware/trusted_foundations.c:47:10: error: parameter
    references not allowed in naked functions
    : "r" (type), "r" (arg1), "r" (arg2)
    ^

    Use a regular function to be more portable. This aligns also with
    the other SMC call implementations e.g. in qcom_scm-32.c and
    bcm_kona_smc.c.

    Cc: Dmitry Osipenko
    Cc: Stephen Warren
    Cc: Thierry Reding
    Signed-off-by: Stefan Agner
    Signed-off-by: Thierry Reding
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Greg Kroah-Hartman

    Stefan Agner
     
  • (commit c1c386681bd73c4fc28eb5cc91cf8b7be9b409ba upstream)

    Use cc-options call for compiler options which are not available
    in clang. With this patch an ARMv7 multi platform kernel can be
    successfully build using clang (tested with version 5.0.1).

    Based-on-patches-by: Behan Webster

    Signed-off-by: Stefan Agner
    Signed-off-by: Russell King
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Greg Kroah-Hartman

    Stefan Agner
     
  • (commit 22905a24306c8c312c2d66da9f90d09af0414f81 upstream)

    According to GCC documentation -m(no-)thumb-interwork is
    meaningless in AAPCS configurations. Also clang does not
    support the flag:
    clang-5.0: error: unknown argument: '-mno-thumb-interwork'

    Just drop -mno-thumb-interwork in AEABI configuration.

    Signed-off-by: Stefan Agner
    Signed-off-by: Russell King
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Greg Kroah-Hartman

    Stefan Agner
     

27 Nov, 2018

10 commits

  • commit 82fba2df7f7c019627f24c5036dc99f41731d770 upstream.

    Re-enable OCTEON USB driver which is needed on older hardware
    (e.g. EdgeRouter Lite) for mass storage etc. This got accidentally
    deleted when config options were changed for OCTEON2/3 USB.

    Signed-off-by: Aaro Koskinen
    Signed-off-by: Paul Burton
    Fixes: f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more drivers")
    Patchwork: https://patchwork.linux-mips.org/patch/21077/
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org # 4.14+
    Signed-off-by: Greg Kroah-Hartman

    Aaro Koskinen
     
  • commit a0e6e0831c516860fc7f9be1db6c081fe902ebcf upstream

    modify_ldt(2) leaves the old LDT mapped after switching over to the new
    one. The old LDT gets freed and the pages can be re-used.

    Leaving the mapping in place can have security implications. The mapping is
    present in the userspace page tables and Meltdown-like attacks can read
    these freed and possibly reused pages.

    It's relatively simple to fix: unmap the old LDT and flush TLB before
    freeing the old LDT memory.

    This further allows to avoid flushing the TLB in map_ldt_struct() as the
    slot is unmapped and flushed by unmap_ldt_struct() or has never been mapped
    at all.

    [ tglx: Massaged changelog and removed the needless line breaks ]

    Fixes: f55f0501cbf6 ("x86/pti: Put the LDT in its own PGD if PTI is on")
    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Thomas Gleixner
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: dave.hansen@linux.intel.com
    Cc: luto@kernel.org
    Cc: peterz@infradead.org
    Cc: boris.ostrovsky@oracle.com
    Cc: jgross@suse.com
    Cc: bhe@redhat.com
    Cc: willy@infradead.org
    Cc: linux-mm@kvack.org
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20181026122856.66224-3-kirill.shutemov@linux.intel.com
    Signed-off-by: Sasha Levin

    Kirill A. Shutemov
     
  • commit d52888aa2753e3063a9d3a0c9f72f94aa9809c15 upstream

    On 5-level paging the LDT remap area is placed in the middle of the KASLR
    randomization region and it can overlap with the direct mapping, the
    vmalloc or the vmap area.

    The LDT mapping is per mm, so it cannot be moved into the P4D page table
    next to the CPU_ENTRY_AREA without complicating PGD table allocation for
    5-level paging.

    The 4 PGD slot gap just before the direct mapping is reserved for
    hypervisors, so it cannot be used.

    Move the direct mapping one slot deeper and use the resulting gap for the
    LDT remap area. The resulting layout is the same for 4 and 5 level paging.

    [ tglx: Massaged changelog ]

    Fixes: f55f0501cbf6 ("x86/pti: Put the LDT in its own PGD if PTI is on")
    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Andy Lutomirski
    Cc: bp@alien8.de
    Cc: hpa@zytor.com
    Cc: dave.hansen@linux.intel.com
    Cc: peterz@infradead.org
    Cc: boris.ostrovsky@oracle.com
    Cc: jgross@suse.com
    Cc: bhe@redhat.com
    Cc: willy@infradead.org
    Cc: linux-mm@kvack.org
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/20181026122856.66224-2-kirill.shutemov@linux.intel.com
    Signed-off-by: Sasha Levin

    Kirill A. Shutemov
     
  • [ Upstream commit 0bb2ae1b26e1fb7543ec7474cdd374ac4b88c4da ]

    The function perf_init_event() creates a new event and
    assignes it to a PMU. This a done in a loop over all existing
    PMUs. For each listed PMU the event init function is called
    and if this function does return any other error than -ENOENT,
    the loop is terminated the creation of the event fails.

    If the event is invalid, return -ENOENT to try other PMUs.

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Thomas Richter
     
  • [ Upstream commit a541f0ebcc08ed8bc0cc492eec9a86cb280a9f24 ]

    Fixes:
    ERROR: "__node_distance" [drivers/nvme/host/nvme-core.ko] undefined!
    make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
    make: *** [Makefile:1275: modules] Error 2
    + exit 1

    Signed-off-by: Justin M. Forbes
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Justin M. Forbes
     
  • [ Upstream commit b44b136a3773d8a9c7853f8df716bd1483613cbb ]

    According to Documentation/kbuild/makefiles.txt all build targets using
    if_changed should use FORCE as well. Add missing FORCE to make sure
    vdso targets are rebuild properly when not just immediate prerequisites
    have changed but also when build command differs.

    Reviewed-by: Philipp Rudo
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Sasha Levin

    Vasily Gorbik
     
  • [ Upstream commit b5bb425871186303e6936fa2581521bdd1964a58 ]

    Clang warns that if the default case is taken, ret will be
    uninitialized.

    ./arch/arm64/include/asm/percpu.h:196:2: warning: variable 'ret' is used
    uninitialized whenever switch default is taken
    [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
    ./arch/arm64/include/asm/percpu.h:200:9: note: uninitialized use occurs
    here
    return ret;
    ^~~
    ./arch/arm64/include/asm/percpu.h:157:19: note: initialize the variable
    'ret' to silence this warning
    unsigned long ret, loop;
    ^
    = 0

    This warning appears several times while building the erofs filesystem.
    While it's not strictly wrong, the BUILD_BUG will prevent this from
    becoming a true problem. Initialize ret to 0 in the default case right
    before the BUILD_BUG to silence all of these warnings.

    Reported-by: Prasad Sodagudi
    Signed-off-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Dennis Zhou
    Signed-off-by: Sasha Levin

    Nathan Chancellor
     
  • [ Upstream commit d2266bbfa9e3e32e3b642965088ca461bd24a94f ]

    The "pciserial" earlyprintk variant helps much on many modern x86
    platforms, but unfortunately there are still some platforms with PCI
    UART devices which have the wrong PCI class code. In that case, the
    current class code check does not allow for them to be used for logging.

    Add a sub-option "force" which overrides the class code check and thus
    the use of such device can be enforced.

    [ bp: massage formulations. ]

    Suggested-by: Borislav Petkov
    Signed-off-by: Feng Tang
    Signed-off-by: Borislav Petkov
    Cc: "H. Peter Anvin"
    Cc: "Stuart R . Anderson"
    Cc: Bjorn Helgaas
    Cc: David Rientjes
    Cc: Feng Tang
    Cc: Frederic Weisbecker
    Cc: Greg Kroah-Hartman
    Cc: H Peter Anvin
    Cc: Ingo Molnar
    Cc: Jiri Kosina
    Cc: Jonathan Corbet
    Cc: Kai-Heng Feng
    Cc: Kate Stewart
    Cc: Konrad Rzeszutek Wilk
    Cc: Peter Zijlstra
    Cc: Philippe Ombredanne
    Cc: Thomas Gleixner
    Cc: Thymo van Beers
    Cc: alan@linux.intel.com
    Cc: linux-doc@vger.kernel.org
    Link: http://lkml.kernel.org/r/20181002164921.25833-1-feng.tang@intel.com
    Signed-off-by: Sasha Levin

    Feng Tang
     
  • [ Upstream commit 7ff1e34bbdc15acab823b1ee4240e94623d50ee8 ]

    Fixes:
    arch/um/os-Linux/skas/process.c:613:1: warning: control reaches end of
    non-void function [-Wreturn-type]

    longjmp() never returns but gcc still warns that the end of the function
    can be reached.
    Add a return code and debug aid to detect this impossible case.

    Signed-off-by: Richard Weinberger
    Signed-off-by: Sasha Levin

    Richard Weinberger
     
  • [ Upstream commit 966866892cf89d606544bca22d584ba2ef9ec208 ]

    Commit 1404d6f13e47 ("arm64: dump: Add checking for writable and exectuable pages")
    has successfully identified code that leaves a page with W+X
    permissions.

    [ 3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
    [ 3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
    [ 3.246141] Modules linked in:
    [ 3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
    [ 3.247008] Hardware name: linux,dummy-virt (DT)
    [ 3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
    [ 3.247623] pc : note_page+0x410/0x420
    [ 3.247898] lr : note_page+0x410/0x420
    [ 3.248071] sp : ffff00000804bcd0
    [ 3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
    [ 3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
    [ 3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
    [ 3.249109] x23: 0000000000000004 x22: ffff000000d91000
    [ 3.249396] x21: ffff000000d90000 x20: 0000000000000000
    [ 3.249661] x19: ffff00000804bde8 x18: 0000000000000400
    [ 3.249924] x17: 0000000000000000 x16: 0000000000000000
    [ 3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
    [ 3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
    [ 3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
    [ 3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
    [ 3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
    [ 3.251802] x5 : 0000000000000000 x4 : 0000000000000000
    [ 3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
    [ 3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
    [ 3.252664] Call trace:
    [ 3.252953] note_page+0x410/0x420
    [ 3.253186] walk_pgd+0x12c/0x238
    [ 3.253417] ptdump_check_wx+0x68/0xf8
    [ 3.253637] mark_rodata_ro+0x68/0x98
    [ 3.253847] kernel_init+0x38/0x160
    [ 3.254103] ret_from_fork+0x10/0x18

    kprobes allocates a writable executable page with module_alloc() in
    order to store executable code.
    Reworked to that when allocate a page it sets mode RO. Inspired by
    commit 63fef14fc98a ("kprobes/x86: Make insn buffer always ROX and use text_poke()").

    Suggested-by: Arnd Bergmann
    Suggested-by: Ard Biesheuvel
    Acked-by: Will Deacon
    Acked-by: Masami Hiramatsu
    Reviewed-by: Laura Abbott
    Signed-off-by: Anders Roxell
    [catalin.marinas@arm.com: removed unnecessary casts]
    Signed-off-by: Catalin Marinas
    Signed-off-by: Sasha Levin

    Anders Roxell
     

23 Nov, 2018

3 commits

  • commit 1dfc65cef481ac6af64380f26186d5cc585b46eb upstream.

    The R-Car M2N hardware manual states that Tc = –40°C to +105°C. The
    thermal sensor has an accuracy of ±5°C and there can be a temperature
    difference of 1 or 2 degrees between Tjmax and the thermal sensor due
    to the location of the latter.

    This means that 95°C is a safer value to use.

    Fixes: 57f9156bc620ac56 ("ARM: dts: r8a7793: enable to use thermal-zone")
    Signed-off-by: Chris Paterson
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Simon Horman
    Signed-off-by: Greg Kroah-Hartman

    Chris Paterson
     
  • commit e4fdf59bcce3b490bbc7197145bcb9f9d5a18cd3 upstream.

    The R-Car M2W hardware manual states that Tc = –40°C to +105°C. The
    thermal sensor has an accuracy of ±5°C and there can be a temperature
    difference of 1 or 2 degrees between Tjmax and the thermal sensor due
    to the location of the latter.

    This means that 95°C is a safer value to use.

    Fixes: cac68a56e34b9810 ("ARM: dts: r8a7791: enable to use thermal-zone")
    Signed-off-by: Chris Paterson
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Simon Horman
    Signed-off-by: Greg Kroah-Hartman

    Chris Paterson
     
  • This reverts commit 8a13906ae519b3ed95cd0fb73f1098b46362f6c4 which is
    commit 53c613fe6349994f023245519265999eed75957f upstream.

    It's not ready for the stable trees as there are major slowdowns
    involved with this patch.

    Reported-by: Jiri Kosina
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Josh Poimboeuf
    Cc: Andrea Arcangeli
    Cc: "WoodhouseDavid"
    Cc: Andi Kleen
    Cc: Tim Chen
    Cc: "SchauflerCasey"
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

21 Nov, 2018

21 commits

  • commit d0ffb805b729322626639336986bc83fc2e60871 upstream.

    Alpha has had c_ispeed and c_ospeed, but still set speeds in c_cflags
    using arbitrary flags. Because BOTHER is not defined, the general
    Linux code doesn't allow setting arbitrary baud rates, and because
    CBAUDEX == 0, we can have an array overrun of the baud_rate[] table in
    drivers/tty/tty_baudrate.c if (c_cflags & CBAUD) == 037.

    Resolve both problems by #defining BOTHER to 037 on Alpha.

    However, userspace still needs to know if setting BOTHER is actually
    safe given legacy kernels (does anyone actually care about that on
    Alpha anymore?), so enable the TCGETS2/TCSETS*2 ioctls on Alpha, even
    though they use the same structure. Define struct termios2 just for
    compatibility; it is the exact same structure as struct termios. In a
    future patchset, this will be cleaned up so the uapi headers are
    usable from libc.

    Signed-off-by: H. Peter Anvin (Intel)
    Cc: Jiri Slaby
    Cc: Al Viro
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Cc: Thomas Gleixner
    Cc: Kate Stewart
    Cc: Philippe Ombredanne
    Cc: Eugene Syromiatnikov
    Cc:
    Cc:
    Cc: Johan Hovold
    Cc: Alan Cox
    Cc:
    Signed-off-by: Greg Kroah-Hartman

    H. Peter Anvin (Intel)
     
  • commit 1de72c706488b7be664a601cf3843bd01e327e58 upstream.

    Hyper-V emulation of the PIT has a quirk such that the normal PIT shutdown
    path doesn't work, because clearing the counter register restarts the
    timer.

    Disable the counter clearing on PIT shutdown.

    Signed-off-by: Michael Kelley
    Signed-off-by: Thomas Gleixner
    Cc: "gregkh@linuxfoundation.org"
    Cc: "devel@linuxdriverproject.org"
    Cc: "daniel.lezcano@linaro.org"
    Cc: "virtualization@lists.linux-foundation.org"
    Cc: "jgross@suse.com"
    Cc: "akataria@vmware.com"
    Cc: "olaf@aepfle.de"
    Cc: "apw@canonical.com"
    Cc: vkuznets
    Cc: "jasowang@redhat.com"
    Cc: "marcelo.cerri@canonical.com"
    Cc: KY Srinivasan
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/1541303219-11142-3-git-send-email-mikelley@microsoft.com
    Signed-off-by: Greg Kroah-Hartman

    Michael Kelley
     
  • commit 15035388439f892017d38b05214d3cda6578af64 upstream.

    When running function tracing on a Linux guest running on VMware
    Workstation, the guest would crash. This is due to tracing of the
    sched_clock internal call of the VMware vmware_sched_clock(), which
    causes an infinite recursion within the tracing code (clock calls must
    not be traced).

    Make vmware_sched_clock() not traced by ftrace.

    Fixes: 80e9a4f21fd7c ("x86/vmware: Add paravirt sched clock")
    Reported-by: GwanYeong Kim
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Borislav Petkov
    CC: Alok Kataria
    CC: GwanYeong Kim
    CC: "H. Peter Anvin"
    CC: Ingo Molnar
    Cc: stable@vger.kernel.org
    CC: Thomas Gleixner
    CC: virtualization@lists.linux-foundation.org
    CC: x86-ml
    Link: http://lkml.kernel.org/r/20181109152207.4d3e7d70@gandalf.local.home
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     
  • commit 6282e916f774e37845c65d1eae9f8c649004f033 upstream.

    Due to what appears to be a copy/paste error, the opening ENTRY()
    of cpu_v7_hvc_switch_mm() lacks a matching ENDPROC(), and instead,
    the one for cpu_v7_smc_switch_mm() is duplicated.

    Given that it is ENDPROC() that emits the Thumb annotation, the
    cpu_v7_hvc_switch_mm() routine will be called in ARM mode on a
    Thumb2 kernel, resulting in the following splat:

    Internal error: Oops - undefined instruction: 0 [#1] SMP THUMB2
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0-rc1-00030-g4d28ad89189d-dirty #488
    Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
    PC is at cpu_v7_hvc_switch_mm+0x12/0x18
    LR is at flush_old_exec+0x31b/0x570
    pc : [] lr : [] psr: 00000013
    sp : ee899e50 ip : 00000000 fp : 00000001
    r10: eda28f34 r9 : eda31800 r8 : c12470e0
    r7 : eda1fc00 r6 : eda53000 r5 : 00000000 r4 : ee88c000
    r3 : c0316eec r2 : 00000001 r1 : eda53000 r0 : 6da6c000
    Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none

    Note the 'ISA ARM' in the last line.

    Fix this by using the correct name in ENDPROC().

    Cc:
    Fixes: 10115105cb3a ("ARM: spectre-v2: add firmware based hardening")
    Reviewed-by: Dave Martin
    Acked-by: Marc Zyngier
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Russell King
    Signed-off-by: Greg Kroah-Hartman

    Ard Biesheuvel
     
  • commit 0676b957c24bfb6e495449ba7b7e72c5b5d79233 upstream.

    32bit UML used to define PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP
    own its own because many years ago not all libcs had these request codes
    in their UAPI.
    These days PTRACE_SYSEMU/_SINGLESTEP is well known and part of glibc
    and our own define becomes problematic.

    With change c48831d0eebf ("linux/x86: sync sys/ptrace.h with Linux 4.14
    [BZ #22433]") glibc turned PTRACE_SYSEMU/_SINGLESTEP into a enum and
    UML failed to build.

    Let's drop our define and rely on the fact that every libc has
    PTRACE_SYSEMU/_SINGLESTEP.

    Cc:
    Cc: Ritesh Raj Sarraf
    Reported-and-tested-by: Ritesh Raj Sarraf
    Signed-off-by: Richard Weinberger
    Signed-off-by: Greg Kroah-Hartman

    Richard Weinberger
     
  • commit 40dc948f234b73497c3278875eb08a01d5854d3f upstream.

    The bootloader may pass physical address of the boot parameters structure
    to the MMUv3 kernel in the register a2. Code in the _SetupMMU block in
    the arch/xtensa/kernel/head.S is supposed to map that physical address to
    the virtual address in the configured virtual memory layout.

    This code haven't been updated when additional 256+256 and 512+512
    memory layouts were introduced and it may produce wrong addresses when
    used with these layouts.

    Cc: stable@vger.kernel.org
    Signed-off-by: Max Filippov
    Signed-off-by: Greg Kroah-Hartman

    Max Filippov
     
  • commit 0773495b1f5f1c5e23551843f87b5ff37e7af8f7 upstream.

    Xtensa ABI requires stack alignment to be at least 16. In noMMU
    configuration ARCH_SLAB_MINALIGN is used to align stack. Make it at
    least 16.

    This fixes the following runtime error in noMMU configuration, caused by
    interaction between insufficiently aligned stack and alloca function,
    that results in corruption of on-stack variable in the libc function
    glob:

    Caught unhandled exception in 'sh' (pid = 47, pc = 0x02d05d65)
    - should not happen
    EXCCAUSE is 15

    Cc: stable@vger.kernel.org
    Signed-off-by: Max Filippov
    Signed-off-by: Greg Kroah-Hartman

    Max Filippov
     
  • commit 4119ba211bc4f1bf638f41e50b7a0f329f58aa16 upstream.

    This section collects all source .note.* sections together in the
    vmlinux image. Without it .note.Linux section may be placed at address
    0, while the rest of the kernel is at its normal address, resulting in a
    huge vmlinux.bin image that may not be linked into the xtensa Image.elf.

    Cc: stable@vger.kernel.org
    Signed-off-by: Max Filippov
    Signed-off-by: Greg Kroah-Hartman

    Max Filippov
     
  • [ Upstream commit 360fe725f8849aaddc53475fef5d4a0c439b05ae ]

    After commit e509bd7da149dc349160 ("genirq: Allow migration of chained
    interrupts by installing default action") Loongson-3 fails at here:

    setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction);

    This is because both chained_action and cascade_irqaction don't have
    IRQF_SHARED flag. This will cause Loongson-3 resume fails because HPET
    timer interrupt can't be delivered during S3. So we set the irqchip of
    the chained irq to loongson_irq_chip which doesn't disable the chained
    irq in CP0.Status.

    Cc: stable@vger.kernel.org
    Signed-off-by: Huacai Chen
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/20434/
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Cc: Huacai Chen
    Signed-off-by: Sasha Levin

    Huacai Chen
     
  • [ Upstream commit d06f8a2f1befb5a3d0aa660ab1c05e9b744456ea ]

    Masking/unmasking the CPU UART irq in CP0_Status (and redirecting it to
    other CPUs) may cause interrupts be lost, especially in multi-package
    machines (Package-0's UART irq cannot be delivered to others). So make
    mask_loongson_irq() and unmask_loongson_irq() be no-ops.

    The original problem (UART IRQ may deliver to any core) is also because
    of masking/unmasking the CPU UART irq in CP0_Status. So it is safe to
    remove all of the stuff.

    Signed-off-by: Huacai Chen
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/20433/
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Cc: Huacai Chen
    Signed-off-by: Sasha Levin

    Huacai Chen
     
  • [ Upstream commit 2794f688b2c336e0da85e9f91fed33febbd9f54a ]

    Call pcie_bus_configure_settings() on MIPS, like for other platforms.
    The function pcie_bus_configure_settings() makes sure the MPS (Max
    Payload Size) across the bus is uniform and provides the ability to
    tune the MRSS (Max Read Request Size) and MPS (Max Payload Size) to
    higher performance values. Some devices will not operate properly if
    these aren't set correctly because the firmware doesn't always do it.

    Signed-off-by: Huacai Chen
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/20649/
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: linux-mips@linux-mips.org
    Cc: Fuxin Zhang
    Cc: Zhangjin Wu
    Cc: Huacai Chen
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Huacai Chen
     
  • [ Upstream commit 3f7daf3d7582dc6628ac40a9045dd1bbd80c5f35 ]

    When hot-removing memory release_mem_region_adjustable() splits iomem
    resources if they are not the exact size of the memory being
    hot-deleted. Adding this memory back to the kernel adds a new resource.

    Eg a node has memory 0x0 - 0xfffffffff. Hot-removing 1GB from
    0xf40000000 results in the single resource 0x0-0xfffffffff being split
    into two resources: 0x0-0xf3fffffff and 0xf80000000-0xfffffffff.

    When we hot-add the memory back we now have three resources:
    0x0-0xf3fffffff, 0xf40000000-0xf7fffffff, and 0xf80000000-0xfffffffff.

    This is an issue if we try to remove some memory that overlaps
    resources. Eg when trying to remove 2GB at address 0xf40000000,
    release_mem_region_adjustable() fails as it expects the chunk of memory
    to be within the boundaries of a single resource. We then get the
    warning: "Unable to release resource" and attempting to use memtrace
    again gives us this error: "bash: echo: write error: Resource
    temporarily unavailable"

    This patch makes memtrace remove memory in chunks that are always the
    same size from an address that is always equal to end_of_memory -
    n*size, for some n. So hotremoving and hotadding memory of different
    sizes will now not attempt to remove memory that spans multiple
    resources.

    Signed-off-by: Rashmica Gupta
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Rashmica Gupta
     
  • [ Upstream commit ee9d21b3b3583712029a0db65a4b7c081d08d3b3 ]

    When building with clang crt0's _zimage_start is not marked weak, which
    breaks the build when linking the kernel image:

    $ objdump -t arch/powerpc/boot/crt0.o |grep _zimage_start$
    0000000000000058 g .text 0000000000000000 _zimage_start

    ld: arch/powerpc/boot/wrapper.a(crt0.o): in function '_zimage_start':
    (.text+0x58): multiple definition of '_zimage_start';
    arch/powerpc/boot/pseries-head.o:(.text+0x0): first defined here

    Clang requires the .weak directive to appear after the symbol is
    declared. The binutils manual says:

    This directive sets the weak attribute on the comma separated list of
    symbol names. If the symbols do not already exist, they will be
    created.

    So it appears this is different with clang. The only reference I could
    see for this was an OpenBSD mailing list post[1].

    Changing it to be after the declaration fixes building with Clang, and
    still works with GCC.

    $ objdump -t arch/powerpc/boot/crt0.o |grep _zimage_start$
    0000000000000058 w .text 0000000000000000 _zimage_start

    Reported to clang as https://bugs.llvm.org/show_bug.cgi?id=38921

    [1] https://groups.google.com/forum/#!topic/fa.openbsd.tech/PAgKKen2YCY

    Signed-off-by: Joel Stanley
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     
  • [ Upstream commit dc57aaf95a516f70e2d527d8287a0332c481a226 ]

    After changing CPU online status, it will not be sent any IPIs such as in
    __flush_cache_all() on software coherency systems. Do this before disabling
    local IRQ.

    Signed-off-by: Dengcheng Zhu
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/20571/
    Cc: pburton@wavecomp.com
    Cc: ralf@linux-mips.org
    Cc: linux-mips@linux-mips.org
    Cc: rachel.mozes@intel.com
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dengcheng Zhu
     
  • [ Upstream commit 803d690e68f0c5230183f1a42c7d50a41d16e380 ]

    When a process allocates a hugepage, the following leak is
    reported by kmemleak. This is a false positive which is
    due to the pointer to the table being stored in the PGD
    as physical memory address and not virtual memory pointer.

    unreferenced object 0xc30f8200 (size 512):
    comm "mmap", pid 374, jiffies 4872494 (age 627.630s)
    hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] huge_pte_alloc+0xdc/0x1f8
    [] hugetlb_fault+0x560/0x8f8
    [] follow_hugetlb_page+0x14c/0x44c
    [] __get_user_pages+0x1c4/0x3dc
    [] __mm_populate+0xac/0x140
    [] vm_mmap_pgoff+0xb4/0xb8
    [] ksys_mmap_pgoff+0xcc/0x1fc
    [] ret_from_syscall+0x0/0x38

    See commit a984506c542e2 ("powerpc/mm: Don't report PUDs as
    memory leaks when using kmemleak") for detailed explanation.

    To fix that, this patch tells kmemleak to ignore the allocated
    hugepage table.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     
  • [ Upstream commit f5e284803a7206d43e26f9ffcae5de9626d95e37 ]

    When enumerating page size definitions to check hardware support,
    we construct a constant which is (1U << (def->shift - 10)).

    However, the array of page size definitions is only initalised for
    various MMU_PAGE_* constants, so it contains a number of 0-initialised
    elements with def->shift == 0. This means we end up shifting by a
    very large number, which gives the following UBSan splat:

    ================================================================================
    UBSAN: Undefined behaviour in /home/dja/dev/linux/linux/arch/powerpc/mm/tlb_nohash.c:506:21
    shift exponent 4294967286 is too large for 32-bit type 'unsigned int'
    CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.0-rc3-00045-ga604f927b012-dirty #6
    Call Trace:
    [c00000000101bc20] [c000000000a13d54] .dump_stack+0xa8/0xec (unreliable)
    [c00000000101bcb0] [c0000000004f20a8] .ubsan_epilogue+0x18/0x64
    [c00000000101bd30] [c0000000004f2b10] .__ubsan_handle_shift_out_of_bounds+0x110/0x1a4
    [c00000000101be20] [c000000000d21760] .early_init_mmu+0x1b4/0x5a0
    [c00000000101bf10] [c000000000d1ba28] .early_setup+0x100/0x130
    [c00000000101bf90] [c000000000000528] start_here_multiplatform+0x68/0x80
    ================================================================================

    Fix this by first checking if the element exists (shift != 0) before
    constructing the constant.

    Signed-off-by: Daniel Axtens
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Daniel Axtens
     
  • [ Upstream commit 35d3cbe84544da74e39e1cec01374092467e3119 ]

    Andreas Müller reports:

    "Fixes:

    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[220]: Failed to apply ACL on /dev/v4l-subdev0: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[224]: Failed to apply ACL on /dev/v4l-subdev1: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[215]: Failed to apply ACL on /dev/v4l-subdev10: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[228]: Failed to apply ACL on /dev/v4l-subdev2: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[232]: Failed to apply ACL on /dev/v4l-subdev5: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[217]: Failed to apply ACL on /dev/v4l-subdev11: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[214]: Failed to apply ACL on /dev/dri/card1: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[216]: Failed to apply ACL on /dev/v4l-subdev8: Operation not supported
    | Sep 04 09:05:10 imx6qdl-variscite-som systemd-udevd[226]: Failed to apply ACL on /dev/v4l-subdev9: Operation not supported

    and nasty follow-ups: Starting weston from sddm as unpriviledged user fails
    with some hints on missing access rights."

    Select the CONFIG_TMPFS_POSIX_ACL option to fix these issues.

    Reported-by: Andreas Müller
    Signed-off-by: Fabio Estevam
    Acked-by: Otavio Salvador
    Signed-off-by: Shawn Guo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Fabio Estevam
     
  • [ Upstream commit f9bc28aedfb5bbd572d2d365f3095c1becd7209b ]

    If an error occurs during an unplug operation, it's possible for
    eeh_dump_dev_log() to be called when edev->pdn is null, which
    currently leads to dereferencing a null pointer.

    Handle this by skipping the error log for those devices.

    Signed-off-by: Sam Bobroff
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sam Bobroff
     
  • [ Upstream commit 0d923962ab69c27cca664a2d535e90ef655110ca ]

    When we're running on Book3S with the Radix MMU enabled the page table
    dump currently prints the wrong addresses because it uses the wrong
    start address.

    Fix it to use PAGE_OFFSET rather than KERN_VIRT_START.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Michael Ellerman
     
  • [ Upstream commit b851ba02a6f3075f0f99c60c4bc30a4af80cf428 ]

    The recent module relocation overflow crash demonstrated that we
    have no range checking on REL32 relative relocations. This patch
    implements a basic check, the same kernel that previously oopsed
    and rebooted now continues with some of these errors when loading
    the module:

    module_64: x_tables: REL32 527703503449812 out of range!

    Possibly other relocations (ADDR32, REL16, TOC16, etc.) should also have
    overflow checks.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Piggin
     
  • [ Upstream commit daf00ae71dad8aa05965713c62558aeebf2df48e ]

    commit b96672dd840f ("powerpc: Machine check interrupt is a non-
    maskable interrupt") added a call to nmi_enter() at the beginning of
    machine check restart exception handler. Due to that, in_interrupt()
    always returns true regardless of the state before entering the
    exception, and die() panics even when the system was not already in
    interrupt.

    This patch calls nmi_exit() before calling die() in order to restore
    the interrupt state we had before calling nmi_enter()

    Fixes: b96672dd840f ("powerpc: Machine check interrupt is a non-maskable interrupt")
    Signed-off-by: Christophe Leroy
    Reviewed-by: Nicholas Piggin
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     

14 Nov, 2018

3 commits

  • commit 74121b9aa3cd571ddfff014a9f47db36cae3cda9 upstream.

    Correct the register size of the System Manager node.

    Cc: stable@vger.kernel.org
    Fixes: 78cd6a9d8e154 ("arm64: dts: Add base stratix 10 dtsi")
    Signed-off-by: Thor Thayer
    Signed-off-by: Dinh Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Thor Thayer
     
  • commit ce3bf934f919a7d675c5b7fa4cc233ded9c6256e upstream.

    The address in the SDRAM node was incorrect. Fix this to agree with the
    correct address and to match the reg definition block.

    Cc: stable@vger.kernel.org
    Fixes: 54b4a8f57848b("arm: socfpga: dts: Add Arria10 SDRAM EDAC DTS support")
    Signed-off-by: Thor Thayer
    Signed-off-by: Dinh Nguyen
    Signed-off-by: Greg Kroah-Hartman

    Thor Thayer
     
  • commit 2a6c7c367de82951c98a290a21156770f6f82c84 upstream.

    x0 is not callee-saved in the PCS. So there is no need to specify
    -fcall-used-x0.

    Clang doesn't currently support -fcall-used flags. This patch will help
    building the kernel with clang.

    Tested-by: Nick Desaulniers
    Acked-by: Will Deacon
    Signed-off-by: Tri Vo
    Signed-off-by: Catalin Marinas
    Signed-off-by: Greg Kroah-Hartman

    Tri Vo