Archive-only list for patches
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, "Jakub Acs" <acsjakub@amazon.de>,
	"Muhammad Usama Anjum" <usama.anjum@collabora.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
	"Jinjiang Tu" <tujinjiang@huawei.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Penglei Jiang" <superman.xpt@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Andrei Vagin" <avagin@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH 6.12 82/89] fs/proc/task_mmu: check p->vec_buf for NULL
Date: Tue, 30 Sep 2025 16:48:36 +0200	[thread overview]
Message-ID: <20250930143825.288941793@linuxfoundation.org> (raw)
In-Reply-To: <20250930143821.852512002@linuxfoundation.org>

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jakub Acs <acsjakub@amazon.de>

commit 28aa29986dde79e8466bc87569141291053833f5 upstream.

When the PAGEMAP_SCAN ioctl is invoked with vec_len = 0 reaches
pagemap_scan_backout_range(), kernel panics with null-ptr-deref:

[   44.936808] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN NOPTI
[   44.937797] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
[   44.938391] CPU: 1 UID: 0 PID: 2480 Comm: reproducer Not tainted 6.17.0-rc6 #22 PREEMPT(none)
[   44.939062] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
[   44.939935] RIP: 0010:pagemap_scan_thp_entry.isra.0+0x741/0xa80

<snip registers, unreliable trace>

[   44.946828] Call Trace:
[   44.947030]  <TASK>
[   44.949219]  pagemap_scan_pmd_entry+0xec/0xfa0
[   44.952593]  walk_pmd_range.isra.0+0x302/0x910
[   44.954069]  walk_pud_range.isra.0+0x419/0x790
[   44.954427]  walk_p4d_range+0x41e/0x620
[   44.954743]  walk_pgd_range+0x31e/0x630
[   44.955057]  __walk_page_range+0x160/0x670
[   44.956883]  walk_page_range_mm+0x408/0x980
[   44.958677]  walk_page_range+0x66/0x90
[   44.958984]  do_pagemap_scan+0x28d/0x9c0
[   44.961833]  do_pagemap_cmd+0x59/0x80
[   44.962484]  __x64_sys_ioctl+0x18d/0x210
[   44.962804]  do_syscall_64+0x5b/0x290
[   44.963111]  entry_SYSCALL_64_after_hwframe+0x76/0x7e

vec_len = 0 in pagemap_scan_init_bounce_buffer() means no buffers are
allocated and p->vec_buf remains set to NULL.

This breaks an assumption made later in pagemap_scan_backout_range(), that
page_region is always allocated for p->vec_buf_index.

Fix it by explicitly checking p->vec_buf for NULL before dereferencing.

Other sites that might run into same deref-issue are already (directly or
transitively) protected by checking p->vec_buf.

Note:
>From PAGEMAP_SCAN man page, it seems vec_len = 0 is valid when no output
is requested and it's only the side effects caller is interested in,
hence it passes check in pagemap_scan_get_args().

This issue was found by syzkaller.

Link: https://lkml.kernel.org/r/20250922082206.6889-1-acsjakub@amazon.de
Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
Signed-off-by: Jakub Acs <acsjakub@amazon.de>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Jinjiang Tu <tujinjiang@huawei.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Penglei Jiang <superman.xpt@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Andrei Vagin <avagin@gmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/proc/task_mmu.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -2259,6 +2259,9 @@ static void pagemap_scan_backout_range(s
 {
 	struct page_region *cur_buf = &p->vec_buf[p->vec_buf_index];
 
+	if (!p->vec_buf)
+		return;
+
 	if (cur_buf->start != addr)
 		cur_buf->end = addr;
 	else



  parent reply	other threads:[~2025-09-30 15:29 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-30 14:47 [PATCH 6.12 00/89] 6.12.50-rc1 review Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 01/89] scsi: ufs: mcq: Fix memory allocation checks for SQE and CQE Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 02/89] firewire: core: fix overlooked update of subsystem ABI version Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 03/89] ALSA: usb-audio: Fix code alignment in mixer_quirks Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 04/89] ALSA: usb-audio: Fix block comments " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 05/89] ALSA: usb-audio: Drop unnecessary parentheses " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 06/89] ALSA: usb-audio: Avoid multiple assignments " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 07/89] ALSA: usb-audio: Simplify NULL comparison " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 08/89] ALSA: usb-audio: Remove unneeded wmb() " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 09/89] ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5 Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 10/89] HID: multitouch: Get the contact ID from HID_DG_TRANSDUCER_INDEX fields in case of Apple Touch Bar Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 11/89] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields in " Greg Kroah-Hartman
2025-09-30 15:27   ` Aditya Garg
2025-09-30 14:47 ` [PATCH 6.12 12/89] HID: multitouch: take cls->maxcontacts into account for Apple Touch Bar even without a HID_DG_CONTACTMAX field Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 13/89] HID: multitouch: specify that Apple Touch Bar is direct Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 14/89] ALSA: usb-audio: Convert comma to semicolon Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 15/89] ALSA: hda/realtek: Add support for ASUS NUC using CS35L41 HDA Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 16/89] ALSA: usb-audio: Fix build with CONFIG_INPUT=n Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 17/89] usb: core: Add 0x prefix to quirks debug output Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 18/89] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 19/89] net: sfp: add quirk for Potron SFP+ XGSPON ONU Stick Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 20/89] mmc: sdhci-cadence: add Mobileye eyeQ support Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 21/89] i2c: designware: Add quirk for Intel Xe Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 22/89] ALSA: usb-audio: Add DSD support for Comtrue USB Audio device Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 23/89] ALSA: usb-audio: move mixer_quirks min_mute into common quirk Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 24/89] ALSA: usb-audio: Add mute TLV for playback volumes on more devices Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 25/89] net: sfp: add quirk for FLYPRO copper SFP+ module Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 26/89] IB/mlx5: Fix obj_type mismatch for SRQ event subscriptions Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 27/89] HID: amd_sfh: Add sync across amd sfh work functions Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 28/89] firmware: imx: Add stub functions for SCMI MISC API Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 29/89] arm64: dts: imx8mp: Correct thermal sensor index Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 30/89] ARM: dts: kirkwood: Fix sound DAI cells for OpenRD clients Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 31/89] cpufreq: Initialize cpufreq-based invariance before subsys Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 32/89] smb: server: dont use delayed_work for post_recv_credits_work Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 33/89] smb: server: use disable_work_sync in transport_rdma.c Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 34/89] bpf: Check the helper function is valid in get_helper_proto Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 35/89] btrfs: dont allow adding block device of less than 1 MB Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 36/89] wifi: virt_wifi: Fix page fault on connect Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 37/89] can: rcar_can: rcar_can_resume(): fix s2ram with PSCI Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 38/89] bpf: Reject bpf_timer for PREEMPT_RT Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 39/89] xfrm: xfrm_alloc_spi shouldnt use 0 as SPI Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 40/89] can: etas_es58x: populate ndo_change_mtu() to prevent buffer overflow Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 41/89] can: hi311x: " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 42/89] can: sun4i_can: " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 43/89] can: mcba_usb: " Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 44/89] can: peak_usb: fix shift-out-of-bounds issue Greg Kroah-Hartman
2025-09-30 14:47 ` [PATCH 6.12 45/89] net: tun: Update napi->skb after XDP process Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 46/89] net/smc: fix warning in smc_rx_splice() when calling get_page() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 47/89] ethernet: rvu-af: Remove slash from the driver name Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 48/89] Bluetooth: hci_sync: Fix hci_resume_advertising_sync Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 49/89] Bluetooth: hci_event: Fix UAF in hci_acl_create_conn_sync Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 50/89] vhost: Take a reference on the task in struct vhost_task Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 51/89] bnxt_en: correct offset handling for IPv6 destination address Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 52/89] net: allow alloc_skb_with_frags() to use MAX_SKB_FRAGS Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 53/89] nexthop: Forbid FDB status change while nexthop is in a group Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 54/89] selftests: fib_nexthops: Fix creation of non-FDB nexthops Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 55/89] net: dsa: lantiq_gswip: move gswip_add_single_port_br() call to port_setup() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 56/89] net: dsa: lantiq_gswip: suppress -EINVAL errors for bridge FDB entries added to the CPU port Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 57/89] octeontx2-pf: Fix potential use after free in otx2_tc_add_flow() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 58/89] mm/gup: local lru_add_drain() to avoid lru_add_drain_all() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 59/89] mm: revert "mm/gup: clear the LRU flag of a page before adding to LRU batch" Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 60/89] mm: folio_may_be_lru_cached() unless folio_test_large() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 61/89] drm/gma500: Fix null dereference in hdmi teardown Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 62/89] futex: Prevent use-after-free during requeue-PI Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 63/89] drm/panthor: Defer scheduler entitiy destruction to queue release Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 64/89] platform/x86: lg-laptop: Fix WMAB call in fan_mode_store() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 65/89] smb: client: fix wrong index reference in smb2_compound_op() Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 66/89] HID: asus: add support for missing PX series fn keys Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 67/89] i40e: add validation for ring_len param Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 68/89] i40e: fix idx validation in i40e_validate_queue_map Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 69/89] i40e: fix idx validation in config queues msg Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 70/89] i40e: fix input validation logic for action_meta Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 71/89] i40e: fix validation of VF state in get resources Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 72/89] i40e: add max boundary check for VF filters Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 73/89] i40e: add mask to apply valid bits for itr_idx Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 74/89] i40e: improve VF MAC filters accounting Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 75/89] crypto: af_alg - Fix incorrect boolean values in af_alg_ctx Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 76/89] tracing: dynevent: Add a missing lockdown check on dynevent Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 77/89] ARM: dts: socfpga: sodia: Fix mdio bus probe and PHY address Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 78/89] arm64: dts: marvell: cn9132-clearfog: disable eMMC high-speed modes Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 79/89] arm64: dts: marvell: cn9132-clearfog: fix multi-lane pci x2 and x4 ports Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 80/89] drm/ast: Use msleep instead of mdelay for edid read Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 81/89] afs: Fix potential null pointer dereference in afs_put_server Greg Kroah-Hartman
2025-09-30 14:48 ` Greg Kroah-Hartman [this message]
2025-09-30 14:48 ` [PATCH 6.12 83/89] gpiolib: Extend software-node support to support secondary software-nodes Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 84/89] kmsan: fix out-of-bounds access to shadow memory Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 85/89] mm/hugetlb: fix folio is still mapped when deleted Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 86/89] fbcon: fix integer overflow in fbcon_do_set_font Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 87/89] fbcon: Fix OOB access in font allocation Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 88/89] iommufd: Fix race during abort for file descriptors Greg Kroah-Hartman
2025-09-30 14:48 ` [PATCH 6.12 89/89] Revert "usb: xhci: remove option to change a default rings TRB cycle bit" Greg Kroah-Hartman
2025-09-30 18:49 ` 6.12.50-rc1 review Brett A C Sheffield
2025-09-30 18:51 ` [PATCH 6.12 00/89] " Florian Fainelli
2025-09-30 19:18 ` Guenter Roeck
2025-10-02  7:15   ` Greg Kroah-Hartman
2025-09-30 20:18 ` Peter Schneider
2025-10-01  2:51 ` Ron Economos
2025-10-01  9:12 ` Jon Hunter
2025-10-01 10:14 ` Mark Brown
2025-10-01 10:15 ` Naresh Kamboju
2025-10-01 13:30 ` Brett Mastbergen
2025-10-01 16:05 ` Shuah Khan
2025-10-01 17:40 ` Miguel Ojeda
2025-10-02  7:06 ` Pascal Ernster
2025-10-03  6:56 ` Pavel Machek

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=20250930143825.288941793@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=acsjakub@amazon.de \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=broonie@kernel.org \
    --cc=david@redhat.com \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=patches@lists.linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=sfr@canb.auug.org.au \
    --cc=stable@vger.kernel.org \
    --cc=superman.xpt@gmail.com \
    --cc=surenb@google.com \
    --cc=tujinjiang@huawei.com \
    --cc=usama.anjum@collabora.com \
    --cc=vbabka@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox