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=1796379536; b=AHc6OKFnrzSAoIJmaCS6rsljgYEgnK/VLhm1YsM5apgIJIpUbkTqE49RU1wkTddFsEcU MSA6vKBDBaJp5x2GUUs43V0PdzY35Vf+NaGsNzi+HzKP0d0+RHM9AQxWXKaU8s7HY2l0W /e3bxx0Kp2auFdrfSHpBa8ZsVXzYUxX2MfN9n0yBTcFMLGAVzt6kvirBTMg1tGEguonkT 6X4guVAW+udDlNqfzg838Dp/thXb+9iOjwFw1XxcnctPY5HRB9yDIPAWHGK60YPTjPJ54 rOCmPLAI6tk3f9cGnGR0nkZaA6IWlJ1OzB1qIZbYo4sAEhx8+R8wKr3KE4zo+tUL4dg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379536; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=NgyKzK6XFWtF5t4ugawcT5l51pKZXJrsMgOBMyV87Rs=; b=Wf6rs1NwstZNE4EdjcM4Mb2PXoAnmvwbl94c6ut9S4hLct6G2LimWovK6PHbc8GlxGSK ehE96ElQLA+xoTa6PNwqz/tWmY4HDYZktnvbz7CxeA9s3N2lxjWftxqBCMRs7xPevimtC e7AroO+AWMkMtLxrTlTXMaY3xSoC17Jy2iTQhdp6wZs7X6vElI/gWqpA91InPIikJurN2 9VCkvYMBmQf+ibhutzRDGI1Jv2qGJcd2gdBXvpVwUp2zNFLk+us9kU7LwsMvIH8+MsSsO IAXGI1jAxuujmH5HTBM6wVIfvZw0/lmPXgrS02LZCvEPS7w44gM5Ilg55oRebOsDDMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HWPmkrM3; 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 33D7E606A322; Fri, 4 Dec 2026 10:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HWPmkrM3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E8021F000C2; Fri, 4 Dec 2026 10:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379536; bh=NgyKzK6XFWtF5t4ugawcT5l51pKZXJrsMgOBMyV87Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HWPmkrM3I+BAkNo71zjaQhBK3SMzZ1ekP6YEPEHG8MyvFPY01BuN6dHB5Vas7//mr rqXBb7NT5Vx+WfwzUic0icV8XwlBQtKYycomugPemCCnm8rZ5zb883CGCMsF+r+Apa BIGzTijo914k2CrF9KaOmIRr8c7m6M2tr9J3Wksw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jerome Marchand , Yonghong Song , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.6 0010/1167] bpf: Specify access type of bpf_sysctl_get_name args Date: Fri, 4 Dec 2026 18:50:37 +0900 Message-ID: <20261204100702.317250958@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jerome Marchand [ Upstream commit 2eb7648558a7911f2208e8940cd22ca40e93cc76 ] The second argument of bpf_sysctl_get_name() helper is a pointer to a buffer that is being written to. However that isn't specify in the prototype. Until commit 37cce22dbd51a ("bpf: verifier: Refactor helper access type tracking"), all helper accesses were considered as a possible write access by the verifier, so no big harm was done. However, since then, the verifier might make wrong asssumption about the content of that address which might lead it to make faulty optimizations (such as removing code that was wrongly labeled dead). This is what happens in test_sysctl selftest to the tests related to sysctl_get_name. Add MEM_WRITE flag the second argument of bpf_sysctl_get_name(). Signed-off-by: Jerome Marchand Acked-by: Yonghong Song Link: https://lore.kernel.org/r/20250619140603.148942-2-jmarchan@redhat.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 790de12ca57ff..433ecc6579b1a 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -2147,7 +2147,7 @@ static const struct bpf_func_proto bpf_sysctl_get_name_proto = { .gpl_only = false, .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, - .arg2_type = ARG_PTR_TO_MEM, + .arg2_type = ARG_PTR_TO_MEM | MEM_WRITE, .arg3_type = ARG_CONST_SIZE, .arg4_type = ARG_ANYTHING, }; -- 2.53.0