All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 38/75] arm64/mm: Inhibit huge-vmap with ptdump
Date: Mon, 17 Jun 2019 23:09:49 +0200	[thread overview]
Message-ID: <20190617210754.255442955@linuxfoundation.org> (raw)
In-Reply-To: <20190617210752.799453599@linuxfoundation.org>

[ Upstream commit 7ba36eccb3f83983a651efd570b4f933ecad1b5c ]

The arm64 ptdump code can race with concurrent modification of the
kernel page tables. At the time this was added, this was sound as:

* Modifications to leaf entries could result in stale information being
  logged, but would not result in a functional problem.

* Boot time modifications to non-leaf entries (e.g. freeing of initmem)
  were performed when the ptdump code cannot be invoked.

* At runtime, modifications to non-leaf entries only occurred in the
  vmalloc region, and these were strictly additive, as intermediate
  entries were never freed.

However, since commit:

  commit 324420bf91f6 ("arm64: add support for ioremap() block mappings")

... it has been possible to create huge mappings in the vmalloc area at
runtime, and as part of this existing intermediate levels of table my be
removed and freed.

It's possible for the ptdump code to race with this, and continue to
walk tables which have been freed (and potentially poisoned or
reallocated). As a result of this, the ptdump code may dereference bogus
addresses, which could be fatal.

Since huge-vmap is a TLB and memory optimization, we can disable it when
the runtime ptdump code is in use to avoid this problem.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 324420bf91f60582 ("arm64: add support for ioremap() block mappings")
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/mm/mmu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 8080c9f489c3..0fa558176fb1 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -921,13 +921,18 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
 
 int __init arch_ioremap_pud_supported(void)
 {
-	/* only 4k granule supports level 1 block mappings */
-	return IS_ENABLED(CONFIG_ARM64_4K_PAGES);
+	/*
+	 * Only 4k granule supports level 1 block mappings.
+	 * SW table walks can't handle removal of intermediate entries.
+	 */
+	return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
+	       !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
 }
 
 int __init arch_ioremap_pmd_supported(void)
 {
-	return 1;
+	/* See arch_ioremap_pud_supported() */
+	return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
 }
 
 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
-- 
2.20.1




  parent reply	other threads:[~2019-06-17 21:25 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 21:09 [PATCH 4.19 00/75] 4.19.53-stable review Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 01/75] drm/nouveau: add kconfig option to turn off nouveau legacy contexts. (v3) Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 02/75] nouveau: Fix build with CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT disabled Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 03/75] HID: multitouch: handle faulty Elo touch device Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 04/75] HID: wacom: Dont set tool type until were in range Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 05/75] HID: wacom: Dont report anything prior to the tool entering range Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 06/75] HID: wacom: Send BTN_TOUCH in response to INTUOSP2_BT eraser contact Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 07/75] HID: wacom: Correct button numbering 2nd-gen Intuos Pro over Bluetooth Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 08/75] HID: wacom: Sync INTUOSP2_BT touch state after each frame if necessary Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 09/75] Revert "ALSA: hda/realtek - Improve the headset mic for Acer Aspire laptops" Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 10/75] ALSA: oxfw: allow PCM capture for Stanton SCS.1m Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 11/75] ALSA: hda/realtek - Update headset mode for ALC256 Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 12/75] ALSA: firewire-motu: fix destruction of data for isochronous resources Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 13/75] libata: Extend quirks for the ST1000LM024 drives with NOLPM quirk Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 14/75] mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 15/75] fs/ocfs2: fix race in ocfs2_dentry_attach_lock() Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 16/75] mm/vmscan.c: fix trying to reclaim unevictable LRU page Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 17/75] [PATCH] signal/ptrace: Dont leak unitialized kernel memory with PTRACE_PEEK_SIGINFO Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 18/75] ptrace: restore smp_rmb() in __ptrace_may_access() Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 19/75] iommu/arm-smmu: Avoid constant zero in TLBI writes Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 20/75] i2c: acorn: fix i2c warning Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 21/75] bcache: fix stack corruption by PRECEDING_KEY() Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 22/75] bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 23/75] cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css() Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 24/75] ASoC: cs42xx8: Add regcache mask dirty Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 25/75] ASoC: fsl_asrc: Fix the issue about unsupported rate Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 26/75] drm/i915/sdvo: Implement proper HDMI audio support for SDVO Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 27/75] x86/uaccess, kcov: Disable stack protector Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 28/75] ALSA: seq: Protect in-kernel ioctl calls with mutex Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 29/75] ALSA: seq: Fix race of get-subscription call vs port-delete ioctls Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 30/75] Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex" Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 31/75] s390/kasan: fix strncpy_from_user kasan checks Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 32/75] Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 33/75] f2fs: fix to avoid accessing xattr across the boundary Greg Kroah-Hartman
2019-06-19 12:32   ` Pavel Machek
2019-06-20  1:46     ` Chao Yu
2019-06-17 21:09 ` [PATCH 4.19 34/75] scsi: qedi: remove memset/memcpy to nfunc and use func instead Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 35/75] scsi: qedi: remove set but not used variables cdev and udev Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 36/75] scsi: lpfc: correct rcu unlock issue in lpfc_nvme_info_show Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 37/75] scsi: lpfc: add check for loss of ndlp when sending RRQ Greg Kroah-Hartman
2019-06-17 21:09 ` Greg Kroah-Hartman [this message]
2019-06-17 21:09 ` [PATCH 4.19 39/75] nvme: fix srcu locking on error return in nvme_get_ns_from_disk Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 40/75] nvme: remove the ifdef around nvme_nvm_ioctl Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 41/75] nvme: merge nvme_ns_ioctl into nvme_ioctl Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 42/75] nvme: release namespace SRCU protection before performing controller ioctls Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 43/75] nvme: fix memory leak for power latency tolerance Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 44/75] platform/x86: pmc_atom: Add Lex 3I380D industrial PC to critclk_systems DMI table Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 45/75] platform/x86: pmc_atom: Add several Beckhoff Automation boards " Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 46/75] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 47/75] libnvdimm: Fix compilation warnings with W=1 Greg Kroah-Hartman
2019-06-17 21:09 ` [PATCH 4.19 48/75] selftests: fib_rule_tests: fix local IPv4 address typo Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 49/75] selftests/timers: Add missing fflush(stdout) calls Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 50/75] tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 51/75] usbnet: ipheth: fix racing condition Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 52/75] KVM: arm/arm64: Move cc/it checks under hyps Makefile to avoid instrumentation Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 53/75] KVM: x86/pmu: mask the result of rdpmc according to the width of the counters Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 54/75] KVM: x86/pmu: do not mask the value that is written to fixed PMUs Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 55/75] KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 56/75] tools/kvm_stat: fix fields filter for child events Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 57/75] drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 58/75] drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define() Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 59/75] usb: dwc2: Fix DMA cache alignment issues Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 60/75] usb: dwc2: host: Fix wMaxPacketSize handling (fix webcam regression) Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 61/75] USB: Fix chipmunk-like voice when using Logitech C270 for recording audio Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 62/75] USB: usb-storage: Add new ID to ums-realtek Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 63/75] USB: serial: pl2303: add Allied Telesis VT-Kit3 Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 64/75] USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 65/75] USB: serial: option: add Telit 0x1260 and 0x1261 compositions Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 66/75] timekeeping: Repair ktime_get_coarse*() granularity Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 67/75] RAS/CEC: Convert the timer callback to a workqueue Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 68/75] RAS/CEC: Fix binary search function Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 69/75] x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 70/75] x86/kasan: Fix boot with 5-level paging and KASAN Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 71/75] x86/mm/KASLR: Compute the size of the vmemmap section properly Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 72/75] x86/resctrl: Prevent NULL pointer dereference when local MBM is disabled Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 73/75] drm/edid: abstract override/firmware EDID retrieval Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 74/75] drm: add fallback override/firmware EDID modes workaround Greg Kroah-Hartman
2019-06-17 21:10 ` [PATCH 4.19 75/75] rtc: pcf8523: dont return invalid date when battery is low Greg Kroah-Hartman
2019-06-18  2:10 ` [PATCH 4.19 00/75] 4.19.53-stable review kernelci.org bot
2019-06-18  7:44 ` Naresh Kamboju
2019-06-18 13:42 ` shuah
2019-06-18 16:37 ` Guenter Roeck
2019-06-19  8:45 ` Jon Hunter
2019-06-19  8:45   ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190617210754.255442955@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ard.biesheuvel@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.