Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp3712lqh; Mon, 6 May 2024 09:27:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPvCS6Q5+Q7AQo8IBqMPZl6Ikj6yF15qZoQwWsYZDNavHZT78oeuYWxBSsGiz9k0ZwOyhvQkKIMQf21tZ3LyB/dzYQkM3ETdSqO1PhCg== X-Google-Smtp-Source: AGHT+IHezHGy8T+aQcLPUSOt7Dbfkcb6mSISh9Zy/v6geV6EXLUIlnmzVdoeSwVRRN5+MShg0AIC X-Received: by 2002:a05:6402:190b:b0:572:d536:5d9a with SMTP id e11-20020a056402190b00b00572d5365d9amr10279090edz.23.1715012877151; Mon, 06 May 2024 09:27:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715012877; cv=pass; d=google.com; s=arc-20160816; b=f4hFAArgBfc8eeecbEfZc03xhHn7zkV/SWjNwVFf5TwI9qOd1hul3qJ+O5UMa2uZYH HqwjrKt89vevRZR4VXwRxSXhzM5mWENAA4+F9nA787oFpmpa6ZRCtPmqRyNAjiU7fd9Y PjNGYcq6Tz57e4B86U2VC8i5oP5GGWdlsTt0AX9qyNMPX7n6yO/xOAUp0FWqPxYo7n3p lk76lYSGVgtv6hjQ/UYhhbnjO3RJqMLSiasnNoc7TWELL1NLB0QRBFk3ScBfsTX/0CQZ xrN26l6cyzyJFGex1KYDvpOJUI/OptslPTLgmo/I8/myFCKvTPgEAdqyLKr5Nnozkom8 IdZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=odqzrPs//hj8WC38Rhd4Ch2SctDBzFte4EXtwtCBz3k=; fh=07q6Y6+clZ4QXOwCSW2sJrr1bE7Q/yqFallHNza8HCA=; b=T3jrqRBaiW+h2JDSRjYVCqqaHPDI7fVBfujEAnOXDubbhByvjKpqwmrDVY9iyiXZnz KkDLvMTniDdya7c2L0g4NyO366+mkjd52frgn7XaKOu6qwCiStivinMeHNjdsBI88jkk /ntlGm16lkzMj9vX9TzR+e+M8BjKqKAquiTzvlNfkN6kC5Lg5BdEkTHuV7Ma5k4LALvt 7c3BQWpXMRBuL9pSD7+i67MzIa0qvZIKeSOd4TMOo0d/548d+FgBLKWLqUoPYOnT7ovo h/QEgf20K9YnqACoGdIAsTT94mwWPKFaHuVdMrJriGqLSDMXAKWFDLB5LUYdktsrYTTV BWPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f+j3JvGf; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-170166-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170166-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bc7-20020a056402204700b005727b6fb6e4si4873824edb.368.2024.05.06.09.27.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:27:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170166-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f+j3JvGf; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-170166-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170166-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AC4E31F24966 for ; Mon, 6 May 2024 16:27:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F98515665A; Mon, 6 May 2024 16:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="f+j3JvGf" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D54E4156646 for ; Mon, 6 May 2024 16:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012869; cv=none; b=EP/xfwkasyLdUMGrPZPFYVKwyfM+R5HigP0FE0jVT58XYJiMOsBADGCQ1gsg3y0hk33wxF3WP+K1qvYilZMsKbEu6Fir01fMeFDlmuw+SmaiVrrxtddQZBN5UizOrUrasbz1zlJaruT0paLiGjr54BUy5bXfK2gctx/jIeIstqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012869; c=relaxed/simple; bh=BIZlorch0tOfWgLcDNbvKqrhtK4P+bKgxAxpz0AQEf4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HyFoiu5UsLpXurMzvF/clXBM4GXd74oNcykErIWYeosuCI92A5c1/b2zReQNhy5cWBcR5sxUtSLefzE9mjGWlWrbpubF0gbNQHZTGigQkfbjvEWHzW3U/dcWNC3RGozu/lB5vM/djSxyBbj5CgQTgC6mDsVvt7mutXeCkoKglEA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=f+j3JvGf; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6f44e3fd382so1478933b3a.1 for ; Mon, 06 May 2024 09:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715012867; x=1715617667; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=odqzrPs//hj8WC38Rhd4Ch2SctDBzFte4EXtwtCBz3k=; b=f+j3JvGf9+SLwdCCRoh/z+fBVTIciFD5uSUUmWj75mZrNrDttntkSwcWRBdvK3WIlq TOlkOc06ETMXZzPvHfZHq/LThTBcKQC0gs6QEyjPuAkS5sT3HWfTEW4q5ZVuKhzQDU4e Vljfnhf+8twqOwCv/OVQSAa9xBsqSCKxEBIRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715012867; x=1715617667; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=odqzrPs//hj8WC38Rhd4Ch2SctDBzFte4EXtwtCBz3k=; b=qWxdPQk0LURUXPaB8UecDEyZOprM2S8Tkj48/N8H+mM0d4hzizfN0P7QyiNUZpbnBU 03HRu9NC+nog/3jE3QHFmbH5AkPPhklXGmaLuhKwDZ4Sx7vQ6Ah4N0DcNj2tvfej5j+I X9sP2+qzoVIx7hAEWqOtId3HeRKItdDLfuG0gzOfpcsmk1DX+W7wD5d45krnEuGsm225 qkz4FkXpA4sO35bBgIWnaW1htvc8zucZqnDCikrW2gsAnFHF6cFfXW9n6AZMNaChdj9u 3R/sBwj9hHXcm9fhApe7AiF4dtdRO8DM1Q9UEaT0FxNyi7oCRjkNmTp7D9g92T64nzaQ EdEg== X-Forwarded-Encrypted: i=1; AJvYcCVddlgr6vU4ilHEGxHXdxuZp/R8JVdOtW54JarKAEJCgiJ1NX/TxBff2BPxJEGu7KG/18ZhWuGrjj0ZxbyBb6Sw7JltvWgDRTaKJLVX X-Gm-Message-State: AOJu0YwEsP4bhWjZQtMu6nSzzLGF9uB93LKL2IspRdQ3NFnPIn3LHuQU 4ab/lIKJFjWZleGNXVL52r9vGyQuPNBJ2r5mp12YiL55xhMuoYzZhsaE0mbNbg== X-Received: by 2002:a05:6a00:2342:b0:6f3:ea4b:d1c1 with SMTP id j2-20020a056a00234200b006f3ea4bd1c1mr12045012pfj.1.1715012867078; Mon, 06 May 2024 09:27:47 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id ls30-20020a056a00741e00b006f4123491d2sm7951997pfb.108.2024.05.06.09.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:27:46 -0700 (PDT) Date: Mon, 6 May 2024 09:27:46 -0700 From: Kees Cook To: Erick Archer Cc: Sven Eckelmann , Marek Lindner , Simon Wunderlich , Antonio Quartulli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , "Gustavo A. R. Silva" , b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev, Alexander Lobakin Subject: Re: [PATCH v3] batman-adv: Add flex array to struct batadv_tvlv_tt_data Message-ID: <202405060924.4001F77D@keescook> References: <3932737.ElGaqSPkdT@sven-l14> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sat, May 04, 2024 at 07:08:39PM +0200, Erick Archer wrote: > Hi Sven, > > On Sat, May 04, 2024 at 11:35:38AM +0200, Sven Eckelmann wrote: > > On Wednesday, 1 May 2024 17:02:42 CEST Erick Archer wrote: > > > diff --git a/include/uapi/linux/batadv_packet.h b/include/uapi/linux/batadv_packet.h > > > index 6e25753015df..dfbe30536995 100644 > > > --- a/include/uapi/linux/batadv_packet.h > > > +++ b/include/uapi/linux/batadv_packet.h > > [...] > > > +/** > > > + * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container > > > + * @flags: translation table flags (see batadv_tt_data_flags) > > > + * @ttvn: translation table version number > > > + * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by > > > + * one batadv_tvlv_tt_vlan_data object per announced vlan > > > + * @vlan_data: array of batadv_tvlv_tt_vlan_data objects > > > + */ > > > +struct batadv_tvlv_tt_data { > > > + __u8 flags; > > > + __u8 ttvn; > > > + __be16 num_vlan; > > > + struct batadv_tvlv_tt_vlan_data vlan_data[] __counted_by_be(num_vlan); > > > +}; > > > > Thanks for the updates. But I can't accept this at the moment because > > __counted_by_be is used in an uapi header without it being defined > > include/uapi/linux/stddef.h (and this file is also not included in this > > header). > > > > See commit c8248faf3ca2 ("Compiler Attributes: counted_by: Adjust name and > > identifier expansion") as an example for the similar __counted_by macro. > > If I understand correctly, the following changes are also needed because > the annotated struct is defined in a "uapi" header. Sorry if it's a stupid > question, but I'm new to these topics. > > diff --git a/include/uapi/linux/batadv_packet.h b/include/uapi/linux/batadv_packet.h > index 6e25753015df..41f39d7661c9 100644 > --- a/include/uapi/linux/batadv_packet.h > +++ b/include/uapi/linux/batadv_packet.h > @@ -9,6 +9,7 @@ > > #include > #include > +#include > #include > > /** > diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h > index 2ec6f35cda32..58154117d9b0 100644 > --- a/include/uapi/linux/stddef.h > +++ b/include/uapi/linux/stddef.h > @@ -55,4 +55,12 @@ > #define __counted_by(m) > #endif > > +#ifndef __counted_by_le > +#define __counted_by_le(m) > +#endif > + > +#ifndef __counted_by_be > +#define __counted_by_be(m) > +#endif > + > #endif /* _UAPI_LINUX_STDDEF_H */ Yup, this is needed for UAPI as you have it. Thanks! I should have noticed the need for this when I reviewed commit ca7e324e8ad3 ("compiler_types: add Endianness-dependent __counted_by_{le,be}"). > If this is the right path, can these changes be merged into a > single patch or is it better to add a previous patch to define > __counted_by{le,be}? We're almost on top of the merge window, so how about this: send me a patch for just the UAPI addition, and I'll include it in this coming (next week expected) merge window. Once -rc2 is out, re-send this batman-adv patch since then netdev will be merged with -rc2 and the UAPI change will be there. -Kees -- Kees Cook