From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 6ADC32DEA9D for ; Thu, 23 Oct 2025 10:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761216194; cv=none; b=hTaQ2KHujmRIcz9XVTqUCDeW3zzz7RT84VhFq0L+UeBrVhEHCjD/3RgQdzW5LhBuc7t8MkBTbfkOebbXFweAJICekWnp/Fym92AwAcMonQXn7VpdP8iqGkmr1RKiyMUbYV9aUvtkbvbmctG0stFf5cXE3ZqS74X3aCuo1/CHjrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761216194; c=relaxed/simple; bh=PSq4rzHsTZYmnPW7B8CFsP6cGQe5nHJwDQGMbKTQhlE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ztb6Y66jZzTMCJQAa2a8TovD9+C5yfGY7IOJqjkXNaI9kBOmwjSItT0/oUKFEHnv1fhcR0cvVlMYUHdi/uIlHU1N3/3FyU0h3Hk2chpd6OkxRK/ZMTVPpWRD9vSZAJ9uC++EJwy9kO25MPTeKGfEhvcpjlww2SI4hdC5f9rACGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OoIEKFsf; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OoIEKFsf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761216191; 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=2itfR4P5vWlnhxtQmgFjh+n2XUI3sGLIeHL7uzBaLr4=; b=OoIEKFsfd+wa7B+3LKuT7Q0VDVLEau24H/nFiTTaihE2RSoFazJwaS6triRv7xv7Oc/TZO U2daQW1JguY6pXSTfmXJ5DOkurcHrTfb9rkLxPECpIsd9fJIwJwstMKeFx59SDbQH//3Fp kvHWhVLZ/AcWrTw4kt+sln/4kutVJgk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-8-4Iv4Z0vdO7KOE_HIONuRkg-1; Thu, 23 Oct 2025 06:43:09 -0400 X-MC-Unique: 4Iv4Z0vdO7KOE_HIONuRkg-1 X-Mimecast-MFC-AGG-ID: 4Iv4Z0vdO7KOE_HIONuRkg_1761216189 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47114d373d5so5208115e9.1 for ; Thu, 23 Oct 2025 03:43:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761216188; x=1761820988; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2itfR4P5vWlnhxtQmgFjh+n2XUI3sGLIeHL7uzBaLr4=; b=r7uUchd2U4uujaebm3DSQkkg3D37Vl0mAbRiYnatvqAiXUFXrjC2Fnw7YUvwb8Vm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-47117925171mr243744025e9.34.1761216188624; Thu, 23 Oct 2025 03:43:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeZ82VrSnvpK1c3qyzIXLRxmMNdmjxKL2P/cuqpRB9ovXOV8FGWqUSGpOdh0UCletrBUBh+w== X-Received: by 2002:a05:600c:3b83:b0:46e:3d41:6001 with SMTP id 5b1f17b1804b1-47117925171mr243743745e9.34.1761216188204; Thu, 23 Oct 2025 03:43:08 -0700 (PDT) Received: from ?IPV6:2a0d:3344:2712:7e10:4d59:d956:544f:d65c? ([2a0d:3344:2712:7e10:4d59:d956:544f:d65c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-475cae92067sm31140865e9.4.2025.10.23.03.43.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Oct 2025 03:43:07 -0700 (PDT) Message-ID: <268ee657-903a-4271-9e17-fcf1dc79b92c@redhat.com> Date: Thu, 23 Oct 2025 12:43:06 +0200 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/9] net: Add struct sockaddr_unspec for sockaddr of unknown length To: Kees Cook , Jakub Kicinski Cc: "Gustavo A. R. Silva" , Alexei Starovoitov , Daniel Borkmann , John Fastabend , "David S. Miller" , Eric Dumazet , Simon Horman , Kuniyuki Iwashima , Willem de Bruijn , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-hardening@vger.kernel.org References: <20251020212125.make.115-kees@kernel.org> <20251020212639.1223484-1-kees@kernel.org> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20251020212639.1223484-1-kees@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/20/25 11:26 PM, Kees Cook wrote: > Add flexible sockaddr structure to support addresses longer than the > traditional 14-byte struct sockaddr::sa_data limitation without > requiring the full 128-byte sa_data of struct sockaddr_storage. This > allows the network APIs to pass around a pointer to an object that > isn't lying to the compiler about how big it is, but must be accompanied > by its actual size as an additional parameter. > > It's possible we may way to migrate to including the size with the > struct in the future, e.g.: > > struct sockaddr_unspec { > u16 sa_data_len; > u16 sa_family; > u8 sa_data[] __counted_by(sa_data_len); > }; Side note: sockaddr_unspec is possibly not the optimal name, as AF_UNSPEC has a specific meaning/semantic. Name-wise, I think 'sockaddr_sized' would be better, but I agree with David the struct may cause unaligned access problems. /P