1. 14 Aug, 2019 9 commits
  2. 09 Aug, 2019 13 commits
    • Will Deacon's avatar
      arm64: mm: Simplify definition of virt_addr_valid() · d2d73d2f
      Will Deacon authored
      _virt_addr_valid() is defined as the same value in two places and rolls
      its own version of virt_to_pfn() in both cases.
      
      Consolidate these definitions by inlining a simplified version directly
      into virt_addr_valid().
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      d2d73d2f
    • Steve Capper's avatar
      docs: arm64: Add layout and 52-bit info to memory document · d2c68de1
      Steve Capper authored
      As the kernel no longer prints out the memory layout on boot, this patch
      adds this information back to the memory document.
      
      Also, as the 52-bit support introduces some subtle changes to the arm64
      memory, the rationale behind these changes are also added to the memory
      document.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      d2c68de1
    • Steve Capper's avatar
      arm64: mm: Remove vabits_user · 2c624fe6
      Steve Capper authored
      Previous patches have enabled 52-bit kernel + user VAs and there is no
      longer any scenario where user VA != kernel VA size.
      
      This patch removes the, now redundant, vabits_user variable and replaces
      usage with vabits_actual where appropriate.
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      2c624fe6
    • Steve Capper's avatar
      arm64: mm: Introduce 52-bit Kernel VAs · b6d00d47
      Steve Capper authored
      Most of the machinery is now in place to enable 52-bit kernel VAs that
      are detectable at boot time.
      
      This patch adds a Kconfig option for 52-bit user and kernel addresses
      and plumbs in the requisite CONFIG_ macros as well as sets TCR.T1SZ,
      physvirt_offset and vmemmap at early boot.
      
      To simplify things this patch also removes the 52-bit user/48-bit kernel
      kconfig option.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      b6d00d47
    • Steve Capper's avatar
      arm64: mm: Modify calculation of VMEMMAP_SIZE · ce3aaed8
      Steve Capper authored
      In a later patch we will need to have a slightly larger VMEMMAP region
      to accommodate boot time selection between 48/52-bit kernel VAs.
      
      This patch modifies the formula for computing VMEMMAP_SIZE to depend
      explicitly on the PAGE_OFFSET and start of kernel addressable memory.
      (This allows for a slightly larger direct linear map in future).
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      ce3aaed8
    • Steve Capper's avatar
      arm64: mm: Separate out vmemmap · c8b6d2cc
      Steve Capper authored
      vmemmap is a preprocessor definition that depends on a variable,
      memstart_addr. In a later patch we will need to expand the size of
      the VMEMMAP region and optionally modify vmemmap depending upon
      whether or not hardware support is available for 52-bit virtual
      addresses.
      
      This patch changes vmemmap to be a variable. As the old definition
      depended on a variable load, this should not affect performance
      noticeably.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      c8b6d2cc
    • Steve Capper's avatar
      arm64: mm: Logic to make offset_ttbr1 conditional · c812026c
      Steve Capper authored
      When running with a 52-bit userspace VA and a 48-bit kernel VA we offset
      ttbr1_el1 to allow the kernel pagetables with a 52-bit PTRS_PER_PGD to
      be used for both userspace and kernel.
      
      Moving on to a 52-bit kernel VA we no longer require this offset to
      ttbr1_el1 should we be running on a system with HW support for 52-bit
      VAs.
      
      This patch introduces conditional logic to offset_ttbr1 to query
      SYS_ID_AA64MMFR2_EL1 whenever 52-bit VAs are selected. If there is HW
      support for 52-bit VAs then the ttbr1 offset is skipped.
      
      We choose to read a system register rather than vabits_actual because
      offset_ttbr1 can be called in places where the kernel data is not
      actually mapped.
      
      Calls to offset_ttbr1 appear to be made from rarely called code paths so
      this extra logic is not expected to adversely affect performance.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      c812026c
    • Steve Capper's avatar
      arm64: mm: Introduce vabits_actual · 5383cc6e
      Steve Capper authored
      In order to support 52-bit kernel addresses detectable at boot time, one
      needs to know the actual VA_BITS detected. A new variable vabits_actual
      is introduced in this commit and employed for the KVM hypervisor layout,
      KASAN, fault handling and phys-to/from-virt translation where there
      would normally be compile time constants.
      
      In order to maintain performance in phys_to_virt, another variable
      physvirt_offset is introduced.
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5383cc6e
    • Steve Capper's avatar
      arm64: mm: Introduce VA_BITS_MIN · 90ec95cd
      Steve Capper authored
      In order to support 52-bit kernel addresses detectable at boot time, the
      kernel needs to know the most conservative VA_BITS possible should it
      need to fall back to this quantity due to lack of hardware support.
      
      A new compile time constant VA_BITS_MIN is introduced in this patch and
      it is employed in the KASAN end address, KASLR, and EFI stub.
      
      For Arm, if 52-bit VA support is unavailable the fallback is to 48-bits.
      
      In other words: VA_BITS_MIN = min (48, VA_BITS)
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      90ec95cd
    • Steve Capper's avatar
      arm64: dump: De-constify VA_START and KASAN_SHADOW_START · 99426e5e
      Steve Capper authored
      The kernel page table dumper assumes that the placement of VA regions is
      constant and determined at compile time. As we are about to introduce
      variable VA logic, we need to be able to determine certain regions at
      boot time.
      
      Specifically the VA_START and KASAN_SHADOW_START will depend on whether
      or not the system is booted with 52-bit kernel VAs.
      
      This patch adds logic to the kernel page table dumper s.t. these regions
      can be computed at boot time.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      99426e5e
    • Steve Capper's avatar
      arm64: kasan: Switch to using KASAN_SHADOW_OFFSET · 6bd1d0be
      Steve Capper authored
      KASAN_SHADOW_OFFSET is a constant that is supplied to gcc as a command
      line argument and affects the codegen of the inline address sanetiser.
      
      Essentially, for an example memory access:
          *ptr1 = val;
      The compiler will insert logic similar to the below:
          shadowValue = *(ptr1 >> KASAN_SHADOW_SCALE_SHIFT + KASAN_SHADOW_OFFSET)
          if (somethingWrong(shadowValue))
              flagAnError();
      
      This code sequence is inserted into many places, thus
      KASAN_SHADOW_OFFSET is essentially baked into many places in the kernel
      text.
      
      If we want to run a single kernel binary with multiple address spaces,
      then we need to do this with KASAN_SHADOW_OFFSET fixed.
      
      Thankfully, due to the way the KASAN_SHADOW_OFFSET is used to provide
      shadow addresses we know that the end of the shadow region is constant
      w.r.t. VA space size:
          KASAN_SHADOW_END = ~0 >> KASAN_SHADOW_SCALE_SHIFT + KASAN_SHADOW_OFFSET
      
      This means that if we increase the size of the VA space, the start of
      the KASAN region expands into lower addresses whilst the end of the
      KASAN region is fixed.
      
      Currently the arm64 code computes KASAN_SHADOW_OFFSET at build time via
      build scripts with the VA size used as a parameter. (There are build
      time checks in the C code too to ensure that expected values are being
      derived). It is sufficient, and indeed is a simplification, to remove
      the build scripts (and build time checks) entirely and instead provide
      KASAN_SHADOW_OFFSET values.
      
      This patch removes the logic to compute the KASAN_SHADOW_OFFSET in the
      arm64 Makefile, and instead we adopt the approach used by x86 to supply
      offset values in kConfig. To help debug/develop future VA space changes,
      the Makefile logic has been preserved in a script file in the arm64
      Documentation folder.
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      6bd1d0be
    • Steve Capper's avatar
      arm64: mm: Flip kernel VA space · 14c127c9
      Steve Capper authored
      In order to allow for a KASAN shadow that changes size at boot time, one
      must fix the KASAN_SHADOW_END for both 48 & 52-bit VAs and "grow" the
      start address. Also, it is highly desirable to maintain the same
      function addresses in the kernel .text between VA sizes. Both of these
      requirements necessitate us to flip the kernel address space halves s.t.
      the direct linear map occupies the lower addresses.
      
      This patch puts the direct linear map in the lower addresses of the
      kernel VA range and everything else in the higher ranges.
      
      We need to adjust:
       *) KASAN shadow region placement logic,
       *) KASAN_SHADOW_OFFSET computation logic,
       *) virt_to_phys, phys_to_virt checks,
       *) page table dumper.
      
      These are all small changes, that need to take place atomically, so they
      are bundled into this commit.
      
      As part of the re-arrangement, a guard region of 2MB (to preserve
      alignment for fixed map) is added after the vmemmap. Otherwise the
      vmemmap could intersect with IS_ERR pointers.
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      14c127c9
    • Steve Capper's avatar
      arm64: mm: Remove bit-masking optimisations for PAGE_OFFSET and VMEMMAP_START · 9cb1c5dd
      Steve Capper authored
      Currently there are assumptions about the alignment of VMEMMAP_START
      and PAGE_OFFSET that won't be valid after this series is applied.
      
      These assumptions are in the form of bitwise operators being used
      instead of addition and subtraction when calculating addresses.
      
      This patch replaces these bitwise operators with addition/subtraction.
      Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      9cb1c5dd
  3. 05 Aug, 2019 1 commit
  4. 04 Aug, 2019 10 commits
  5. 03 Aug, 2019 7 commits
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · cf6c8aef
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "A set of driver fixes for the I2C subsystem"
      
      * 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: s3c2410: Mark expected switch fall-through
        i2c: at91: fix clk_offset for sama5d2
        i2c: at91: disable TXRDY interrupt after sending data
        i2c: iproc: Fix i2c master read more than 63 bytes
        eeprom: at24: make spd world-readable again
      cf6c8aef
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8b7fd679
      Linus Torvalds authored
      Pull perf tooling fixes from Thomas Gleixner:
       "A set of updates for perf tools and documentation:
      
        perf header:
          - Prevent a division by zero
          - Deal with an uninitialized warning proper
      
        libbpf:
          - Fix the missiong __WORDSIZE definition for musl & al
      
        UAPI headers:
          - Synchronize kernel headers
      
        Documentation:
          - Fix the memory units for perf.data size"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        libbpf: fix missing __WORDSIZE definition
        perf tools: Fix perf.data documentation units for memory size
        perf header: Fix use of unitialized value warning
        perf header: Fix divide by zero error if f_header.attr_size==0
        tools headers UAPI: Sync if_link.h with the kernel
        tools headers UAPI: Sync sched.h with the kernel
        tools headers UAPI: Sync usbdevice_fs.h with the kernels to get new ioctl
        tools perf beauty: Fix usbdevfs_ioctl table generator to handle _IOC()
        tools headers UAPI: Update tools's copy of drm.h headers
        tools headers UAPI: Update tools's copy of mman.h headers
        tools headers UAPI: Update tools's copy of kvm.h headers
        tools include UAPI: Sync x86's syscalls_64.tbl and generic unistd.h to pick up clone3 and pidfd_open
      8b7fd679
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0432a0a0
      Linus Torvalds authored
      Pull vdso timer fixes from Thomas Gleixner:
       "A series of commits to deal with the regression caused by the generic
        VDSO implementation.
      
        The usage of clock_gettime64() for 32bit compat fallback syscalls
        caused seccomp filters to kill innocent processes because they only
        allow clock_gettime().
      
        Handle the compat syscalls with clock_gettime() as before, which is
        not a functional problem for the VDSO as the legacy compat application
        interface is not y2038 safe anyway. It's just extra fallback code
        which needs to be implemented on every architecture.
      
        It's opt in for now so that it does not break the compile of already
        converted architectures in linux-next. Once these are fixed, the
        #ifdeffery goes away.
      
        So much for trying to be smart and reuse code..."
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        arm64: compat: vdso: Use legacy syscalls as fallback
        x86/vdso/32: Use 32bit syscall fallback
        lib/vdso/32: Provide legacy syscall fallbacks
        lib/vdso: Move fallback invocation to the callers
        lib/vdso/32: Remove inconsistent NULL pointer checks
      0432a0a0
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · af42e745
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "A small bunch of fixes from the irqchip department:
      
         - Fix a couple of UAF on error paths (RZA1, GICv3 ITS)
      
         - Fix iMX GPCv2 trigger setting
      
         - Add missing of_node_put() on error path in MBIGEN
      
         - Add another bunch of /* fall-through */ to silence warnings"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/renesas-rza1: Fix an use-after-free in rza1_irqc_probe()
        irqchip/irq-imx-gpcv2: Forward irq type to parent
        irqchip/irq-mbigen: Add of_node_put() before return
        irqchip/gic-v3-its: Free unused vpt_page when alloc vpe table fail
        irqchip/gic-v3: Mark expected switch fall-through
      af42e745
    • Linus Torvalds's avatar
      Merge tag 'xfs-5.3-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · e12b243d
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
      
       - Avoid leaking kernel stack contents to userspace
      
       - Fix a potential null pointer dereference in the dabtree scrub code
      
      * tag 'xfs-5.3-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: Fix possible null-pointer dereferences in xchk_da_btree_block_check_sibling()
        xfs: fix stack contents leakage in the v1 inumber ioctls
      e12b243d
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · b7aea68a
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "17 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        drivers/acpi/scan.c: document why we don't need the device_hotplug_lock
        memremap: move from kernel/ to mm/
        lib/test_meminit.c: use GFP_ATOMIC in RCU critical section
        asm-generic: fix -Wtype-limits compiler warnings
        cgroup: kselftest: relax fs_spec checks
        mm/memory_hotplug.c: remove unneeded return for void function
        mm/migrate.c: initialize pud_entry in migrate_vma()
        coredump: split pipe command whitespace before expanding template
        page flags: prioritize kasan bits over last-cpuid
        ubsan: build ubsan.c more conservatively
        kasan: remove clang version check for KASAN_STACK
        mm: compaction: avoid 100% CPU usage during compaction when a task is killed
        mm: migrate: fix reference check race between __find_get_block() and migration
        mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
        ocfs2: remove set but not used variable 'last_hash'
        Revert "kmemleak: allow to coexist with fault injection"
        kernel/signal.c: fix a kernel-doc markup
      b7aea68a
    • Linus Torvalds's avatar
      Merge tag 'riscv/for-v5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 61672549
      Linus Torvalds authored
      Pull RISC-V fixes from Paul Walmsley:
       "Three minor RISC-V-related changes for v5.3-rc3:
      
         - Add build ID to VDSO builds to avoid a double-free in perf when
           libelf isn't used
      
         - Align the RV64 defconfig to the output of "make savedefconfig" so
           subsequent defconfig patches don't get out of hand
      
         - Drop a superfluous DT property from the FU540 SoC DT data (since it
           must be already set in board data that includes it)"
      
      * tag 'riscv/for-v5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: defconfig: align RV64 defconfig to the output of "make savedefconfig"
        riscv: dts: fu540-c000: drop "timebase-frequency"
        riscv: Fix perf record without libelf support
      61672549