Skip to content
  1. Apr 12, 2018
    • Michael Ellerman's avatar
      powerpc/mm/radix: Fix checkstops caused by invalid tlbiel · 2675c13b
      Michael Ellerman authored
      In tlbiel_radix_set_isa300() we use the PPC_TLBIEL() macro to
      construct tlbiel instructions. The instruction takes 5 fields, two of
      which are registers, and the others are constants. But because it's
      constructed with inline asm the compiler doesn't know that.
      
      We got the constraint wrong on the 'r' field, using "r" tells the
      compiler to put the value in a register. The value we then get in the
      macro is the *register number*, not the value of the field.
      
      That means when we mask the register number with 0x1 we get 0 or 1
      depending on which register the compiler happens to put the constant
      in, eg:
      
        li      r10,1
        tlbiel  r8,r9,2,0,0
      
        li      r7,1
        tlbiel  r10,r6,0,0,1
      
      If we're unlucky we might generate an invalid instruction form, for
      example RIC=0, PRS=1 and R=0, tlbiel r8,r7,0,1,0, this has been
      observed to cause machine checks:
      
        Oops: Machine check, sig: 7 [#1]
        CPU: 24 PID: 0 Comm: swapper
        NIP:  00000000000385f4 LR: 000000000100ed00 CTR: 000000000000007f
        REGS: c00000000110bb40 TRAP: 0200
        MSR:  9000000000201003 <SF,HV,ME,RI,LE>  CR: 48002222  XER: 20040000
        CFAR: 00000000000385d0 DAR: 0000000000001c00 DSISR: 00000200 SOFTE: 1
      
      If the machine check happens early in boot while we have MSR_ME=0 it
      will escalate into a checkstop and kill the box entirely.
      
      To fix it we could change the inline asm constraint to "i" which
      tells the compiler the value is a constant. But a better fix is to just
      pass a literal 1 into the macro, which bypasses any problems with inline
      asm constraints.
      
      Fixes: d4748276
      
       ("powerpc/64s: Improve local TLB flush for boot and MCE on POWER9")
      Cc: stable@vger.kernel.org # v4.16+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      2675c13b
  2. Apr 11, 2018
    • Nicholas Piggin's avatar
      KVM: PPC: Book3S HV: trace_tlbie must not be called in realmode · 19ce7909
      Nicholas Piggin authored
      This crashes with a "Bad real address for load" attempting to load
      from the vmalloc region in realmode (faulting address is in DAR).
      
        Oops: Bad interrupt in KVM entry/exit code, sig: 6 [#1]
        LE SMP NR_CPUS=2048 NUMA PowerNV
        CPU: 53 PID: 6582 Comm: qemu-system-ppc Not tainted 4.16.0-01530-g43d1859f0994
        NIP:  c0000000000155ac LR: c0000000000c2430 CTR: c000000000015580
        REGS: c000000fff76dd80 TRAP: 0200   Not tainted  (4.16.0-01530-g43d1859f0994)
        MSR:  9000000000201003 <SF,HV,ME,RI,LE>  CR: 48082222  XER: 00000000
        CFAR: 0000000102900ef0 DAR: d00017fffd941a28 DSISR: 00000040 SOFTE: 3
        NIP [c0000000000155ac] perf_trace_tlbie+0x2c/0x1a0
        LR [c0000000000c2430] do_tlbies+0x230/0x2f0
      
      I suspect the reason is the per-cpu data is not in the linear chunk.
      This could be restored if that was able to be fixed, but for now,
      just remove the tracepoints.
      
      Fixes: 0428491c
      
       ("powerpc/mm: Trace tlbie(l) instructions")
      Cc: stable@vger.kernel.org # v4.13+
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      19ce7909
    • Aneesh Kumar K.V's avatar
      powerpc/8xx: Fix build with hugetlbfs enabled · 032900e6
      Aneesh Kumar K.V authored
      
      
      8xx uses the slice code when hugetlbfs is enabled. We missed a header
      include on 8xx which resulted in the below build failure:
      
        config: mpc885_ads_defconfig + CONFIG_HUGETLBFS
      
        arch/powerpc/mm/slice.c: In function 'slice_get_unmapped_area':
        arch/powerpc/mm/slice.c:655:2: error: implicit declaration of function 'need_extra_context'
        arch/powerpc/mm/slice.c:656:3: error: implicit declaration of function 'alloc_extended_context'
      
      on PPC64 the mmu_context.h was included via linux/pkeys.h
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      032900e6
    • Nicholas Piggin's avatar
      powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops · 3b807033
      Nicholas Piggin authored
      The OPAL NVRAM driver does not sleep in case it gets OPAL_BUSY or
      OPAL_BUSY_EVENT from firmware, which causes large scheduling
      latencies, and various lockup errors to trigger (again, BMC reboot
      can cause it).
      
      Fix this by converting it to the standard form OPAL_BUSY loop that
      sleeps.
      
      Fixes: 628daa8d ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks")
      Depends-on: 34dd25de
      
       ("powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops")
      Cc: stable@vger.kernel.org # v3.2+
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3b807033
  3. Apr 10, 2018
    • Nicholas Piggin's avatar
      powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops · 34dd25de
      Nicholas Piggin authored
      
      
      This is the start of an effort to tidy up and standardise all the
      delays. Existing loops have a range of delay/sleep periods from 1ms
      to 20ms, and some have no delay. They all loop forever except rtc,
      which times out after 10 retries, and that uses 10ms delays. So use
      10ms as our standard delay. The OPAL maintainer agrees 10ms is a
      reasonable starting point.
      
      The idea is to use the same recipe everywhere, once this is proven to
      work then it will be documented as an OPAL API standard. Then both
      firmware and OS can agree, and if a particular call needs something
      else, then that can be documented with reasoning.
      
      This is not the end-all of this effort, it's just a relatively easy
      change that fixes some existing high latency delays. There should be
      provision for standardising timeouts and/or interruptible loops where
      possible, so non-fatal firmware errors don't cause hangs.
      
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      34dd25de
    • Anshuman Khandual's avatar
      powerpc/fscr: Enable interrupts earlier before calling get_user() · 709b973c
      Anshuman Khandual authored
      
      
      The function get_user() can sleep while trying to fetch instruction
      from user address space and causes the following warning from the
      scheduler.
      
      BUG: sleeping function called from invalid context
      
      Though interrupts get enabled back but it happens bit later after
      get_user() is called. This change moves enabling these interrupts
      earlier covering the function get_user(). While at this, lets check
      for kernel mode and crash as this interrupt should not have been
      triggered from the kernel context.
      
      Signed-off-by: default avatarAnshuman Khandual <khandual@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      709b973c
    • Michael Ellerman's avatar
      powerpc/64s: Fix section mismatch warnings from setup_rfi_flush() · 501a78cb
      Michael Ellerman authored
      The recent LPM changes to setup_rfi_flush() are causing some section
      mismatch warnings because we removed the __init annotation on
      setup_rfi_flush():
      
        The function setup_rfi_flush() references
        the function __init ppc64_bolted_size().
        the function __init memblock_alloc_base().
      
      The references are actually in init_fallback_flush(), but that is
      inlined into setup_rfi_flush().
      
      These references are safe because:
       - only pseries calls setup_rfi_flush() at runtime
       - pseries always passes L1D_FLUSH_FALLBACK at boot
       - so the fallback flush area will always be allocated
       - so the check in init_fallback_flush() will always return early:
         /* Only allocate the fallback flush area once (at boot time). */
         if (l1d_flush_fallback_area)
         	return;
      
       - and therefore we won't actually call the freed init routines.
      
      We should rework the code to make it safer by default rather than
      relying on the above, but for now as a quick-fix just add a __ref
      annotation to squash the warning.
      
      Fixes: abf110f3
      
       ("powerpc/rfi-flush: Make it possible to call setup_rfi_flush() again")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      501a78cb
  4. Apr 09, 2018
    • Michael Ellerman's avatar
      powerpc/modules: Fix crashes by adding CONFIG_RELOCATABLE to vermagic · 73aca179
      Michael Ellerman authored
      If you build the kernel with CONFIG_RELOCATABLE=n, then install the
      modules, rebuild the kernel with CONFIG_RELOCATABLE=y and leave the
      old modules installed, we crash something like:
      
        Unable to handle kernel paging request for data at address 0xd000000018d66cef
        Faulting instruction address: 0xc0000000021ddd08
        Oops: Kernel access of bad area, sig: 11 [#1]
        Modules linked in: x_tables autofs4
        CPU: 2 PID: 1 Comm: systemd Not tainted 4.16.0-rc6-gcc_ubuntu_le-g99fec39 #1
        ...
        NIP check_version.isra.22+0x118/0x170
        Call Trace:
          __ksymtab_xt_unregister_table+0x58/0xfffffffffffffcb8 [x_tables] (unreliable)
          resolve_symbol+0xb4/0x150
          load_module+0x10e8/0x29a0
          SyS_finit_module+0x110/0x140
          system_call+0x58/0x6c
      
      This happens because since commit 71810db2 ("modversions: treat
      symbol CRCs as 32 bit quantities"), a relocatable kernel encodes and
      handles symbol CRCs differently from a non-relocatable kernel.
      
      Although it's possible we could try and detect this situation and
      handle it, it's much more robust to simply make the state of
      CONFIG_RELOCATABLE part of the module vermagic.
      
      Fixes: 71810db2
      
       ("modversions: treat symbol CRCs as 32 bit quantities")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      73aca179
  5. Apr 08, 2018
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 49a695ba
      Linus Torvalds authored
      Pull powerpc updates from Michael Ellerman:
       "Notable changes:
      
         - Support for 4PB user address space on 64-bit, opt-in via mmap().
      
         - Removal of POWER4 support, which was accidentally broken in 2016
           and no one noticed, and blocked use of some modern instructions.
      
         - Workarounds so that the hypervisor can enable Transactional Memory
           on Power9.
      
         - A series to disable the DAWR (Data Address Watchpoint Register) on
           Power9.
      
         - More information displayed in the meltdown/spectre_v1/v2 sysfs
           files.
      
         - A vpermxor (Power8 Altivec) implementation for the raid6 Q
           Syndrome.
      
         - A big series to make the allocation of our pacas (per cpu area),
           kernel page tables, and per-cpu stacks NUMA aware when using the
           Radix MMU on Power9.
      
        And as usual many fixes, reworks and cleanups.
      
        Thanks to: Aaro Koskinen, Alexandre Belloni, Alexey Kardashevskiy,
        Alistair Popple, Andy Shevchenko, Aneesh Kumar K.V, Anshuman Khandual,
        Balbir Singh, Benjamin Herrenschmidt, Christophe Leroy, Christophe
        Lombard, Cyril Bur, Daniel Axtens, Dave Young, Finn Thain, Frederic
        Barrat, Gustavo Romero, Horia Geantă, Jonathan Neuschäfer, Kees Cook,
        Larry Finger, Laurent Dufour, Laurent Vivier, Logan Gunthorpe,
        Madhavan Srinivasan, Mark Greer, Mark Hairgrove, Markus Elfring,
        Mathieu Malaterre, Matt Brown, Matt Evans, Mauricio Faria de Oliveira,
        Michael Neuling, Naveen N. Rao, Nicholas Piggin, Paul Mackerras,
        Philippe Bergheaud, Ram Pai, Rob Herring, Sam Bobroff, Segher
        Boessenkool, Simon Guo, Simon Horman, Stewart Smith, Sukadev
        Bhattiprolu, Suraj Jitindar Singh, Thiago Jung Bauermann, Vaibhav
        Jain, Vaidyanathan Srinivasan, Vasant Hegde, Wei Yongjun"
      
      * tag 'powerpc-4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (207 commits)
        powerpc/64s/idle: Fix restore of AMOR on POWER9 after deep sleep
        powerpc/64s: Fix POWER9 DD2.2 and above in cputable features
        powerpc/64s: Fix pkey support in dt_cpu_ftrs, add CPU_FTR_PKEY bit
        powerpc/64s: Fix dt_cpu_ftrs to have restore_cpu clear unwanted LPCR bits
        Revert "powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead"
        powerpc: iomap.c: introduce io{read|write}64_{lo_hi|hi_lo}
        powerpc: io.h: move iomap.h include so that it can use readq/writeq defs
        cxl: Fix possible deadlock when processing page faults from cxllib
        powerpc/hw_breakpoint: Only disable hw breakpoint if cpu supports it
        powerpc/mm/radix: Update command line parsing for disable_radix
        powerpc/mm/radix: Parse disable_radix commandline correctly.
        powerpc/mm/hugetlb: initialize the pagetable cache correctly for hugetlb
        powerpc/mm/radix: Update pte fragment count from 16 to 256 on radix
        powerpc/mm/keys: Update documentation and remove unnecessary check
        powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead
        powerpc/64s/idle: Consolidate power9_offline_stop()/power9_idle_stop()
        powerpc/powernv: Always stop secondaries before reboot/shutdown
        powerpc: hard disable irqs in smp_send_stop loop
        powerpc: use NMI IPI for smp_send_stop
        powerpc/powernv: Fix SMT4 forcing idle code
        ...
      49a695ba
    • Linus Torvalds's avatar
      Merge tag 'leaks-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks · 299f89d5
      Linus Torvalds authored
      Pull leaking-addresses updates from Tobin Harding:
       "This set represents improvements to the scripts/leaking_addresses.pl
        script.
      
        The major improvement is that with this set applied the script
        actually runs in a reasonable amount of time (less than a minute on a
        standard stock Ubuntu user desktop). Also, we have a second maintainer
        now and a tree hosted on kernel.org
      
        We do a few code clean ups. We fix the command help output. Handling
        of the vsyscall address range is fixed to check the whole range
        instead of just the start/end addresses. We add support for 5 page
        table levels (suggested on LKML). We use a system command to get the
        machine architecture instead of using Perl. Calling this command for
        every regex comparison is what previously choked the script, caching
        the result of this call gave the major speed improvement. We add
        support for scanning 32-bit kernels using the user/kernel memory
        split. Path skipping code refactored and simplified (meaning easier
        script configuration). We remove version numbering. We add a variable
        name to improve readability of a regex and finally we check filenames
        for leaking addresses.
      
        Currently script scans /proc/PID for all PID. With this set applied we
        only scan for PID==1. It was observed that on an idle system files
        under /proc/PID are predominantly the same for all processes. Also it
        was noted that the script does not scan _all_ the kernel since it only
        scans active processes. Scanning only for PID==1 makes explicit the
        inherent flaw in the script that the scan is only partial and also
        speeds things up"
      
      * tag 'leaks-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks:
        MAINTAINERS: Update LEAKING_ADDRESSES
        leaking_addresses: check if file name contains address
        leaking_addresses: explicitly name variable used in regex
        leaking_addresses: remove version number
        leaking_addresses: skip '/proc/1/syscall'
        leaking_addresses: skip all /proc/PID except /proc/1
        leaking_addresses: cache architecture name
        leaking_addresses: simplify path skipping
        leaking_addresses: do not parse binary files
        leaking_addresses: add 32-bit support
        leaking_addresses: add is_arch() wrapper subroutine
        leaking_addresses: use system command to get arch
        leaking_addresses: add support for 5 page table levels
        leaking_addresses: add support for kernel config file
        leaking_addresses: add range check for vsyscall memory
        leaking_addresses: indent dependant options
        leaking_addresses: remove command examples
        leaking_addresses: remove mention of kptr_restrict
        leaking_addresses: fix typo function not called
      299f89d5
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-4.17-rc1' of... · fc22e19a
      Linus Torvalds authored
      Merge tag 'linux-kselftest-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest update from Shuah Khan:
       "This Kselftest update for 4.17-rc1 consists of:
      
         - Test build error fixes
      
         - Fixes to prevent intel_pstate from building on non-x86 systems.
      
         - New test for ion with vgem driver.
      
         - Change to print the test name to /dev/kmsg to add context to kernel
           failures if any uncovered from running the test.
      
         - Kselftest framework enhancements to add KSFT_TAP_LEVEL environment
           variable to prevent nested TAP headers being printed in the
           Kselftest output.
      
           Nested TAP13 headers could cause problems for some parsers. This
           change suppresses the nested headers from test programs and test
           shell scripts with changes to framework and Makefiles without
           changing the tests"
      
      * tag 'linux-kselftest-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/intel_pstate: Fix build rule for x86
        selftests: Print the test we're running to /dev/kmsg
        selftests/seccomp: Allow get_metadata to XFAIL
        selftests/android/ion: Makefile: fix build error
        selftests: futex Makefile add top level TAP header echo to RUN_TESTS
        selftests: Makefile set KSFT_TAP_LEVEL to prevent nested TAP headers
        selftests: lib.mk set KSFT_TAP_LEVEL to prevent nested TAP headers
        selftests: kselftest framework: add handling for TAP header level
        selftests: ion: Add simple test with the vgem driver
        selftests: ion: Remove some prints
      fc22e19a
    • Linus Torvalds's avatar
      Merge branch 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 3612605a
      Linus Torvalds authored
      Pull general security layer updates from James Morris:
      
       - Convert security hooks from list to hlist, a nice cleanup, saving
         about 50% of space, from Sargun Dhillon.
      
       - Only pass the cred, not the secid, to kill_pid_info_as_cred and
         security_task_kill (as the secid can be determined from the cred),
         from Stephen Smalley.
      
       - Close a potential race in kernel_read_file(), by making the file
         unwritable before calling the LSM check (vs after), from Kees Cook.
      
      * 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        security: convert security hooks to use hlist
        exec: Set file unwritable before LSM check
        usb, signal, security: only pass the cred, not the secid, to kill_pid_info_as_cred and security_task_kill
      3612605a
    • Linus Torvalds's avatar
      Merge tag 'fscache-next-20180406' of... · 62f8e6c5
      Linus Torvalds authored
      Merge tag 'fscache-next-20180406' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
      
      Pull fscache updates from David Howells:
       "Three patches that fix some of AFS's usage of fscache:
      
         (1) Need to invalidate the cache if a foreign data change is detected
             on the server.
      
         (2) Move the vnode ID uniquifier (equivalent to i_generation) from
             the auxiliary data to the index key to prevent a race between
             file delete and a subsequent file create seeing the same index
             key.
      
         (3) Need to retire cookies that correspond to files that we think got
             deleted on the server.
      
        Four patches to fix some things in fscache and cachefiles:
      
         (4) Fix a couple of checker warnings.
      
         (5) Correctly indicate to the end-of-operation callback whether an
             operation completed or was cancelled.
      
         (6) Add a check for multiple cookie relinquishment.
      
         (7) Fix a path through the asynchronous write that doesn't wake up a
             waiter for a page if the cache decides not to write that page,
             but discards it instead.
      
        A couple of patches to add tracepoints to fscache and cachefiles:
      
         (8) Add tracepoints for cookie operators, object state machine
             execution, cachefiles object management and cachefiles VFS
             operations.
      
         (9) Add tracepoints for fscache operation management and page
             wrangling.
      
        And then three development patches:
      
        (10) Attach the index key and auxiliary data to the cookie, pass this
             information through various fscache-netfs API functions and get
             rid of the callbacks to the netfs to get it.
      
             This means that the cache can get at this information, even if
             the netfs goes away. It also means that the cache can be lazy in
             updating the coherency data.
      
        (11) Pass the object data size through various fscache-netfs API
             rather than calling back to the netfs for it, and store the value
             in the object.
      
             This makes it easier to correctly resize the object, as the size
             is updated on writes to the cache, rather than calling back out
             to the netfs.
      
        (12) Maintain a catalogue of allocated cookies. This makes it possible
             to catch cookie collision up front rather than down in the bowels
             of the cache being run from a service thread from the object
             state machine.
      
             This will also make it possible in the future to reconnect to a
             cookie that's not gone dead yet because it's waiting for
             finalisation of the storage and also make it possible to bring
             cookies online if the cache is added after the cookie has been
             obtained"
      
      * tag 'fscache-next-20180406' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        fscache: Maintain a catalogue of allocated cookies
        fscache: Pass object size in rather than calling back for it
        fscache: Attach the index key and aux data to the cookie
        fscache: Add more tracepoints
        fscache: Add tracepoints
        fscache: Fix hanging wait on page discarded by writeback
        fscache: Detect multiple relinquishment of a cookie
        fscache: Pass the correct cancelled indications to fscache_op_complete()
        fscache, cachefiles: Fix checker warnings
        afs: Be more aggressive in retiring cached vnodes
        afs: Use the vnode ID uniquifier in the cache key not the aux data
        afs: Invalidate cache on server data change
      62f8e6c5
  6. Apr 07, 2018
    • Linus Torvalds's avatar
      Merge tag 'vfio-v4.17-rc1' of git://github.com/awilliam/linux-vfio · f605ba97
      Linus Torvalds authored
      Pull VFIO updates from Alex Williamson:
      
       - Adopt iommu_unmap_fast() interface to type1 backend
         (Suravee Suthikulpanit)
      
       - mdev sample driver fixup (Shunyong Yang)
      
       - More efficient PFN mapping handling in type1 backend
         (Jason Cai)
      
       - VFIO device ioeventfd interface (Alex Williamson)
      
       - Tag new vfio-platform sub-maintainer (Alex Williamson)
      
      * tag 'vfio-v4.17-rc1' of git://github.com/awilliam/linux-vfio:
        MAINTAINERS: vfio/platform: Update sub-maintainer
        vfio/pci: Add ioeventfd support
        vfio/pci: Use endian neutral helpers
        vfio/pci: Pull BAR mapping setup from read-write path
        vfio/type1: Improve memory pinning process for raw PFN mapping
        vfio-mdev/samples: change RDI interrupt condition
        vfio/type1: Adopt fast IOTLB flush interface when unmap IOVAs
      f605ba97
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 016c6f25
      Linus Torvalds authored
      Pull fw_cfg, vhost updates from Michael Tsirkin:
       "This cleans up the qemu fw cfg device driver.
      
        On top of this, vmcore is dumped there on crash to help debugging
        with kASLR enabled.
      
        Also included are some fixes in vhost"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost: add vsock compat ioctl
        vhost: fix vhost ioctl signature to build with clang
        fw_cfg: write vmcoreinfo details
        crash: export paddr_vmcoreinfo_note()
        fw_cfg: add DMA register
        fw_cfg: add a public uapi header
        fw_cfg: handle fw_cfg_read_blob() error
        fw_cfg: remove inline from fw_cfg_read_blob()
        fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read
        fw_cfg: fix sparse warning reading FW_CFG_ID
        fw_cfg: fix sparse warnings with fw_cfg_file
        fw_cfg: fix sparse warnings in fw_cfg_sel_endianness()
        ptr_ring: fix build
      016c6f25
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 3c0d551e
      Linus Torvalds authored
      Pull PCI updates from Bjorn Helgaas:
      
       - move pci_uevent_ers() out of pci.h (Michael Ellerman)
      
       - skip ASPM common clock warning if BIOS already configured it (Sinan
         Kaya)
      
       - fix ASPM Coverity warning about threshold_ns (Gustavo A. R. Silva)
      
       - remove last user of pci_get_bus_and_slot() and the function itself
         (Sinan Kaya)
      
       - add decoding for 16 GT/s link speed (Jay Fang)
      
       - add interfaces to get max link speed and width (Tal Gilboa)
      
       - add pcie_bandwidth_capable() to compute max supported link bandwidth
         (Tal Gilboa)
      
       - add pcie_bandwidth_available() to compute bandwidth available to
         device (Tal Gilboa)
      
       - add pcie_print_link_status() to log link speed and whether it's
         limited (Tal Gilboa)
      
       - use PCI core interfaces to report when device performance may be
         limited by its slot instead of doing it in each driver (Tal Gilboa)
      
       - fix possible cpqphp NULL pointer dereference (Shawn Lin)
      
       - rescan more of the hierarchy on ACPI hotplug to fix Thunderbolt/xHCI
         hotplug (Mika Westerberg)
      
       - add support for PCI I/O port space that's neither directly accessible
         via CPU in/out instructions nor directly mapped into CPU physical
         memory space. This is fairly intrusive and includes minor changes to
         interfaces used for I/O space on most platforms (Zhichang Yuan, John
         Garry)
      
       - add support for HiSilicon Hip06/Hip07 LPC I/O space (Zhichang Yuan,
         John Garry)
      
       - use PCI_EXP_DEVCTL2_COMP_TIMEOUT in rapidio/tsi721 (Bjorn Helgaas)
      
       - remove possible NULL pointer dereference in of_pci_bus_find_domain_nr()
         (Shawn Lin)
      
       - report quirk timings with dev_info (Bjorn Helgaas)
      
       - report quirks that take longer than 10ms (Bjorn Helgaas)
      
       - add and use Altera Vendor ID (Johannes Thumshirn)
      
       - tidy Makefiles and comments (Bjorn Helgaas)
      
       - don't set up INTx if MSI or MSI-X is enabled to align cris, frv,
         ia64, and mn10300 with x86 (Bjorn Helgaas)
      
       - move pcieport_if.h to drivers/pci/pcie/ to encapsulate it (Frederick
         Lawler)
      
       - merge pcieport_if.h into portdrv.h (Bjorn Helgaas)
      
       - move workaround for BIOS PME issue from portdrv to PCI core (Bjorn
         Helgaas)
      
       - completely disable portdrv with "pcie_ports=compat" (Bjorn Helgaas)
      
       - remove portdrv link order dependency (Bjorn Helgaas)
      
       - remove support for unused VC portdrv service (Bjorn Helgaas)
      
       - simplify portdrv feature permission checking (Bjorn Helgaas)
      
       - remove "pcie_hp=nomsi" parameter (use "pci=nomsi" instead) (Bjorn
         Helgaas)
      
       - remove unnecessary "pcie_ports=auto" parameter (Bjorn Helgaas)
      
       - use cached AER capability offset (Frederick Lawler)
      
       - don't enable DPC if BIOS hasn't granted AER control (Mika Westerberg)
      
       - rename pcie-dpc.c to dpc.c (Bjorn Helgaas)
      
       - use generic pci_mmap_resource_range() instead of powerpc and xtensa
         arch-specific versions (David Woodhouse)
      
       - support arbitrary PCI host bridge offsets on sparc (Yinghai Lu)
      
       - remove System and Video ROM reservations on sparc (Bjorn Helgaas)
      
       - probe for device reset support during enumeration instead of runtime
         (Bjorn Helgaas)
      
       - add ACS quirk for Ampere (née APM) root ports (Feng Kan)
      
       - add function 1 DMA alias quirk for Marvell 88SE9220 (Thomas
         Vincent-Cross)
      
       - protect device restore with device lock (Sinan Kaya)
      
       - handle failure of FLR gracefully (Sinan Kaya)
      
       - handle CRS (config retry status) after device resets (Sinan Kaya)
      
       - skip various config reads for SR-IOV VFs as an optimization
         (KarimAllah Ahmed)
      
       - consolidate VPD code in vpd.c (Bjorn Helgaas)
      
       - add Tegra dependency on PCI_MSI_IRQ_DOMAIN (Arnd Bergmann)
      
       - add DT support for R-Car r8a7743 (Biju Das)
      
       - fix a PCI_EJECT vs PCI_BUS_RELATIONS race condition in Hyper-V host
         bridge driver that causes a general protection fault (Dexuan Cui)
      
       - fix Hyper-V host bridge hang in MSI setup on 1-vCPU VMs with SR-IOV
         (Dexuan Cui)
      
       - fix Hyper-V host bridge hang when ejecting a VF before setting up MSI
         (Dexuan Cui)
      
       - make several structures static (Fengguang Wu)
      
       - increase number of MSI IRQs supported by Synopsys DesignWare bridges
         from 32 to 256 (Gustavo Pimentel)
      
       - implemented multiplexed IRQ domain API and remove obsolete MSI IRQ
         API from DesignWare drivers (Gustavo Pimentel)
      
       - add Tegra power management support (Manikanta Maddireddy)
      
       - add Tegra loadable module support (Manikanta Maddireddy)
      
       - handle 64-bit BARs correctly in endpoint support (Niklas Cassel)
      
       - support optional regulator for HiSilicon STB (Shawn Guo)
      
       - use regulator bulk API for Qualcomm apq8064 (Srinivas Kandagatla)
      
       - support power supplies for Qualcomm msm8996 (Srinivas Kandagatla)
      
      * tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (123 commits)
        MAINTAINERS: Add John Garry as maintainer for HiSilicon LPC driver
        HISI LPC: Add ACPI support
        ACPI / scan: Do not enumerate Indirect IO host children
        ACPI / scan: Rename acpi_is_serial_bus_slave() for more general use
        HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings
        of: Add missing I/O range exception for indirect-IO devices
        PCI: Apply the new generic I/O management on PCI IO hosts
        PCI: Add fwnode handler as input param of pci_register_io_range()
        PCI: Remove __weak tag from pci_register_io_range()
        MAINTAINERS: Add missing /drivers/pci/cadence directory entry
        fm10k: Report PCIe link properties with pcie_print_link_status()
        net/mlx5e: Use pcie_bandwidth_available() to compute bandwidth
        net/mlx5: Report PCIe link properties with pcie_print_link_status()
        net/mlx4_core: Report PCIe link properties with pcie_print_link_status()
        PCI: Add pcie_print_link_status() to log link speed and whether it's limited
        PCI: Add pcie_bandwidth_available() to compute bandwidth available to device
        misc: pci_endpoint_test: Handle 64-bit BARs properly
        PCI: designware-ep: Make dw_pcie_ep_reset_bar() handle 64-bit BARs properly
        PCI: endpoint: Make sure that BAR_5 does not have 64-bit flag set when clearing
        PCI: endpoint: Make epc->ops->clear_bar()/pci_epc_clear_bar() take struct *epf_bar
        ...
      3c0d551e
    • Linus Torvalds's avatar
      Merge tag 'for-linus-unmerged' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 19fd08b8
      Linus Torvalds authored
      Pull rdma updates from Jason Gunthorpe:
       "Doug and I are at a conference next week so if another PR is sent I
        expect it to only be bug fixes. Parav noted yesterday that there are
        some fringe case behavior changes in his work that he would like to
        fix, and I see that Intel has a number of rc looking patches for HFI1
        they posted yesterday.
      
        Parav is again the biggest contributor by patch count with his ongoing
        work to enable container support in the RDMA stack, followed by Leon
        doing syzkaller inspired cleanups, though most of the actual fixing
        went to RC.
      
        There is one uncomfortable series here fixing the user ABI to actually
        work as intended in 32 bit mode. There are lots of notes in the commit
        messages, but the basic summary is we don't think there is an actual
        32 bit kernel user of drivers/infiniband for several good reasons.
      
        However we are seeing people want to use a 32 bit user space wi...
      19fd08b8
    • Linus Torvalds's avatar
      Merge tag 'mailbox-v4.17' of git://git.linaro.org/landing-teams/working/fujitsu/integration · 28da7be5
      Linus Torvalds authored
      Pull mailbox updates from Jassi Brar:
      
       - New Hi3660 mailbox driver
      
       - Fix TEGRA Kconfig warning
      
       - Broadcom: use dma_pool_zalloc instead of dma_pool_alloc+memset
      
      * tag 'mailbox-v4.17' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
        mailbox: Add support for Hi3660 mailbox
        dt-bindings: mailbox: Introduce Hi3660 controller binding
        mailbox: tegra: relax TEGRA_HSP_MBOX Kconfig dependencies
        maillbox: bcm-flexrm-mailbox: Use dma_pool_zalloc()
      28da7be5
    • Tobin C. Harding's avatar
      MAINTAINERS: Update LEAKING_ADDRESSES · e875d33d
      Tobin C. Harding authored
      
      
      MAINTAINERS is out of date for leaking_addresses.pl. There is now a tree on
      kernel.org for development of this script.  We have a second maintainer now,
      thanks Tycho.  Development of this scripts was started on kernel-hardening
      mailing list so let's keep it there.
      
      Update maintainer details; Add mailing list, kernel.org hosted tree, and second
      maintainer.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      e875d33d
    • Tobin C. Harding's avatar
      leaking_addresses: check if file name contains address · c73dff59
      Tobin C. Harding authored
      
      
      Sometimes files may be created by using output from printk.  As the scan
      traverses the directory tree we should parse each path name and check if
      it is leaking an address.
      
      Add check for leaking address on each path name.
      
      Suggested-by: default avatarTycho Andersen <tycho@tycho.ws>
      Acked-by: default avatarTycho Andersen <tycho@tycho.ws>
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      c73dff59
    • Tobin C. Harding's avatar
      leaking_addresses: explicitly name variable used in regex · 2306a677
      Tobin C. Harding authored
      
      
      Currently sub routine may_leak_address() is checking regex against Perl
      special variable $_ which is _fortunately_ being set correctly in a loop
      before this sub routine is called.  We already have declared a variable
      to hold this value '$line' we should use it.
      
      Use $line in regex match instead of implicit $_
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      2306a677
    • Tobin C. Harding's avatar
      leaking_addresses: remove version number · 34827374
      Tobin C. Harding authored
      
      
      We have git now, we don't need a version number.  This was originally
      added because leaking_addresses.pl shamelessly (and mindlessly) copied
      checkpatch.pl
      
      Remove version number from script.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      34827374
    • Tobin C. Harding's avatar
      leaking_addresses: skip '/proc/1/syscall' · 2ad74293
      Tobin C. Harding authored
      
      
      The pointers listed in /proc/1/syscall are user pointers, and negative
      syscall args will show up like kernel addresses.
      
      For example
      
      /proc/31808/syscall: 0 0x3 0x55b107a38180 0x2000 0xffffffffffffffb0 \
      0x55b107a302d0 0x55b107a38180 0x7fffa313b8e8 0x7ff098560d11
      
      Skip parsing /proc/1/syscall
      
      Suggested-by: default avatarTycho Andersen <tycho@tycho.ws>
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      2ad74293
    • Tobin C. Harding's avatar
      leaking_addresses: skip all /proc/PID except /proc/1 · 472c9e10
      Tobin C. Harding authored
      
      
      When the system is idle it is likely that most files under /proc/PID
      will be identical for various processes.  Scanning _all_ the PIDs under
      /proc is unnecessary and implies that we are thoroughly scanning /proc.
      This is _not_ the case because there may be ways userspace can trigger
      creation of /proc files that leak addresses but were not present during
      a scan.  For these two reasons we should exclude all PID directories
      under /proc except '1/'
      
      Exclude all /proc/PID except /proc/1.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      472c9e10
    • Tobin C. Harding's avatar
      leaking_addresses: cache architecture name · 5e4bac34
      Tobin C. Harding authored
      
      
      Currently we are repeatedly calling `uname -m`.  This is causing the
      script to take a long time to run (more than 10 seconds to parse
      /proc/kallsyms).  We can use Perl state variables to cache the result of
      the first call to `uname -m`.  With this change in place the script
      scans the whole kernel in under a minute.
      
      Cache machine architecture in state variable.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      5e4bac34
    • Tobin C. Harding's avatar
      leaking_addresses: simplify path skipping · b401f56f
      Tobin C. Harding authored
      
      
      Currently script has multiple configuration arrays.  This is confusing,
      evident by the fact that a bunch of the entries are in the wrong place.
      We can simplify the code by just having a single array for absolute
      paths to skip and a single array for file names to skip wherever they
      appear in the scanned directory tree.  There are also currently multiple
      subroutines to handle the different arrays, we can reduce these to a
      single subroutine also.
      
      Simplify the path skipping code.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      b401f56f
    • Tobin C. Harding's avatar
      leaking_addresses: do not parse binary files · e2858cad
      Tobin C. Harding authored
      
      
      Currently script parses binary files.  Since we are scanning for
      readable kernel addresses there is no need to parse binary files.  We
      can use Perl to check if file is binary and skip parsing it if so.
      
      Do not parse binary files.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      e2858cad
    • Tobin C. Harding's avatar
      leaking_addresses: add 32-bit support · 1410fe4e
      Tobin C. Harding authored
      
      
      Currently script only supports x86_64 and ppc64.  It would be nice to be
      able to scan 32-bit machines also.  We can add support for 32-bit
      architectures by modifying how we check for false positives, taking
      advantage of the page offset used by the kernel, and using the correct
      regular expression.
      
      Support for 32-bit machines is enabled by the observation that the kernel
      addresses on 32-bit machines are larger [in value] than the page offset.
      We can use this to filter false positives when scanning the kernel for
      leaking addresses.
      
      Programmatic determination of the running architecture is not
      immediately obvious (current 32-bit machines return various strings from
      `uname -m`).  We therefore provide a flag to enable scanning of 32-bit
      kernels.  Also we can check the kernel config file for the offset and if
      not found default to 0xc0000000.  A command line option to parse in the
      page offset is also provided.  We do automatically detect architecture
      if running on ix86.
      
      Add support for 32-bit kernels.  Add a command line option for page
      offset.
      
      Suggested-by: default avatarKaiwan N Billimoria <kaiwan.billimoria@gmail.com>
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      1410fe4e
    • Tobin C. Harding's avatar
      leaking_addresses: add is_arch() wrapper subroutine · 5eb0da05
      Tobin C. Harding authored
      
      
      Currently there is duplicate code when checking the architecture type.
      We can remove the duplication by implementing a wrapper function
      is_arch().
      
      Implement and use wrapper function is_arch().
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      5eb0da05
    • Tobin C. Harding's avatar
      leaking_addresses: use system command to get arch · 6efb7458
      Tobin C. Harding authored
      
      
      Currently script uses Perl to get the machine architecture. This can be
      erroneous since Perl uses the architecture of the machine that Perl was
      compiled on not the architecture of the running machine. We should use
      the systems `uname` command instead.
      
      Use `uname -m` instead of Perl to get the machine architecture.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      6efb7458
    • Tobin C. Harding's avatar
      leaking_addresses: add support for 5 page table levels · 2f042c93
      Tobin C. Harding authored
      
      
      Currently script only supports 4 page table levels because of the way
      the kernel address regular expression is crafted. We can do better than
      this. Using previously added support for kernel configuration options we
      can get the number of page table levels defined by
      CONFIG_PGTABLE_LEVELS. Using this value a correct regular expression can
      be crafted. This only supports 5 page tables on x86_64.
      
      Add support for 5 page table levels on x86_64.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      2f042c93
    • Tobin C. Harding's avatar
      leaking_addresses: add support for kernel config file · f9d2a42d
      Tobin C. Harding authored
      
      
      Features that rely on the ability to get kernel configuration options
      are ready to be implemented in script. In preparation for this we can
      add support for kernel config options as a separate patch to ease
      review.
      
      Add support for locating and parsing kernel configuration file.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      f9d2a42d
    • Tobin C. Harding's avatar
      leaking_addresses: add range check for vsyscall memory · 87e37588
      Tobin C. Harding authored
      
      
      Currently script checks only first and last address in the vsyscall
      memory range. We can do better than this. When checking for false
      positives against $match, we can convert $match to a hexadecimal value
      then check if it lies within the range of vsyscall addresses.
      
      Check whole range of vsyscall addresses when checking for false
      positive.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      87e37588
    • Tobin C. Harding's avatar
      leaking_addresses: indent dependant options · 15d60a35
      Tobin C. Harding authored
      
      
      A number of the command line options to script are dependant on the
      option --input-raw being set. If we indent these options it makes
      explicit this dependency.
      
      Indent options dependant on --input-raw.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      15d60a35
    • Tobin C. Harding's avatar
      leaking_addresses: remove command examples · 6145de83
      Tobin C. Harding authored
      
      
      Currently help output includes command examples. These were cute when we
      first started development of this script but are unnecessary.
      
      Remove command examples.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      6145de83
    • Tobin C. Harding's avatar
      leaking_addresses: remove mention of kptr_restrict · 20cdfb5f
      Tobin C. Harding authored
      
      
      leaking_addresses.pl can be run with kptr_restrict==0 now, we don't need
      the comment about setting kptr_restrict any more.
      
      Remove comment suggesting setting kptr_restrict.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      20cdfb5f
    • Tobin C. Harding's avatar
      leaking_addresses: fix typo function not called · 6d23dd9b
      Tobin C. Harding authored
      
      
      Currently code uses a check against an undefined variable because the
      variable is a sub routine name and is not evaluated.
      
      Evaluate subroutine; add parenthesis to sub routine name.
      
      Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
      6d23dd9b
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · 9eda2d2d
      Linus Torvalds authored
      Pull SELinux updates from Paul Moore:
       "A bigger than usual pull request for SELinux, 13 patches (lucky!)
        along with a scary looking diffstat.
      
        Although if you look a bit closer, excluding the usual minor
        tweaks/fixes, there are really only two significant changes in this
        pull request: the addition of proper SELinux access controls for SCTP
        and the encapsulation of a lot of internal SELinux state.
      
        The SCTP changes are the result of a multi-month effort (maybe even a
        year or longer?) between the SELinux folks and the SCTP folks to add
        proper SELinux controls. A special thanks go to Richard for seeing
        this through and keeping the effort moving forward.
      
        The state encapsulation work is a bit of janitorial work that came out
        of some early work on SELinux namespacing. The question of namespacing
        is still an open one, but I believe there is some real value in the
        encapsulation work so we've split that out and are now sending that up
        to you"
      
      * tag 'selinux-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: wrap AVC state
        selinux: wrap selinuxfs state
        selinux: fix handling of uninitialized selinux state in get_bools/classes
        selinux: Update SELinux SCTP documentation
        selinux: Fix ltp test connect-syscall failure
        selinux: rename the {is,set}_enforcing() functions
        selinux: wrap global selinux state
        selinux: fix typo in selinux_netlbl_sctp_sk_clone declaration
        selinux: Add SCTP support
        sctp: Add LSM hooks
        sctp: Add ip option support
        security: Add support for SCTP security hooks
        netlabel: If PF_INET6, check sk_buff ip header version
      9eda2d2d
    • Linus Torvalds's avatar
      Merge tag 'audit-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit · 6ad11bdd
      Linus Torvalds authored
      Pull audit updates from Paul Moore:
       "We didn't have anything to send for v4.16, but we're back with a
        little more than usual for v4.17.
      
        Eleven patches in total, most fall into the small fix category, but
        there are three non-trivial changes worth calling out:
      
         - the audit entry filter is being removed after deprecating it for
           quite a while (years of no one really using it because it turns out
           to be not very practical)
      
         - created our own version of "__mutex_owner()" because the locking
           folks were upset we were using theirs
      
         - improved our handling of kernel command line parameters to make
           them more forgiving
      
         - we fixed auditing of symlink operations
      
        Everything passes the audit-testsuite and as of a few minutes ago it
        merges well with your tree"
      
      * tag 'audit-pr-20180403' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
        audit: add refused symlink to audit_names
        audit: remove path param from link denied function
        audit: link denied should not directly generate PATH record
        audit: make ANOM_LINK obey audit_enabled and audit_dummy_context
        audit: do not panic on invalid boot parameter
        audit: track the owner of the command mutex ourselves
        audit: return on memory error to avoid null pointer dereference
        audit: bail before bug check if audit disabled
        audit: deprecate the AUDIT_FILTER_ENTRY filter
        audit: session ID should not set arch quick field pointer
        audit: update bugtracker and source URIs
      6ad11bdd
    • Linus Torvalds's avatar
      Merge tag 'pstore-v4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 69824bcc
      Linus Torvalds authored
      Pull pstore updates from Kees Cook:
       "This cycle was almost entirely improvements to the pstore compression
        options, noted below:
      
         - Add lz4hc and 842 to pstore compression options (Geliang Tang)
      
         - Refactor to use crypto compression API (Geliang Tang)
      
         - Fix up Kconfig dependencies for compression (Arnd Bergmann)
      
         - Allow for run-time compression selection
      
         - Remove stack VLA usage"
      
      * tag 'pstore-v4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore: fix crypto dependencies
        pstore: Use crypto compress API
        pstore/ram: Do not use stack VLA for parity workspace
        pstore: Select compression at runtime
        pstore: Avoid size casts for 842 compression
        pstore: Add lz4hc and 842 compression support
      69824bcc