Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp620155rdb; Fri, 6 Oct 2023 13:21:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLzigW8RbJTXSyQPz95h6p9XfEDadaydeIFQawLD5uY1TdUIiYvI5c82lmu276q/T8irqV X-Received: by 2002:a17:90a:ee86:b0:277:522d:11e5 with SMTP id i6-20020a17090aee8600b00277522d11e5mr8721574pjz.2.1696623685159; Fri, 06 Oct 2023 13:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696623685; cv=none; d=google.com; s=arc-20160816; b=dF66+ZaPQ7dZbjetqfph3DNoVMUJARiIMWcp4W9N5HFV2wOPGqxzGD0VhgcF091jBg cPYGI/iFpu8w49z4swST3rFFYzGYZuH0u/W4pTIwOP1iHvQraiiA1goP/78tvFsJiEE7 FAEIPkSGK4Md72vqJqa8UfFUTxRH3hUMCALaDySyXNhxglYNabj4RRI7jiFoleTAJVNk hPY/l+sfWOb46FwuAaLtvaoB9vCL4ueqdMtDvuwq/Il+HNgcX7iaDWtqmHhdP7IBAtZN hLX94PqWAG5vZSTnD4Kf5e+/bx4ppk4GcnzgdSX/fdlV700fL76FBn/6oZHgKNx3p+BY sHzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N1oQgMYYOHJAqGUemakHE7gLhffpSOgun7mdtdcyLAY=; fh=F9Ko0QQZRTW4op8dN8x2Hy084H0R98ofaPIC5whflf0=; b=t2ntZ8MHlVngF9l263yccZ7jiwvLbwIg0CevHQH4i9MQ73kqPhPWenHYd7DGvzwTi+ DtqA1A/oIq3trgCLy0t2cfw1QY35KoJaZ5r/C33IwtdQX5J0dtrEaaLgV6CyHz5TlshC 06HWst+C3Unnpt94WPGjfiXaypBHYOL/Zj75qii8r4IwhZGEJiljhEbnmH/wRed/Uvur mKTPuMgNZYo+luoT2z08NGg1BmIuTlGPsU7MxWBUTJ3bIKwsBIDaGpeKoPizGmZK9A3r O4wqyx8dE+yttZJrf9HX185SQVw6CoiwhpYVBulyoHOfCebDs8JXOH4GIRdWc/gt5REX X+Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jc7xcclo; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a14-20020a17090a8c0e00b0027681e3a57fsi6487466pjo.162.2023.10.06.13.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:21:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jc7xcclo; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4537D820D5F0; Fri, 6 Oct 2023 13:21:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233465AbjJFUVR (ORCPT + 52 others); Fri, 6 Oct 2023 16:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233318AbjJFUVQ (ORCPT ); Fri, 6 Oct 2023 16:21:16 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ADBCBD for ; Fri, 6 Oct 2023 13:21:15 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c0ecb9a075so19572655ad.2 for ; Fri, 06 Oct 2023 13:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696623674; x=1697228474; 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=N1oQgMYYOHJAqGUemakHE7gLhffpSOgun7mdtdcyLAY=; b=jc7xccloVcyKtIUqHNW9tr5OKqtIb4XH0tjVog2mXqEoPZRvY3LirwxoSSLxGsEnep rWNFdAcP4NT2EEDCsqD+M+FGmJxc/zj98fujKfyl5tlsvYcAg2y06hDYi94/PsxHtzpU XJyDn4Oj5qJoNZ7Dvrm0xbyynKpkzoAx8yy6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696623674; x=1697228474; 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=N1oQgMYYOHJAqGUemakHE7gLhffpSOgun7mdtdcyLAY=; b=a+rF6dPfpFIbMDZ/5xHa+2EZ4GwsU7P7BoFy1P1Clp/pJdbbTHp2Jz424Wh8S6GyPT J56B07h6H3WZ2ispg+2OXYTStMhygkaf9ypnMm2FL4VUmtlVKQ+6YkP+T5bsyIgLPwQN wOKMLIZ25SjbUBo9tViwmqPyAVTGfdI9LT7F9T7Yvg4zSdnAQEgpQoAX96I7RHXh0FNA m//J5Dck03b/lT2InEDM2b/R2l16pBDcDxUWdhMx7axzqpb9qh6l1+63Yg0HxL/IfMnL fvcICHQP/tyV3XcVaha5T71WzdRi8mGYSfCDPjSdRXgQrCOCmJlKnxx/TnjS1rbvnbcP Xa3A== X-Gm-Message-State: AOJu0YzdKI3ORGDB+gNiUT8uZxvbgkB9XXLlJ6Xm2jPMNlKbiY13R9I7 cuUHu3/cnY7Tk886qaEfgqGGEA== X-Received: by 2002:a17:902:e810:b0:1c5:59ea:84de with SMTP id u16-20020a170902e81000b001c559ea84demr11148430plg.29.1696623674642; Fri, 06 Oct 2023 13:21:14 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id ji2-20020a170903324200b001c75f94b0b0sm4333924plb.213.2023.10.06.13.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:21:14 -0700 (PDT) Date: Fri, 6 Oct 2023 13:21:13 -0700 From: Kees Cook To: Felix Fietkau , Kalle Valo Cc: Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , linux-wireless@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by Message-ID: <202310061320.8630F7E51@keescook> References: <20230915200612.never.786-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230915200612.never.786-kees@kernel.org> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 06 Oct 2023 13:21:19 -0700 (PDT) X-Spam-Level: ** On Fri, Sep 15, 2023 at 01:06:12PM -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct mt76_rx_tid. Friendly ping. Can this get picked up by the wifi tree, or should it go via something else? Thanks! -Kees > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Felix Fietkau > Cc: Lorenzo Bianconi > Cc: Ryder Lee > Cc: Shayne Chen > Cc: Sean Wang > Cc: Kalle Valo > Cc: Matthias Brugger > Cc: AngeloGioacchino Del Regno > Cc: linux-wireless@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-mediatek@lists.infradead.org > Signed-off-by: Kees Cook > --- > drivers/net/wireless/mediatek/mt76/mt76.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h > index e8757865a3d0..03ef617b1527 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76.h > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h > @@ -376,7 +376,7 @@ struct mt76_rx_tid { > > u8 started:1, stopped:1, timer_pending:1; > > - struct sk_buff *reorder_buf[]; > + struct sk_buff *reorder_buf[] __counted_by(size); > }; > > #define MT_TX_CB_DMA_DONE BIT(0) > -- > 2.34.1 > -- Kees Cook