1. 02 Nov, 2018 3 commits
    • Anders Roxell's avatar
      arm64: kprobe: make page to RO mode when allocate it · 96686689
      Anders Roxell authored
      Commit 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
      has successfully identified code that leaves a page with W+X
      permissions.
      
      [    3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
      [    3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
      [    3.246141] Modules linked in:
      [    3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
      [    3.247008] Hardware name: linux,dummy-virt (DT)
      [    3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    3.247623] pc : note_page+0x410/0x420
      [    3.247898] lr : note_page+0x410/0x420
      [    3.248071] sp : ffff00000804bcd0
      [    3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
      [    3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
      [    3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
      [    3.249109] x23: 0000000000000004 x22: ffff000000d91000
      [    3.249396] x21: ffff000000d90000 x20: 0000000000000000
      [    3.249661] x19: ffff00000804bde8 x18: 0000000000000400
      [    3.249924] x17: 0000000000000000 x16: 0000000000000000
      [    3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
      [    3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
      [    3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
      [    3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
      [    3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
      [    3.251802] x5 : 0000000000000000 x4 : 0000000000000000
      [    3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
      [    3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
      [    3.252664] Call trace:
      [    3.252953]  note_page+0x410/0x420
      [    3.253186]  walk_pgd+0x12c/0x238
      [    3.253417]  ptdump_check_wx+0x68/0xf8
      [    3.253637]  mark_rodata_ro+0x68/0x98
      [    3.253847]  kernel_init+0x38/0x160
      [    3.254103]  ret_from_fork+0x10/0x18
      
      kprobes allocates a writable executable page with module_alloc() in
      order to store executable code.
      Reworked to that when allocate a page it sets mode RO. Inspired by
      commit 63fef14f ("kprobes/x86: Make insn buffer always ROX and use text_poke()").
      Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
      Suggested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      [catalin.marinas@arm.com: removed unnecessary casts]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      96686689
    • Yangtao Li's avatar
      arm64: kdump: fix small typo · 5900e02b
      Yangtao Li authored
      This brings the kernel doc in line with the function signature.
      Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      5900e02b
    • Victor Kamensky's avatar
      arm64: makefile fix build of .i file in external module case · 98356eb0
      Victor Kamensky authored
      After 'a66649da arm64: fix vdso-offsets.h dependency' if
      one will try to build .i file in case of external kernel module,
      build fails complaining that prepare0 target is missing. This
      issue came up with SystemTap when it tries to build variety
      of .i files for its own generated kernel modules trying to
      figure given kernel features/capabilities.
      
      The issue is that prepare0 is defined in top level Makefile
      only if KBUILD_EXTMOD is not defined. .i file rule depends
      on prepare and in case KBUILD_EXTMOD defined top level Makefile
      contains empty rule for prepare. But after mentioned commit
      arch/arm64/Makefile would introduce dependency on prepare0
      through its own prepare target.
      
      Fix it to put proper ifdef KBUILD_EXTMOD around code introduced
      by mentioned commit. It matches what top level Makefile does.
      Acked-by: default avatarKevin Brodsky <kevin.brodsky@arm.com>
      Signed-off-by: default avatarVictor Kamensky <kamensky@cisco.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      98356eb0
  2. 19 Oct, 2018 1 commit
  3. 16 Oct, 2018 3 commits
    • Suzuki K Poulose's avatar
      arm64: cpufeature: Trap CTR_EL0 access only where it is necessary · 4afe8e79
      Suzuki K Poulose authored
      When there is a mismatch in the CTR_EL0 field, we trap
      access to CTR from EL0 on all CPUs to expose the safe
      value. However, we could skip trapping on a CPU which
      matches the safe value.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      4afe8e79
    • Suzuki K Poulose's avatar
      arm64: cpufeature: Fix handling of CTR_EL0.IDC field · 1602df02
      Suzuki K Poulose authored
      CTR_EL0.IDC reports the data cache clean requirements for instruction
      to data coherence. However, if the field is 0, we need to check the
      CLIDR_EL1 fields to detect the status of the feature. Currently we
      don't do this and generate a warning with tainting the kernel, when
      there is a mismatch in the field among the CPUs. Also the userspace
      doesn't have a reliable way to check the CLIDR_EL1 register to check
      the status.
      
      This patch fixes the problem by checking the CLIDR_EL1 fields, when
      (CTR_EL0.IDC == 0) and updates the kernel's copy of the CTR_EL0 for
      the CPU with the actual status of the feature. This would allow the
      sanity check infrastructure to do the proper checking of the fields
      and also allow the CTR_EL0 emulation code to supply the real status
      of the feature.
      
      Now, if a CPU has raw CTR_EL0.IDC == 0 and effective IDC == 1 (with
      overall system wide IDC == 1), we need to expose the real value to
      the user. So, we trap CTR_EL0 access on the CPU which reports incorrect
      CTR_EL0.IDC.
      
      Fixes: commit 6ae4b6e0 ("arm64: Add support for new control bits CTR_EL0.DIC and CTR_EL0.IDC")
      Cc: Shanker Donthineni <shankerd@codeaurora.org>
      Cc: Philip Elcan <pelcan@codeaurora.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      1602df02
    • Suzuki K Poulose's avatar
      arm64: cpufeature: ctr: Fix cpu capability check for late CPUs · 8ab66cbe
      Suzuki K Poulose authored
      The matches() routine for a capability must honor the "scope"
      passed to it and return the proper results.
      i.e, when passed with SCOPE_LOCAL_CPU, it should check the
      status of the capability on the current CPU. This is used by
      verify_local_cpu_capabilities() on a late secondary CPU to make
      sure that it's compliant with the established system features.
      However, ARM64_HAS_CACHE_{IDC/DIC} always checks the system wide
      registers and this could mean that a late secondary CPU could return
      "true" (since the CPU hasn't updated the system wide registers yet)
      and thus lead the system in an inconsistent state, where
      the system assumes it has IDC/DIC feature, while the new CPU
      doesn't.
      
      Fixes: commit 6ae4b6e0 ("arm64: Add support for new control bits CTR_EL0.DIC and CTR_EL0.IDC")
      Cc: Philip Elcan <pelcan@codeaurora.org>
      Cc: Shanker Donthineni <shankerd@codeaurora.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      8ab66cbe
  4. 10 Oct, 2018 4 commits
  5. 09 Oct, 2018 1 commit
  6. 05 Oct, 2018 3 commits
  7. 03 Oct, 2018 4 commits
  8. 01 Oct, 2018 20 commits
  9. 25 Sep, 2018 1 commit