Skip to content
  1. Dec 09, 2017
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · d90696ed
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       "One notable fix for kexec on Power9, where we were not clearing MMU
        PID properly which sometimes leads to hangs. Finally debugged to a
        root cause by Nick.
      
        A revert of a patch which tried to rework our panic handling to get
        more output on the console, but inadvertently broke reporting the
        panic to the hypervisor, which apparently people care about.
      
        Then a fix for an oops in the PMU code, and finally some s/%p/%px/ in
        xmon.
      
        Thanks to: David Gibson, Nicholas Piggin, Ravi Bangoria"
      
      * tag 'powerpc-4.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/xmon: Don't print hashed pointers in xmon
        powerpc/64s: Initialize ISAv3 MMU registers before setting partition table
        Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"
        powerpc/perf: Fix oops when grouping different pmu events
      d90696ed
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · c6b3e969
      Linus Torvalds authored
      Pull s390 fixes from Martin Schwidefsky:
      
       - three more patches in regard to the SPDX license tags. The missing
         tags for the files in arch/s390/kvm will be merged via the KVM tree.
         With that all s390 related files should have their SPDX tags.
      
       - a patch to get rid of 'struct timespec' in the DASD driver.
      
       - bug fixes
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390: fix compat system call table
        s390/mm: fix off-by-one bug in 5-level page table handling
        s390: Remove redudant license text
        s390: add a few more SPDX identifiers
        s390/dasd: prevent prefix I/O error
        s390: always save and restore all registers on context switch
        s390/dasd: remove 'struct timespec' usage
        s390/qdio: restrict target-full handling to IQDIO
        s390/qdio: consider ERROR buffers for inbound-full condition
        s390/virtio: add BSD license to virtio-ccw
      c6b3e969
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 6e7e7f4d
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Fix some more FP register fallout from the SVE patches and also some
        problems with the PGD tracking in our software PAN emulation code,
        after we received a crash report from a 3.18 kernel running a
        backport.
      
        Summary:
      
         - fix SW PAN pgd shadowing for kernel threads, EFI and exiting user
           tasks
      
         - fix FP register leak when a task_struct is re-allocated
      
         - fix potential use-after-free in FP state tracking used by KVM"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64/sve: Avoid dereference of dead task_struct in KVM guest entry
        arm64: SW PAN: Update saved ttbr0 value on enter_lazy_tlb
        arm64: SW PAN: Point saved ttbr0 at the zero page when switching to init_mm
        arm64: fpsimd: Abstract out binding of task's fpsimd context to the cpu.
        arm64: fpsimd: Prevent registers leaking from dead tasks
      6e7e7f4d
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 3625de4b
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "This fixes an out of bounds warning from KASAN in the ACPI CPPC
        driver"
      
      * tag 'acpi-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / CPPC: Fix KASAN global out of bounds warning
      3625de4b
    • Linus Torvalds's avatar
      Merge tag 'pm-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 7ed9fd2e
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "This fixes an issue in the device runtime PM framework that prevents
        customer devices from resuming if runtime PM is disabled for one or
        more of their supplier devices (as reflected by device links between
        those devices)"
      
      * tag 'pm-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PM / runtime: Fix handling of suppliers with disabled runtime PM
      7ed9fd2e
  2. Dec 07, 2017
    • Heiko Carstens's avatar
      s390: fix compat system call table · e779498d
      Heiko Carstens authored
      When wiring up the socket system calls the compat entries were
      incorrectly set. Not all of them point to the corresponding compat
      wrapper functions, which clear the upper 33 bits of user space
      pointers, like it is required.
      
      Fixes: 977108f8
      
       ("s390: wire up separate socketcalls system calls")
      Cc: <stable@vger.kernel.org> # v4.3+
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      e779498d
    • Linus Torvalds's avatar
      Merge tag 'for_linus-4.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb · 968edbd9
      Linus Torvalds authored
      Pull kgdb fixes from Jason Wessel:
      
       - Fix long standing problem with kdb kallsyms_symbol_next() return
         value
      
       - Add new co-maintainer Daniel Thompson
      
      * tag 'for_linus-4.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
        kgdb/kdb/debug_core: Add co-maintainer Daniel Thompson
        kdb: Fix handling of kallsyms_symbol_next() return value
      968edbd9
    • Linus Torvalds's avatar
      proc: show si_ptr in /proc/<pid>/timers without hashing · ba3edf1f
      Linus Torvalds authored
      
      
      It's a user pointer, and while the permissions of the file are pretty
      questionable (should it really be readable to everybody), hashing the
      pointer isn't going to be the solution.
      
      We should take a closer look at more of the /proc/<pid> file permissions
      in general.  Sure, we do want many of them to often be readable (for
      'ps' and friends), but I think we should probably do a few conversions
      from S_IRUGO to S_IRUSR.
      
      Reported-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ba3edf1f
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · 10f837e5
      Linus Torvalds authored
      Pull m68knommu fixes from Greg Ungerer:
       "There are two fixes here. One to add a missing linker section to the
        m68k architecture linker scripts, the other to fix a defconfig build
        problem"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68k/defconfig: fix stmark2 broken local compilation
        m68k: add missing SOFTIRQENTRY_TEXT linker section
      10f837e5
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · dd53a421
      Linus Torvalds authored
      Pull misc x86 fixes from Ingo Molnar:
      
       - make CR4 handling irq-safe, which bug vmware guests ran into
      
       - don't crash on early IRQs in Xen guests
      
       - don't crash secondary CPU bringup if #UD assisted WARN()ings are
         triggered
      
       - make X86_BUG_FXSAVE_LEAK optional on newer AMD CPUs that have the fix
      
       - fix AMD Fam17h microcode loading
      
       - fix broadcom_postcore_init() if ACPI is disabled
      
       - fix resume regression in __restore_processor_context()
      
       - fix Sparse warnings
      
       - fix a GCC-8 warning
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/vdso: Change time() prototype to match __vdso_time()
        x86: Fix Sparse warnings about non-static functions
        x86/power: Fix some ordering bugs in __restore_processor_context()
        x86/PCI: Make broadcom_postcore_init() check acpi_disabled
        x86/microcode/AMD: Add support for fam17h microcode loading
        x86/cpufeatures: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on AMD
        x86/idt: Load idt early in start_secondary
        x86/xen: Support early interrupts in xen pv guests
        x86/tlb: Disable interrupts when changing CR4
        x86/tlb: Refactor CR4 setting and shadow write
      dd53a421
    • Linus Torvalds's avatar
      Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4b43a3bc
      Linus Torvalds authored
      Pull CPU hotplug fix from Ingo Molnar:
       "A single fix moving the smp-call queue flush step to the intended
        point in the state machine"
      
      * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        smp/hotplug: Move step CPUHP_AP_SMPCFD_DYING to the correct place
      4b43a3bc
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e017b4db
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "This includes a fix for the add_wait_queue() queue ordering brown
        paperbag bug, plus PELT accounting fixes for cgroups scheduling
        artifacts"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Update and fix the runnable propagation rule
        sched/wait: Fix add_wait_queue() behavioral change
      e017b4db
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1c764725
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "This includes perf namespace support kernel side fixes, plus an
        accumulated set of perf tooling fixes - including UAPI header
        synchronization that should make the perf build less noisy"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
        tooling/headers: Synchronize updated s390 and x86 UAPI headers
        tools headers: Syncronize mman.h ABI header
        tools headers: Synchronize prctl.h ABI header
        tools headers: Synchronize KVM arch ABI headers
        tools headers: Synchronize drm/i915_drm.h
        tools headers uapi: Synchronize drm/drm.h
        tools headers: Synchronize perf_event.h header
        tools headers: Synchronize kernel ABI headers wrt SPDX tags
        tools/headers: Synchronize kernel x86 UAPI headers
        perf intel-pt: Bring instruction decoder files into line with the kernel
        perf test: Fix test 21 for s390x
        perf bench numa: Fixup discontiguous/sparse numa nodes
        perf top: Use signal interface for SIGWINCH handler
        perf top: Fix window dimensions change handling
        perf: Fix header.size for namespace events
        perf top: Ignore kptr_restrict when not sampling the kernel
        perf record: Ignore kptr_restrict when not sampling the kernel
        perf report: Ignore kptr_restrict when not sampling the kernel
        perf evlist: Add helper to check if attr.exclude_kernel is set in all evsels
        perf test shell: Fix test case probe libc's inet_pton on s390x
        ...
      1c764725
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 189dbab0
      Linus Torvalds authored
      Pull lockdep fix from Ingo Molnar:
       "Fix a possible NULL dereference for the (rare) case when a task
        doesn't have ->xhlocks space allocated due to kmalloc() OOM-ing"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/lockdep: Fix possible NULL deref
      189dbab0
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 61d6be3a
      Linus Torvalds authored
      Pull irq fixes from Ingo Molnar:
       "Two fixes: use bool type consistently, plus a irq_matrix_available()
        bugfix"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqdesc: Use bool return type instead of int
        genirq/matrix: Fix the precedence fix for real
      61d6be3a
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · dabe5896
      Linus Torvalds authored
      Pull EFI fixes from Ingo Molnar:
       "Misc fixes: world-readable pointer removal from sysfs, a ESRT kfree()
        bug fix and a comment update"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi: Add comment to avoid future expanding of sysfs systab
        efi/esrt: Use memunmap() instead of kfree() to free the remapping
        efi: Move some sysfs files to be read-only by root
      dabe5896
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 07eca14b
      Linus Torvalds authored
      Pull core fixes from Ingo Molnar:
       "Two fixes:
      
         - objtool cross-build fixes
      
         - removal of an obsolete CPU-hotplug state name from comments"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Fix 64-bit build on 32-bit host
        cpu/hotplug: Fix state name in takedown_cpu() comment
      07eca14b
    • Jason Wessel's avatar
    • Daniel Thompson's avatar
      kdb: Fix handling of kallsyms_symbol_next() return value · c07d3533
      Daniel Thompson authored
      
      
      kallsyms_symbol_next() returns a boolean (true on success). Currently
      kdb_read() tests the return value with an inequality that
      unconditionally evaluates to true.
      
      This is fixed in the obvious way and, since the conditional branch is
      supposed to be unreachable, we also add a WARN_ON().
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      c07d3533
    • Ingo Molnar's avatar
      tooling/headers: Synchronize updated s390 and x86 UAPI headers · 34c9ca37
      Ingo Molnar authored
      
      
      There were two trivial updates to these upstream UAPI headers:
      
        arch/s390/include/uapi/asm/kvm.h
        arch/s390/include/uapi/asm/kvm_perf.h
        arch/x86/lib/x86-opcode-map.txt
      
      Synchronize them with their tooling copies.
      
      (The x86 opcode map includes a new instruction pattern now.)
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      34c9ca37
    • Ingo Molnar's avatar
    • Mikulas Patocka's avatar
      objtool: Fix 64-bit build on 32-bit host · 14c47b54
      Mikulas Patocka authored
      
      
      The new ORC unwinder breaks the build of a 64-bit kernel on a 32-bit
      host.  Building the kernel on a i386 or x32 host fails with:
      
        orc_dump.c: In function 'orc_dump':
        orc_dump.c:105:26: error: passing argument 2 of 'elf_getshdrnum' from incompatible pointer type [-Werror=incompatible-pointer-types]
          if (elf_getshdrnum(elf, &nr_sections)) {
                                  ^
        In file included from /usr/local/include/gelf.h:32:0,
                         from elf.h:22,
                         from warn.h:26,
                         from orc_dump.c:20:
        /usr/local/include/libelf.h:304:12: note: expected 'size_t * {aka unsigned int *}' but argument is of type 'long unsigned int *'
         extern int elf_getshdrnum (Elf *__elf, size_t *__dst);
                    ^~~~~~~~~~~~~~
        orc_dump.c:190:17: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'Elf64_Sxword {aka long long int}' [-Werror=format=]
            printf("%s+%lx:", name, rela.r_addend);
                       ~~^          ~~~~~~~~~~~~~
                       %llx
      
      Fix the build failure.
      
      Another problem is that if the user specifies HOSTCC or HOSTLD
      variables, they are ignored in the objtool makefile.  Change the
      Makefile to respect these variables.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sven Joachim <svenjoac@gmx.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 627fce14
      
       ("objtool: Add ORC unwind table generation")
      Link: http://lkml.kernel.org/r/19f0e64d8e07e30a7b307cd010eb780c404fe08d.1512252895.git.jpoimboe@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      14c47b54
    • Arnd Bergmann's avatar
      x86/vdso: Change time() prototype to match __vdso_time() · 88edb57d
      Arnd Bergmann authored
      
      
      gcc-8 warns that time() is an alias for __vdso_time() but the two
      have different prototypes:
      
        arch/x86/entry/vdso/vclock_gettime.c:327:5: error: 'time' alias between functions of incompatible types 'int(time_t *)' {aka 'int(long int *)'} and 'time_t(time_t *)' {aka 'long int(long int *)'} [-Werror=attribute-alias]
         int time(time_t *t)
             ^~~~
        arch/x86/entry/vdso/vclock_gettime.c:318:16: note: aliased declaration here
      
      I could not figure out whether this is intentional, but I see that
      changing it to return time_t avoids the warning.
      
      Returning 'int' from time() is also a bit questionable, as it causes an
      overflow in y2038 even on 64-bit architectures that use a 64-bit time_t
      type. On 32-bit architecture with 64-bit time_t, time() should always
      be implement by the C library by calling a (to be added) clock_gettime()
      variant that takes a sufficiently wide argument.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Link: http://lkml.kernel.org/r/20171204150203.852959-1-arnd@arndb.de
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      88edb57d
    • Dave Martin's avatar
      arm64/sve: Avoid dereference of dead task_struct in KVM guest entry · cb968afc
      Dave Martin authored
      
      
      When deciding whether to invalidate FPSIMD state cached in the cpu,
      the backend function sve_flush_cpu_state() attempts to dereference
      __this_cpu_read(fpsimd_last_state).  However, this is not safe:
      there is no guarantee that this task_struct pointer is still valid,
      because the task could have exited in the meantime.
      
      This means that we need another means to get the appropriate value
      of TIF_SVE for the associated task.
      
      This patch solves this issue by adding a cached copy of the TIF_SVE
      flag in fpsimd_last_state, which we can check without dereferencing
      the task pointer.
      
      In particular, although this patch is not a KVM fix per se, this
      means that this check is now done safely in the KVM world switch
      path (which is currently the only user of this code).
      
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Christoffer Dall <christoffer.dall@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      cb968afc
    • Linus Torvalds's avatar
      Merge tag 'iommu-v4.15-rc3' of git://github.com/awilliam/linux-vfio · e56d565d
      Linus Torvalds authored
      Pull IOMMU fix from Alex Williamson:
       "Fix VT-d handling of scatterlists where sg->offset exceeds PAGE_SIZE"
      
      * tag 'iommu-v4.15-rc3' of git://github.com/awilliam/linux-vfio:
        iommu/vt-d: Fix scatterlist offset handling
      e56d565d
    • Linus Torvalds's avatar
      Merge tag 'sound-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · f9efc944
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "All fixes are small and for stable:
      
         - a PCM ioctl race fix
      
         - yet another USB-audio hardening for malicious descriptors
      
         - Realtek ALC257 codec support"
      
      * tag 'sound-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: pcm: prevent UAF in snd_pcm_info
        ALSA: hda/realtek - New codec support for ALC257
        ALSA: usb-audio: Add check return value for usb_string()
        ALSA: usb-audio: Fix out-of-bound error
        ALSA: seq: Remove spurious WARN_ON() at timer check
      f9efc944
    • Colin Ian King's avatar
      x86: Fix Sparse warnings about non-static functions · d553d03f
      Colin Ian King authored
      
      
      Functions x86_vector_debug_show(), uv_handle_nmi() and uv_nmi_setup_common()
      are local to the source and do not need to be in global scope, so make them
      static.
      
      Fixes up various sparse warnings.
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarMike Travis <mike.travis@hpe.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Kosina <trivial@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Russ Anderson <russ.anderson@hpe.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: kernel-janitors@vger.kernel.org
      Cc: travis@sgi.com
      Link: http://lkml.kernel.org/r/20171206173358.24388-1-colin.king@canonical.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d553d03f
    • Dave Young's avatar
      efi: Add comment to avoid future expanding of sysfs systab · 0b02e448
      Dave Young authored
      
      
      /sys/firmware/efi/systab shows several different values, it breaks sysfs
      one file one value design.  But since there are already userspace tools
      depend on it eg. kexec-tools so add code comment to alert future expanding
      of this file.
      
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20171206095010.24170-4-ard.biesheuvel@linaro.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0b02e448
    • Pan Bian's avatar
      efi/esrt: Use memunmap() instead of kfree() to free the remapping · 89c5a2d3
      Pan Bian authored
      
      
      The remapping result of memremap() should be freed with memunmap(), not kfree().
      
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: <stable@vger.kernel.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20171206095010.24170-3-ard.biesheuvel@linaro.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      89c5a2d3
    • Greg Kroah-Hartman's avatar
      efi: Move some sysfs files to be read-only by root · af97a77b
      Greg Kroah-Hartman authored
      
      
      Thanks to the scripts/leaking_addresses.pl script, it was found that
      some EFI values should not be readable by non-root users.
      
      So make them root-only, and to do that, add a __ATTR_RO_MODE() macro to
      make this easier, and use it in other places at the same time.
      
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Cc: stable <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20171206095010.24170-2-ard.biesheuvel@linaro.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      af97a77b
    • Vincent Guittot's avatar
      sched/fair: Update and fix the runnable propagation rule · a4c3c049
      Vincent Guittot authored
      
      
      Unlike running, the runnable part can't be directly propagated through
      the hierarchy when we migrate a task. The main reason is that runnable
      time can be shared with other sched_entities that stay on the rq and
      this runnable time will also remain on prev cfs_rq and must not be
      removed.
      
      Instead, we can estimate what should be the new runnable of the prev
      cfs_rq and check that this estimation stay in a possible range. The
      prop_runnable_sum is a good estimation when adding runnable_sum but
      fails most often when we remove it. Instead, we could use the formula
      below instead:
      
        gcfs_rq's runnable_sum = gcfs_rq->avg.load_sum / gcfs_rq->load.weight
      
      which assumes that tasks are equally runnable which is not true but
      easy to compute.
      
      Beside these estimates, we have several simple rules that help us to filter
      out wrong ones:
      
       - ge->avg.runnable_sum <= than LOAD_AVG_MAX
       - ge->avg.runnable_sum >= ge->avg.running_sum (ge->avg.util_sum << LOAD_AVG_MAX)
       - ge->avg.runnable_sum can't increase when we detach a task
      
      The effect of these fixes is better cgroups balancing.
      
      Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Ben Segall <bsegall@google.com>
      Cc: Chris Mason <clm@fb.com>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Morten Rasmussen <morten.rasmussen@arm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yuyang Du <yuyang.du@intel.com>
      Link: http://lkml.kernel.org/r/1510842112-21028-1-git-send-email-vincent.guittot@linaro.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a4c3c049
    • Omar Sandoval's avatar
      sched/wait: Fix add_wait_queue() behavioral change · c6b9d9a3
      Omar Sandoval authored
      The following cleanup commit:
      
        50816c48
      
       ("sched/wait: Standardize internal naming of wait-queue entries")
      
      ... unintentionally changed the behavior of add_wait_queue() from
      inserting the wait entry at the head of the wait queue to the tail
      of the wait queue.
      
      Beyond a negative performance impact this change in behavior
      theoretically also breaks wait queues which mix exclusive and
      non-exclusive waiters, as non-exclusive waiters will not be
      woken up if they are queued behind enough exclusive waiters.
      
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: kernel-team@fb.com
      Fixes: ("sched/wait: Standardize internal naming of wait-queue entries")
      Link: http://lkml.kernel.org/r/a16c8ccffd39bd08fdaa45a5192294c784b803a7.1512544324.git.osandov@fb.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c6b9d9a3
    • Peter Zijlstra's avatar
      locking/lockdep: Fix possible NULL deref · 5e351ad1
      Peter Zijlstra authored
      
      
      We can't invalidate xhlocks when we've not yet allocated any.
      
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Fixes: f52be570
      
       ("locking/lockdep: Untangle xhlock history save/restore from task independence")
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5e351ad1
    • Brendan Jackman's avatar
      cpu/hotplug: Fix state name in takedown_cpu() comment · 5b1ead68
      Brendan Jackman authored
      
      
      CPUHP_AP_SCHED_MIGRATE_DYING doesn't exist, it looks like this was
      supposed to refer to CPUHP_AP_SCHED_STARTING's teardown callback,
      i.e. sched_cpu_dying().
      
      Signed-off-by: default avatarBrendan Jackman <brendan.jackman@arm.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Perret <quentin.perret@arm.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20171206105911.28093-1-brendan.jackman@arm.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5b1ead68
    • Will Deacon's avatar
      arm64: SW PAN: Update saved ttbr0 value on enter_lazy_tlb · d96cc49b
      Will Deacon authored
      enter_lazy_tlb is called when a kernel thread rides on the back of
      another mm, due to a context switch or an explicit call to unuse_mm
      where a call to switch_mm is elided.
      
      In these cases, it's important to keep the saved ttbr value up to date
      with the active mm, otherwise we can end up with a stale value which
      points to a potentially freed page table.
      
      This patch implements enter_lazy_tlb for arm64, so that the saved ttbr0
      is kept up-to-date with the active mm for kernel threads.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Fixes: 39bc88e5
      
       ("arm64: Disable TTBR0_EL1 during normal kernel execution")
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reported-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      d96cc49b
    • Will Deacon's avatar
      arm64: SW PAN: Point saved ttbr0 at the zero page when switching to init_mm · 0adbdfde
      Will Deacon authored
      update_saved_ttbr0 mandates that mm->pgd is not swapper, since swapper
      contains kernel mappings and should never be installed into ttbr0. However,
      this means that callers must avoid passing the init_mm to update_saved_ttbr0
      which in turn can cause the saved ttbr0 value to be out-of-date in the context
      of the idle thread. For example, EFI runtime services may leave the saved ttbr0
      pointing at the EFI page table, and kernel threads may end up with stale
      references to freed page tables.
      
      This patch changes update_saved_ttbr0 so that the init_mm points the saved
      ttbr0 value to the empty zero page, which always exists and never contains
      valid translations. EFI and switch can then call into update_saved_ttbr0
      unconditionally.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Fixes: 39bc88e5
      
       ("arm64: Disable TTBR0_EL1 during normal kernel execution")
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reported-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      0adbdfde
    • Dave Martin's avatar
      arm64: fpsimd: Abstract out binding of task's fpsimd context to the cpu. · 8884b7bd
      Dave Martin authored
      
      
      There is currently some duplicate logic to associate current's
      FPSIMD context with the cpu when loading FPSIMD state into the cpu
      regs.
      
      Subsequent patches will update that logic, so in order to ensure it
      only needs to be done in one place, this patch factors the relevant
      code out into a new function fpsimd_bind_to_cpu().
      
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      8884b7bd
    • Dave Martin's avatar
      arm64: fpsimd: Prevent registers leaking from dead tasks · 071b6d4a
      Dave Martin authored
      Currently, loading of a task's fpsimd state into the CPU registers
      is skipped if that task's state is already present in the registers
      of that CPU.
      
      However, the code relies on the struct fpsimd_state * (and by
      extension struct task_struct *) to unambiguously identify a task.
      
      There is a particular case in which this doesn't work reliably:
      when a task exits, its task_struct may be recycled to describe a
      new task.
      
      Consider the following scenario:
      
       1) Task P loads its fpsimd state onto cpu C.
              per_cpu(fpsimd_last_state, C) := P;
              P->thread.fpsimd_state.cpu := C;
      
       2) Task X is scheduled onto C and loads its fpsimd state on C.
              per_cpu(fpsimd_last_state, C) := X;
              X->thread.fpsimd_state.cpu := C;
      
       3) X exits, causing X's task_struct to be freed.
      
       4) P forks a new child T, which obtains X's recycled task_struct.
      	T == X.
      	T->thread.fpsimd_state.cpu == C (inherited from P).
      
       5) T is scheduled on C.
      	T's fpsimd state is not loaded, because
      	per_cpu(fpsimd_last_state, C) == T (== X) &&
      	T->thread.fpsimd_state.cpu == C.
      
              (This is the check performed by fpsimd_thread_switch().)
      
      So, T gets X's registers because the last registers loaded onto C
      were those of X, in (2).
      
      This patch fixes the problem by ensuring that the sched-in check
      fails in (5): fpsimd_flush_task_state(T) is called when T is
      forked, so that T->thread.fpsimd_state.cpu == C cannot be true.
      This relies on the fact that T is not schedulable until after
      copy_thread() completes.
      
      Once T's fpsimd state has been loaded on some CPU C there may still
      be other cpus D for which per_cpu(fpsimd_last_state, D) ==
      &X->thread.fpsimd_state.  But D is necessarily != C in this case,
      and the check in (5) must fail.
      
      An alternative fix would be to do refcounting on task_struct.  This
      would result in each CPU holding a reference to the last task whose
      fpsimd state was loaded there.  It's not clear whether this is
      preferable, and it involves higher overhead than the fix proposed
      in this patch.  It would also move all the task_struct freeing
      work into the context switch critical section, or otherwise some
      deferred cleanup mechanism would need to be introduced, neither of
      which seems obviously justified.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 005f78cd
      
       ("arm64: defer reloading a task's FPSIMD state to userland resume")
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      [will: word-smithed the comment so it makes more sense]
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      071b6d4a
  3. Dec 06, 2017
    • Michael Ellerman's avatar
      powerpc/xmon: Don't print hashed pointers in xmon · d8104182
      Michael Ellerman authored
      Since commit ad67b74d
      
       ("printk: hash addresses printed with %p")
      pointers printed with %p are hashed, ie. you don't see the actual
      pointer value but rather a cryptographic hash of its value.
      
      In xmon we want to see the actual pointer values, because xmon is a
      debugger, so replace %p with %px which prints the actual pointer
      value.
      
      We justify doing this in xmon because 1) xmon is a kernel crash
      debugger, it's only accessible via the console 2) xmon doesn't print
      to dmesg, so the pointers it prints are not able to be leaked that
      way.
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d8104182
    • Nicholas Piggin's avatar
      powerpc/64s: Initialize ISAv3 MMU registers before setting partition table · 371b8044
      Nicholas Piggin authored
      kexec can leave MMU registers set when booting into a new kernel,
      the PIDR (Process Identification Register) in particular. The boot
      sequence does not zero PIDR, so it only gets set when CPUs first
      switch to a userspace processes (until then it's running a kernel
      thread with effective PID = 0).
      
      This leaves a window where a process table entry and page tables are
      set up due to user processes running on other CPUs, that happen to
      match with a stale PID. The CPU with that PID may cause speculative
      accesses that address quadrant 0 (aka userspace addresses), which will
      result in cached translations and PWC (Page Walk Cache) for that
      process, on a CPU which is not in the mm_cpumask and so they will not
      be invalidated properly.
      
      The most common result is the kernel hanging in infinite page fault
      loops soon after kexec (usually in schedule_tail, which is usually the
      first non-speculative quadrant 0 access to a new PID) due to a stale
      PWC. However being a stale translation error, it could result in
      anything up to security and data corruption problems.
      
      Fix this by zeroing out PIDR at boot and kexec.
      
      Fixes: 7e381c0f
      
       ("powerpc/mm/radix: Add mmu context handling callback for radix")
      Cc: stable@vger.kernel.org # v4.7+
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      371b8044