* [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by
@ 2023-09-15 20:06 Kees Cook
2023-09-15 20:33 ` Gustavo A. R. Silva
2023-10-06 20:21 ` Kees Cook
0 siblings, 2 replies; 4+ messages in thread
From: Kees Cook @ 2023-09-15 20:06 UTC (permalink / raw)
To: Felix Fietkau
Cc: Kees Cook, Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang,
Kalle Valo, Matthias Brugger, AngeloGioacchino Del Regno,
linux-wireless, linux-arm-kernel, linux-mediatek,
Nathan Chancellor, Nick Desaulniers, Tom Rix, linux-kernel, llvm,
linux-hardening
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.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc: Felix Fietkau <nbd@nbd.name>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Shayne Chen <shayne.chen@mediatek.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-wireless@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by
2023-09-15 20:06 [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by Kees Cook
@ 2023-09-15 20:33 ` Gustavo A. R. Silva
2023-10-06 20:21 ` Kees Cook
1 sibling, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2023-09-15 20:33 UTC (permalink / raw)
To: Kees Cook, Felix Fietkau
Cc: Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang, Kalle Valo,
Matthias Brugger, AngeloGioacchino Del Regno, linux-wireless,
linux-arm-kernel, linux-mediatek, Nathan Chancellor,
Nick Desaulniers, Tom Rix, linux-kernel, llvm, linux-hardening
On 9/15/23 14:06, 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.
>
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
>
> Cc: Felix Fietkau <nbd@nbd.name>
> Cc: Lorenzo Bianconi <lorenzo@kernel.org>
> Cc: Ryder Lee <ryder.lee@mediatek.com>
> Cc: Shayne Chen <shayne.chen@mediatek.com>
> Cc: Sean Wang <sean.wang@mediatek.com>
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Thanks
--
Gustavo
> ---
> 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)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by
2023-09-15 20:06 [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by Kees Cook
2023-09-15 20:33 ` Gustavo A. R. Silva
@ 2023-10-06 20:21 ` Kees Cook
2023-10-07 3:45 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Kees Cook @ 2023-10-06 20:21 UTC (permalink / raw)
To: Felix Fietkau, Kalle Valo
Cc: Lorenzo Bianconi, Ryder Lee, Shayne Chen, Sean Wang,
Matthias Brugger, AngeloGioacchino Del Regno, linux-wireless,
linux-arm-kernel, linux-mediatek, Nathan Chancellor,
Nick Desaulniers, Tom Rix, linux-kernel, llvm, linux-hardening
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 <nbd@nbd.name>
> Cc: Lorenzo Bianconi <lorenzo@kernel.org>
> Cc: Ryder Lee <ryder.lee@mediatek.com>
> Cc: Shayne Chen <shayne.chen@mediatek.com>
> Cc: Sean Wang <sean.wang@mediatek.com>
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by
2023-10-06 20:21 ` Kees Cook
@ 2023-10-07 3:45 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-10-07 3:45 UTC (permalink / raw)
To: Kees Cook
Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
Sean Wang, Matthias Brugger, AngeloGioacchino Del Regno,
linux-wireless, linux-arm-kernel, linux-mediatek,
Nathan Chancellor, Nick Desaulniers, Tom Rix, linux-kernel, llvm,
linux-hardening
Kees Cook <keescook@chromium.org> writes:
> 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?
It's already in mt76 pull request and should be in wireless-next next
week:
https://patchwork.kernel.org/project/linux-wireless/patch/a5a2baaa-0db4-403e-9ebd-a7ff089675b4@nbd.name/
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-07 3:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 20:06 [PATCH] wifi: mt76: Annotate struct mt76_rx_tid with __counted_by Kees Cook
2023-09-15 20:33 ` Gustavo A. R. Silva
2023-10-06 20:21 ` Kees Cook
2023-10-07 3:45 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).