From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 AAC0E2E62B7 for ; Wed, 10 Jun 2026 01:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781055473; cv=none; b=nHHCgtL4p1Ex01fLpyYT11xA3NyGL5ksgSKbJZ14QahtsVEQ66h27z3zJJfp7rwsr4Um+Fv/NWAg41scSUONh2JDw+PraNY4C3s/6c06G55oquz13MfUhwo2d3lO1WySRg+tAHRUmGENwzJ70XM2L1gWo7RA/RB+UkDq6tjf+wY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781055473; c=relaxed/simple; bh=ipRH2nMK3lHpLv5WJfej2MXixMzET4R0uqTE01p2WX8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PrW1J2DhKd+dRVj9L0D2xfvUl6XWyRa7wln5bkyiE0BJNOtDSwwk0w8+kkgGaSPZ2BUw4f/Sl2q1e8f2dguFJ9OaaYpMfCFVD3WY/00jiaS35elEnqTHa7BLaTclTqO+gtSODgW6kmqcAY1yVcfiv0dRc8lpKoDMtPCMVKxY468= 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=rA4wFQDx; arc=none smtp.client-ip=95.215.58.173 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="rA4wFQDx" Message-ID: <82860b36-4a8a-43df-a737-1bed1d42d2c4@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781055455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ipRH2nMK3lHpLv5WJfej2MXixMzET4R0uqTE01p2WX8=; b=rA4wFQDxOiT7IAWnm3j/pFSxnJ/94leDcDG8OOWKmPebyFMqx9FuEpg/ImFTH7o1ugFusY qIOZZcYkW9xgkS3VGI/vJ1m3AJ0NAV1eteqQWic7uLi3UcXL26qjZ3lJNJ9gS2nNmOvtLK IcjmBhlJ8vgqCs+u0gfiGkINKQXOjP0= Date: Wed, 10 Jun 2026 09:37:16 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf v8 1/2] net: Validate protocol in skb_steal_sock() for BPF-assigned sockets To: Kuniyuki Iwashima Cc: Alexei Starovoitov , Alexei Starovoitov , bpf , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Shuah Khan , Joe Stringer , Network Development , LKML , "open list:KERNEL SELFTEST FRAMEWORK" References: <20260608125846.157004-1-jiayuan.chen@linux.dev> <20260608125846.157004-2-jiayuan.chen@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Jiayuan Chen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 6/10/26 1:14 AM, Kuniyuki Iwashima wrote: >> Hi Kuniyuki and Alexei, >> >> >> Thanks both for the discussion, it makes sense to me. >> >> I'll go back to fixing this in the helper itself, like the previous >> version did. > I think even the previous version is the same type of change > for intentional misuse. > > Both bpf_sk_assign() and bpf_sk_assign_tcp_reqsk() assumes > sk_lookup() in advance, meaning the bpf must have dissected > skb, and bpf_sk_assign() relies on it and has no protocol check. Hi Kuniyuki, Fair point. The "immutable skb" idea is more more worthy.