From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (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 2C6793BB661 for ; Thu, 30 Jul 2026 07:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785396048; cv=none; b=syLER36m0tX0rSPwU5V7o0lUjkNrfn1Fb2LzLhZOUZOp3x6pfn4G2+brxuIw8HhZdO9b2jHtx1bpFzsbxOdzb4sm1vDM3KaqmdzgU/P6Oq+7RoOBy9yCrUAHNXqmbInwEL5NcsLHZm6CtuEG1GS+gl/8esJ+Spfy9dnmdYfCn+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785396048; c=relaxed/simple; bh=3Ly1KSQ9fA1bmOOlJGAt36L/P34Btkes07L3PU4rbG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cQdv1EXFiDgnGVLKtfw7JxTZ5zrNTU9rMHcegdQkfNqHlos+lRn/Guf/Ni3H6mVoZkj9BW+Jd8+c/WeN9a7osEl6UWwRhJwO0r52/49KeGSEDjiDGXvxdYOBuSz5nYScd0f2jJYNd3UgD++1Gi6PQHvqAKfHB7+rH/hcQ5FKWuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qbH+sIT8; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qbH+sIT8" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785396041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Ly1KSQ9fA1bmOOlJGAt36L/P34Btkes07L3PU4rbG0=; b=qbH+sIT8ihnliNU/GNo5sA2dE0ls6RRX+aHv7fVRXKLs9eWjrQXU3ykTbccJ1Dzk5nIQGc S+xfTcTGNoMsibJhHirewQp3gSirxNL9X7RRFBZs9EEVGY46sKXJlfXKq/6E0mdbPhzu45 QYOFwOo2ZRzgMkmF2KoMo9r7Gz2JTSg= From: Leon Hwang To: Pu Lehui Cc: Leon Hwang , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Yonghong Song , Song Liu , Jiri Olsa , Emil Tsalapatis , Pu Lehui Subject: Re: [PATCH bpf v3] bpf: Fix potential UAF when reading bpf link info Date: Thu, 30 Jul 2026 15:19:54 +0800 Message-ID: <20260730072009.403954-1-leon.hwang@linux.dev> In-Reply-To: <20260728025457.2814876-1-pulehui@huaweicloud.com> References: <20260728025457.2814876-1-pulehui@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT On Tue, 28 Jul 2026 02:54:57 +0000, Pu Lehui wrot= e:=0D > From: Pu Lehui =0D >=0D > In bpf_link_show_fdinfo and bpf_link_get_info_by_fd, link->prog is=0D > accessed without holding any locks. If the prog is concurrently replaced= =0D > via bpf_link_update, the old prog can be freed, leading to a potential=0D > UAF issue.=0D >=0D > Fix this by accessing link->prog under RCU protection to safely fetch=0D > the pointer and guarantee its lifetime while reading its fields.=0D >=0D > Fixes: 0c991ebc8c69 ("bpf: Implement bpf_prog replacement for an active b= pf_cgroup_link")=0D > Reported-by: Sashiko =0D > Reviewed-by: Emil Tsalapatis =0D > Reviewed-by: Amery Hung =0D > Signed-off-by: Pu Lehui =0D =0D Acked-by: Leon Hwang =0D =0D > [...]=0D