1. 18 Apr, 2018 1 commit
    • Jan Kara's avatar
      udf: Fix leak of UTF-16 surrogates into encoded strings · 44f06ba8
      Jan Kara authored
      OSTA UDF specification does not mention whether the CS0 charset in case
      of two bytes per character encoding should be treated in UTF-16 or
      UCS-2. The sample code in the standard does not treat UTF-16 surrogates
      in any special way but on systems such as Windows which work in UTF-16
      internally, filenames would be treated as being in UTF-16 effectively.
      In Linux it is more difficult to handle characters outside of Base
      Multilingual plane (beyond 0xffff) as NLS framework works with 2-byte
      characters only. Just make sure we don't leak UTF-16 surrogates into the
      resulting string when loading names from the filesystem for now.
      
      CC: stable@vger.kernel.org # >= v4.6
      Reported-by: default avatarMingye Wang <arthur200126@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      44f06ba8
  2. 16 Apr, 2018 2 commits
  3. 13 Apr, 2018 3 commits
  4. 11 Apr, 2018 1 commit
  5. 09 Apr, 2018 2 commits
    • Jia-Ju Bai's avatar
      fs: quota: Replace GFP_ATOMIC with GFP_KERNEL in dquot_init · 1aa3b3e0
      Jia-Ju Bai authored
      dquot_init() is never called in atomic context.
      This function is only set as a parameter of fs_initcall().
      
      Despite never getting called from atomic context,
      dquot_init() calls __get_free_pages() with GFP_ATOMIC,
      which waits busily for allocation.
      GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
      to avoid busy waiting and improve the possibility of sucessful allocation.
      
      This is found by a static analysis tool named DCNS written by myself.
      And I also manually check it.
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      1aa3b3e0
    • Amir Goldstein's avatar
      fanotify: fix logic of events on child · 54a307ba
      Amir Goldstein authored
      When event on child inodes are sent to the parent inode mark and
      parent inode mark was not marked with FAN_EVENT_ON_CHILD, the event
      will not be delivered to the listener process. However, if the same
      process also has a mount mark, the event to the parent inode will be
      delivered regadless of the mount mark mask.
      
      This behavior is incorrect in the case where the mount mark mask does
      not contain the specific event type. For example, the process adds
      a mark on a directory with mask FAN_MODIFY (without FAN_EVENT_ON_CHILD)
      and a mount mark with mask FAN_CLOSE_NOWRITE (without FAN_ONDIR).
      
      A modify event on a file inside that directory (and inside that mount)
      should not create a FAN_MODIFY event, because neither of the marks
      requested to get that event on the file.
      
      Fixes: 1968f5ee ("fanotify: use both marks when possible")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      54a307ba
  6. 07 Apr, 2018 17 commits
    • Linus Torvalds's avatar
      Merge branch 'next-integrity' of... · f8cf2f16
      Linus Torvalds authored
      Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
      
      Pull integrity updates from James Morris:
       "A mixture of bug fixes, code cleanup, and continues to close
        IMA-measurement, IMA-appraisal, and IMA-audit gaps.
      
        Also note the addition of a new cred_getsecid LSM hook by Matthew
        Garrett:
      
           For IMA purposes, we want to be able to obtain the prepared secid
           in the bprm structure before the credentials are committed. Add a
           cred_getsecid hook that makes this possible.
      
        which is used by a new CREDS_CHECK target in IMA:
      
           In ima_bprm_check(), check with both the existing process
           credentials and the credentials that will be committed when the new
           process is started. This will not change behaviour unless the
           system policy is extended to include CREDS_CHECK targets -
           BPRM_CHECK will continue to check the same credentials that it did
           previously"
      
      * 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        ima: Fallback to the builtin hash algorithm
        ima: Add smackfs to the default appraise/measure list
        evm: check for remount ro in progress before writing
        ima: Improvements in ima_appraise_measurement()
        ima: Simplify ima_eventsig_init()
        integrity: Remove unused macro IMA_ACTION_RULE_FLAGS
        ima: drop vla in ima_audit_measurement()
        ima: Fix Kconfig to select TPM 2.0 CRB interface
        evm: Constify *integrity_status_msg[]
        evm: Move evm_hmac and evm_hash from evm_main.c to evm_crypto.c
        fuse: define the filesystem as untrusted
        ima: fail signature verification based on policy
        ima: clear IMA_HASH
        ima: re-evaluate files on privileged mounted filesystems
        ima: fail file signature verification on non-init mounted filesystems
        IMA: Support using new creds in appraisal policy
        security: Add a cred_getsecid hook
      f8cf2f16
    • Linus Torvalds's avatar
      Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 4b3f1a15
      Linus Torvalds authored
      Pull TPM updates from James Morris:
       "This release contains only bug fixes. There are no new major features
        added"
      
      * 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        tpm: fix intermittent failure with self tests
        tpm: add retry logic
        tpm: self test failure should not cause suspend to fail
        tpm2: add longer timeouts for creation commands.
        tpm_crb: use __le64 annotated variable for response buffer address
        tpm: fix buffer type in tpm_transmit_cmd
        tpm: tpm-interface: fix tpm_transmit/_cmd kdoc
        tpm: cmd_ready command can be issued only after granting locality
      4b3f1a15
    • Linus Torvalds's avatar
      Merge branch 'next-smack' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 706ffc8c
      Linus Torvalds authored
      Pull smack update from James Morris:
       "One small change for Automotive Grade Linux"
      
      * 'next-smack' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        Smack: Handle CGROUP2 in the same way that CGROUP
      706ffc8c
    • Linus Torvalds's avatar
      Merge branch 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · bf6879dc
      Linus Torvalds authored
      Pull alpha syscall cleanups from Al Viro:
       "A couple of SYSCALL_DEFINE conversions and removal of pointless (and
        bitrotted) piece stuck in ret_from_kernel_thread since the
        kernel_exceve/kernel_thread conversions six years ago"
      
      * 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        alpha: get rid of pointless insn in ret_from_kernel_thread
        alpha: switch pci syscalls to SYSCALL_DEFINE
      bf6879dc
    • Linus Torvalds's avatar
      Merge branch 'misc.sparc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 8844a509
      Linus Torvalds authored
      Pull sparc syscall cleanups from Al Viro:
       "sparc syscall stuff - killing pointless wrappers, conversions to
        {COMPAT_,}SYSCALL_DEFINE"
      
      * 'misc.sparc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        sparc: get rid of asm wrapper for nis_syscall()
        sparc: switch compat {f,}truncate64() to COMPAT_SYSCALL_DEFINE
        sparc: switch compat pread64 and pwrite64 to COMPAT_SYSCALL_DEFINE
        convert compat sync_file_range() to COMPAT_SYSCALL_DEFINE
        switch sparc_remap_file_pages() to SYSCALL_DEFINE
        sparc: get rid of memory_ordering(2) wrapper
        sparc: trivial conversions to {COMPAT_,}SYSCALL_DEFINE()
        sparc: bury a zombie extern that had been that way for twenty years
        sparc: get rid of remaining SIGN... wrappers
        sparc: kill useless SIGN... wrappers
        sparc: get rid of sys_sparc_pipe() wrappers
      8844a509
    • Linus Torvalds's avatar
      treewide: fix up files incorrectly marked executable · 90fda63f
      Linus Torvalds authored
      Joe Perches noted that we have a few source files that for some
      inexplicable reason (read: I'm too lazy to even go look at the history)
      are marked executable:
      
        drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
        drivers/net/ethernet/cadence/macb_ptp.c
      
      A simple git command line to show executable C/asm/header files is this:
      
          git ls-files -s '*.[chsS]' | grep '^100755'
      
      and then you can fix them up with scripting by just feeding that output
      into:
      
          | cut -f2 | xargs chmod -x
      
      and commit it.
      
      Which is exactly what this commit does.
      Reported-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      90fda63f
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 0d5b1bd3
      Linus Torvalds authored
      Pull i2c updates from Wolfram Sang:
      
       -I2C core now reports proper OF style module alias. I'd like to repeat
        the note from the commit msg here (Thanks, Javier!):
      
            NOTE: This patch may break out-of-tree drivers that were relying
                  on this behavior, and only had an I2C device ID table even
                  when the device was registered via OF.
      
                  There are no remaining drivers in mainline that do this, but
                  out-of-tree drivers have to be fixed and define a proper OF
                  device ID table to have module auto-loading working.
      
       - new driver for the SynQuacer I2C controller
      
       - major refactoring of the QUP driver
      
       - the piix4 driver now uses request_muxed_region which should fix a
         long standing resource conflict with the sp5100_tco watchdog
      
       - a bunch of small core & driver improvements
      
      * 'i2c/for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (53 commits)
        i2c: add support for Socionext SynQuacer I2C controller
        dt-bindings: i2c: add binding for Socionext SynQuacer I2C
        i2c: Update i2c_trace_msg static key to modern api
        i2c: fix parameter of trace_i2c_result
        i2c: imx: avoid taking clk_prepare mutex in PM callbacks
        i2c: imx: use clk notifier for rate changes
        i2c: make i2c_check_addr_validity() static
        i2c: rcar: fix mask value of prohibited bit
        dt-bindings: i2c: document R8A77965 bindings
        i2c: pca-platform: drop gpio from platform data
        i2c: pca-platform: use device_property_read_u32
        i2c: pca-platform: unconditionally use devm_gpiod_get_optional
        sh: sh7785lcr: add GPIO lookup table for i2c controller reset
        i2c: qup: reorganization of driver code to remove polling for qup v2
        i2c: qup: reorganization of driver code to remove polling for qup v1
        i2c: qup: send NACK for last read sub transfers
        i2c: qup: fix buffer overflow for multiple msg of maximum xfer len
        i2c: qup: change completion timeout according to transfer length
        i2c: qup: use the complete transfer length to choose DMA mode
        i2c: qup: proper error handling for i2c error in BAM mode
        ...
      0d5b1bd3
    • 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
    • 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 with 64
        bit kernel, which didn't completely work today. So in fixing it we
        required a 32 bit rxe user to upgrade their userspace. rxe users are
        still already quite rare and we think a 32 bit one is non-existing.
      
         - Fix RDMA uapi headers to actually compile in userspace and be more
           complete
      
         - Three shared with netdev pull requests from Mellanox:
      
            * 7 patches, mostly to net with 1 IB related one at the back).
              This series addresses an IRQ performance issue (patch 1),
              cleanups related to the fix for the IRQ performance problem
              (patches 2-6), and then extends the fragmented completion queue
              support that already exists in the net side of the driver to the
              ib side of the driver (patch 7).
      
            * Mostly IB, with 5 patches to net that are needed to support the
              remaining 10 patches to the IB subsystem. This series extends
              the current 'representor' framework when the mlx5 driver is in
              switchdev mode from being a netdev only construct to being a
              netdev/IB dev construct. The IB dev is limited to raw Eth queue
              pairs only, but by having an IB dev of this type attached to the
              representor for a switchdev port, it enables DPDK to work on the
              switchdev device.
      
            * All net related, but needed as infrastructure for the rdma
              driver
      
         - Updates for the hns, i40iw, bnxt_re, cxgb3, cxgb4, hns drivers
      
         - SRP performance updates
      
         - IB uverbs write path cleanup patch series from Leon
      
         - Add RDMA_CM support to ib_srpt. This is disabled by default. Users
           need to set the port for ib_srpt to listen on in configfs in order
           for it to be enabled
           (/sys/kernel/config/target/srpt/discovery_auth/rdma_cm_port)
      
         - TSO and Scatter FCS support in mlx4
      
         - Refactor of modify_qp routine to resolve problems seen while
           working on new code that is forthcoming
      
         - More refactoring and updates of RDMA CM for containers support from
           Parav
      
         - mlx5 'fine grained packet pacing', 'ipsec offload' and 'device
           memory' user API features
      
         - Infrastructure updates for the new IOCTL interface, based on
           increased usage
      
         - ABI compatibility bug fixes to fully support 32 bit userspace on 64
           bit kernel as was originally intended. See the commit messages for
           extensive details
      
         - Syzkaller bugs and code cleanups motivated by them"
      
      * tag 'for-linus-unmerged' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (199 commits)
        IB/rxe: Fix for oops in rxe_register_device on ppc64le arch
        IB/mlx5: Device memory mr registration support
        net/mlx5: Mkey creation command adjustments
        IB/mlx5: Device memory support in mlx5_ib
        net/mlx5: Query device memory capabilities
        IB/uverbs: Add device memory registration ioctl support
        IB/uverbs: Add alloc/free dm uverbs ioctl support
        IB/uverbs: Add device memory capabilities reporting
        IB/uverbs: Expose device memory capabilities to user
        RDMA/qedr: Fix wmb usage in qedr
        IB/rxe: Removed GID add/del dummy routines
        RDMA/qedr: Zero stack memory before copying to user space
        IB/mlx5: Add ability to hash by IPSEC_SPI when creating a TIR
        IB/mlx5: Add information for querying IPsec capabilities
        IB/mlx5: Add IPsec support for egress and ingress
        {net,IB}/mlx5: Add ipsec helper
        IB/mlx5: Add modify_flow_action_esp verb
        IB/mlx5: Add implementation for create and destroy action_xfrm
        IB/uverbs: Introduce ESP steering match filter
        IB/uverbs: Add modify ESP flow_action
        ...
      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
  7. 06 Apr, 2018 14 commits
    • 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