From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D28922DEA6B; Fri, 9 Oct 2026 14:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557621; cv=none; b=XAOVBRf6siMG5ejQSUmvCNd5FAZgXO8OeG2T8iQUOsFGuPih8uoRGufR+tvfpVqm84Bs4I6D62AgWmSFX6A1JkT6ajCulA1W2K/xYgxdyPSrqwgBPpwdldHQNeZlakKNE6uFZ91OEUw3dJoOC6rglDEgTG3lLNXVl7lJKBiMLcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557621; c=relaxed/simple; bh=aGZMmyRD7ttWBAIVnGMMxuXnUMYaBb5xHtQ3GhglFMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kz0IOeQDVu0Stykc0B5o9vu2jDUHeKkAD5lSFrjxACUgAtv8r2qlNjW3odVMQTEG/fvd66kO41ZSLRrGJJc2rXWGjlMzl/7Yz7tuS4yg7gwHXt6mgfhXTesnhCY9UoKE9XfSnWl8X8/h+VY8B0/mRhQWuQ32zvwtnXIxGkAhP3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nC2NOTNi; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nC2NOTNi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11E2B1F000FF; Fri, 9 Oct 2026 14:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557620; bh=fstcu0Ae1LrLBjOvUaiP9sHwFq49T3rRbqiQ0bTP/6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nC2NOTNi9OlV0nS4S2VhwF1OnutHsv0h1Nb5GI59OhsykNB1mEe5kgd4Me8eR8R8Y qPqFymQAAehG68fVe4ocxciPf7fw4jYwyKbmKV+sObPjLth/kau7hBXDLKFB2f1zWa Uxh+rkdixqbLoOsBbtoUWFe3WpjG1+ZGPPzAOsmo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhengchuan Liang , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 7.2 422/428] perf: Require kernel access for text poke events Date: Fri, 9 Oct 2026 16:12:39 +0200 Message-ID: <20261009140955.510792995@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhengchuan Liang [ Upstream commit 357e8a77a501d96c9517f01f4a211eed5e9c9184 ] Perf events with exclude_kernel=1 can be opened without kernel perf access. However, exclude_kernel does not suppress text-poke sideband records. Every PERF_RECORD_TEXT_POKE is marked PERF_RECORD_MISC_KERNEL and contains a raw kernel instruction address. An unprivileged task can therefore open and mmap a task-local software event with text_poke=1. Both opening a count-only tracepoint event and configuring UDP GRO for ESP-in-UDP cause updates to inline static calls; the observer receives the relocated addresses of the modified instructions. For a known kernel image, any such address reveals the runtime kernel text base despite KASLR. Call perf_allow_kernel() whenever attr.text_poke is set, regardless of exclude_kernel. Events that neither monitor kernel execution nor request text-poke records retain their existing permissions. Fixes: e17d43b93e54 ("perf: Add perf text poke event") Assisted-by: LLM Signed-off-by: Zhengchuan Liang Signed-off-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://patch.msgid.link/99131354c41e23188f778b92f90363775b482395.1790573390.git.zcliangcn@gmail.com Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -13882,7 +13882,7 @@ SYSCALL_DEFINE5(perf_event_open, if (err) return err; - if (!attr.exclude_kernel || + if (!attr.exclude_kernel || attr.text_poke || ((attr.sample_type & PERF_SAMPLE_CALLCHAIN) && !attr.exclude_callchain_kernel)) { err = perf_allow_kernel();