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 A28A82D77F5; Fri, 9 Oct 2026 14:48:57 +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=1791557338; cv=none; b=UmKMxlIiZhzNXy+Xjr8HTf1eiFWfID54vc20DRVUQso/l2OwFh9Du7abuA9VUCkc7rUV7wxgVJh0rVzkXLzKo8jMotN+WOn40qxGXXXKj42VYqZF3nZjXOJWXwQe10B7hkmyVedaJTnKjWWGG8/unormqoUXH+OBq4tP7zQllyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557338; c=relaxed/simple; bh=pirSvoCsBizWz3OlbWFxHYMVgep2BCF8meqCnnUiASI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lQTWoPCp0Oh20ZLAgS+6cOLP7rkKbueh1XOG8owMrAt2sm5XheDBQfNmUWVVx3CToMFuGE+UDnAOIBvVkpI4+teiU8b1GjfbEq4I3ibxdftj6bJCMuewzRBkHk7hx4RKDXS4bGkD2r+PpefrcazIoH33FYTCx+lVSk1Q7AYXS70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OqMCaItW; 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="OqMCaItW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 021651F000FF; Fri, 9 Oct 2026 14:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557337; bh=Bivyf5sMOrObHHGt4Prye74/ucOcot8/TRB4VVP4bNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OqMCaItWywzVBpaJSrdA/6OoTEw7bHm4G7iblY7LjirrD4N6LP3JzLMJOpnhSVQpa Gj1vh2WqUMQgn47pvDXYSyckDwXHeIo1GUTOAPUGpMxoUn4qMFsZaz0DwY9WjO+8DT siO8VG01Rx068vOnEkS6uBU+1bPllAR2ImlVg3GM= 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 6.18 384/403] perf: Require kernel access for text poke events Date: Fri, 9 Oct 2026 16:12:25 +0200 Message-ID: <20261009141001.313916135@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@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 6.18-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 @@ -13490,7 +13490,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();