From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796194216; b=JCyt+Ypn2oM4ybGa4DNFEOag7mFBRFBQeBMnIrUjhmeNElaZmLLofT44r144KY71MShy 7vdHTyrUDoYS9pBaIjabHHTwnFqrCm66+6tuDz5mhqcowTl+lmftt2JHVbJ4uWV/ySNVL VKyeUM7nYTdA8Hv5VwsgWVZjCoCKNA1VKBOC1BxLZkY5AR9aKqgHJgEazbXGq6MK1QXne 0JSfZqChr5II9SULQI/9wW4Q/85iZWXxE/R13IZp+NiA1RozZ7pmCio98wiJV+YZfZSaO 0z+bTgHEOrqs+Qy/Eveqtxj6+ejnAUMPeLhA6/c7Xn+YU4PkGsQLH75rZ77N5sW8emw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796194216; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=E6oyHCaz4Fd3Cz4gaHXbmuoJ4+OdGNr9gC6y58//vK0=; b=XAHgAeH3bGJ4844fTKf5rd6EZjYIKaWoH92fWVTSmUq3dZzPve7GRArWjEBmEW4adLIW 7Hla7z+4bdhZMAYKm2JCNUz0Veh61DXNcIqubG8vjf5uceohX/c4eAYDPY/6eWq7pTi7P OMx8eJekgYKYIBbUrEm6y7z9JrW3D8x2fm8r548Cnfipnbp/IhUgUIrE0tt8H865UsEQq w52ajXlbEoFnXc+J5HdFi/TOVfWUHxfi9mndQcVHqPqbvJP+pD3VhCZDSdZmZzzHslgy0 Guc5xhGs0PgnSfXU2w1fmSkW/VFRQeXgaofZdpxsUcfTA7C2XtfsjL/hFyp+rBEGm0Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V58oVxbq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78870606A338 for ; Wed, 2 Dec 2026 06:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V58oVxbq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2183B1F00897; Wed, 2 Dec 2026 06:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796194215; bh=E6oyHCaz4Fd3Cz4gaHXbmuoJ4+OdGNr9gC6y58//vK0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=V58oVxbqat8LUY/PNSmI8lHbXS8M6capc2vuAvpFYelVe9mB+qSrOaq3OZ/WtdCKy 1MIdG183sPp+ZHsj4V13356vjTCw2ppiRUnHD26YDNfUtYWKQ/in3NkJm4N6YTKBIO /hs4xejDEflv++ZlvLyKJS0kQNIu0qgoEstfLZas8daX3ACpXrifZaPIrh50fHcg9O ROMuxEIwWVxblLazlU6/qrLxoMTdGm2o/iaIc7NHMxi7AXBtBZmR7DOYlVXStEnmwp zQbguJrE3P2xVO9c5yZBZS9M4q9646IIZwkhtoXC5bo/IqBpCol5tdOFeCeTqLihTC Xrl46j9XAaxnw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] perf/core: Don't expose kernel page sizes to exclude_kernel events Reply-To: sashiko-reviews@lists.linux.dev To: "JunYoung Lee" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261202063433.279947-1-ljyoung04@gmail.com> References: <20261202063433.279947-1-ljyoung04@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 06:50:14 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > PERF_SAMPLE_CODE_PAGE_SIZE and PERF_SAMPLE_DATA_PAGE_SIZE make > perf_prepare_sample() call perf_get_page_size() on data->ip and > data->addr. perf_get_page_size() walks the page tables of the current mm > (or init_mm) and returns the leaf size (0, 4K, 2M or 1G) of the mapping. > The address comes from the sample and is not range checked. >=20 > With the default perf_event_paranoid=3D2, a user without CAP_PERFMON has > to set exclude_kernel, because perf_event_open() calls > perf_allow_kernel() whenever exclude_kernel is clear. The overflow path > then drops a sample only if exclude_kernel is set and user_mode(regs) is > false, so it checks the mode of the sampled frame, not the sampled > address. A user-mode frame can still carry a kernel address: a hardware > data breakpoint on the memory operand of an indirect "jmp *mem" traps > after the jump, so the user-mode trap frame already holds the kernel > jump target in RIP. data->ip is then a kernel address and its page size > [ ... ] > Fixes: 8d97e71811aa ("perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE") > Fixes: 995f088efebe ("perf/core: Add support for PERF_SAMPLE_CODE_PAGE_SI= ZE") > Fixes: a92cbb82c8d3 ("perf/core: allow pte_offset_map() to fail") > Cc: stable@vger.kernel.org > Signed-off-by: JunYoung Lee Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202063433.2799= 47-1-ljyoung04@gmail.com?part=3D1