From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D136AE94114 for ; Fri, 6 Oct 2023 20:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2kBRI0XN36US6oEYItleSRyVTShHMJ6FQ1oHlJLb7lQ=; b=M9oUVsjIoD3Cet E1bXI2eB1FJVwuEj84ZkjjT1J04ZrO4qQVD7vQsXUlubbr02KkHVoX6aPvNVHO/rbR4DXoYQckymv 1J+5uwYKbuKdrIfH3QvCrvh3l1YHllw2dN1O1tiWa8CfIRlIoSTUptcVFFGrcKcbkAeQXSL/2Dtt4 vfmY1t5BdFfUj+DU0XcORfz2zpDZyBNqKejSSfr0L/zid77U0/xRuPiycIOWWF72S0QzXDT7HVYMl eQjrgqwmi1hqUAegvBVOnAFlMqqrQIV1v4xfXrvU27dXWKUgSaavVl7fQp5WHxJHYg64H7Hf/CD9q F10MGlDW2MMTv6ZuuW7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qorK7-006Rmd-1n; Fri, 06 Oct 2023 20:21:23 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qorK2-006RlY-33 for linux-arm-kernel@lists.infradead.org; Fri, 06 Oct 2023 20:21:22 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c3d8fb23d9so19743965ad.0 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=lists.infradead.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=FR1jN6gdtJOXUnGBzPBt41Dn1el2EnSC6WqVp5ZXHIrGwRo3ARdrIzCRwwxVwBWACV FQjrD/+rZ24CYbnsGBb52s//L92KcOlN9cJ9d7f1kEhAfUevqgm78BZtf9IJzyC+mxCs R5WvQM4yG622K9P+xg26HMkg5Flv2uAfB9yjo= 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=wTHTEy6km+OLkD5V+JX4DDzk/l6Bu87kjl0WX76Db4UaeK5ZjEdTCizdjBm97xO0XT GFXuW/F1dXrw+xqDecpkKim81kSFhATFjVFafTGAREY7QgRDJdIdqFM7UHzwBRp69UT+ PiZW48JB4NXfNvLU1rb+zXfJPmi4p92uJ2Izu1v08iiVGdZ6xpGeiAoqzJ3shloFaS09 dOhZi08cHcI4MUPDWh7Lty06ATuL2EwRleJr7P5h8r91WyZW9ZLDIiVaS2A1BN5eo3Y9 kf7tlF4ywuOVu+moQvUob95HjKgMsbkK/asyfHz4HX7yYl0VokkcEGL6XPJ4fj6aZU64 2ohA== X-Gm-Message-State: AOJu0YzzVPVFMJ06tVThhewIQpG+4JczzV+jBKAkhifYow95czG0Bx+l oz2rxtqP25tIDk/KaWvC15ROeA== X-Google-Smtp-Source: AGHT+IGu32OJlQsQg2gdMOhdV/v2W3V3QUsAfaY6LRJfqpsCLXyocjInS1I983619DISa2FBj4aXpA== 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-Disposition: inline In-Reply-To: <20230915200612.never.786-kees@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231006_132118_986412_20391986 X-CRM114-Status: GOOD ( 18.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel