Batch 1: Annotate structs with __counted_by
Subsystems (12)
cover Batch 1: Annotate structs with __counted_by
Hi,
This is the batch 1 of patches touching netdev for preparing 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 to structs that would benefit from the annotation.
Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.)
-Kees
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Kees Cook (14):
ipv4: Annotate struct fib_info with __counted_by ipv4/igmp: Annotate struct ip_sf_socklist with __counted_by
ipv6: Annotate struct ip6_sf_socklist with __counted_by
net: hns: Annotate struct ppe_common_cb with __counted_by
net: enetc: Annotate struct enetc_int_vector with __counted_by
net: hisilicon: Annotate struct rcb_common_cb with __counted_by
net: mana: Annotate struct mana_rxq with __counted_by
net: ipa: Annotate struct ipa_power with __counted_by
net: mana: Annotate struct hwc_dma_buf with __counted_by
net: openvswitch: Annotate struct dp_meter_instance with __counted_by
net: enetc: Annotate struct enetc_psfp_gate with __counted_by
net: openvswitch: Annotate struct dp_meter with __counted_by
net: tulip: Annotate struct mediatable with __counted_by
net: sched: Annotate struct tc_pedit with __counted_by
drivers/net/ethernet/dec/tulip/tulip.h | 2 +- drivers/net/ethernet/freescale/enetc/enetc.h | 2 +- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | 2 +- drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | 2 +- drivers/net/ipa/ipa_power.c | 2 +- include/linux/igmp.h | 2 +- include/net/if_inet6.h | 2 +- include/net/ip_fib.h | 2 +- include/net/mana/hw_channel.h | 2 +- include/net/mana/mana.h | 2 +- net/openvswitch/meter.h | 4 ++-- net/sched/act_pedit.c | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/14 ipv4: Annotate struct fib_info with __counted_by
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 fib_info.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- include/net/ip_fib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/ip_fib.h +1 -1
@@ -156,7 +156,7 @@ struct fib_info {bool nh_updated;struct nexthop *nh;struct rcu_head rcu; -struct fib_nh fib_nh[]; + struct fib_nh fib_nh[] __counted_by(fib_nhs); };
Signature · 1 line
2.34.1
Re: [PATCH 01/14] ipv4: Annotate struct fib_info with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structfib_info.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 7 lines
Cc "David S. Miller" <[email protected]>Cc David Ahern <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- include/net/ip_fib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/net/ip_fib.h +1
-1@@ -156,7 +156,7 @@ struct fib_info {bool nh_updated;struct nexthop *nh;struct rcu_head rcu; -struct fib_nh fib_nh[]; + struct fib_nh fib_nh[] __counted_by(fib_nhs); };
PATCH 2/14 ipv4/igmp: Annotate struct ip_sf_socklist with __counted_by
In reply to Kees CookPrepare 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 ip_sf_socklist.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- include/linux/igmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/igmp.h +1 -1
@@ -39,7 +39,7 @@ struct ip_sf_socklist {unsigned int sl_max;unsigned int sl_count;struct rcu_head rcu; -__be32 sl_addr[]; + __be32 sl_addr[] __counted_by(sl_max); };#define IP_SFBLOCK 10/* allocate this many at once */
Signature · 1 line
2.34.1
Re: [PATCH 02/14] ipv4/igmp: Annotate struct ip_sf_socklist with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structip_sf_socklist.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 7 lines
Cc "David S. Miller" <[email protected]>Cc Martin KaFai Lau <[email protected]>Cc "Gustavo A. R. Silva" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Jakub Kicinski <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- include/linux/igmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/igmp.h +1
-1@@ -39,7 +39,7 @@ struct ip_sf_socklist {unsigned int sl_max;unsigned int sl_count;struct rcu_head rcu; -__be32 sl_addr[]; + __be32 sl_addr[] __counted_by(sl_max); };#define IP_SFBLOCK 10/* allocate this many at once */
PATCH 3/14 ipv6: Annotate struct ip6_sf_socklist with __counted_by
In reply to Kees CookPrepare 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 ip6_sf_socklist.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- include/net/if_inet6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/if_inet6.h +1 -1
@@ -89,7 +89,7 @@ struct ip6_sf_socklist {unsigned int sl_max;unsigned int sl_count;struct rcu_head rcu; -struct in6_addr sl_addr[]; + struct in6_addr sl_addr[] __counted_by(sl_max); };#define IP6_SFBLOCK 10/* allocate this many at once */
Signature · 1 line
2.34.1
Re: [PATCH 03/14] ipv6: Annotate struct ip6_sf_socklist with __counted_by
Quoted 8 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structip6_sf_socklist.
Quoted 8 lines
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- include/net/if_inet6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/net/if_inet6.h +1
-1@@ -89,7 +89,7 @@ struct ip6_sf_socklist {unsigned int sl_max;unsigned int sl_count;struct rcu_head rcu; -struct in6_addr sl_addr[]; + struct in6_addr sl_addr[] __counted_by(sl_max); };#define IP6_SFBLOCK 10/* allocate this many at once */
PATCH 4/14 net: hns: Annotate struct ppe_common_cb with __counted_by
In reply to Kees CookPrepare 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 ppe_common_cb.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h +1 -1
@@ -92,7 +92,7 @@ struct ppe_common_cb {u8 comm_index;/*ppe_common index*/ u32 ppe_num; -struct hns_ppe_cb ppe_cb[]; + struct hns_ppe_cb ppe_cb[] __counted_by(ppe_num); };
Signature · 1 line
2.34.1
Re: [PATCH 04/14] net: hns: Annotate struct ppe_common_cb with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structppe_common_cb.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Yisen Zhuang <[email protected]>Cc Salil Mehta <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h +1
-1@@ -92,7 +92,7 @@ struct ppe_common_cb {u8 comm_index;/*ppe_common index*/ u32 ppe_num; -struct hns_ppe_cb ppe_cb[]; + struct hns_ppe_cb ppe_cb[] __counted_by(ppe_num); };
PATCH 5/14 net: enetc: Annotate struct enetc_int_vector with __counted_by
In reply to Kees CookPrepare 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 enetc_int_vector.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ethernet/freescale/enetc/enetc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.h +1 -1
@@ -297,7 +297,7 @@ struct enetc_int_vector {char name[ENETC_INT_NAME_MAX ];struct enetc_bdr rx_ring; -struct enetc_bdr tx_ring[]; + struct enetc_bdr tx_ring[] __counted_by(count_tx_rings); }____cacheline_aligned_in_smp ;struct enetc_cls_rule {
Signature · 1 line
2.34.1
Re: [PATCH 05/14] net: enetc: Annotate struct enetc_int_vector with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structenetc_int_vector.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Claudiu Manoil <[email protected]>Cc Vladimir Oltean <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ethernet/freescale/enetc/enetc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/enetc/enetc.h +1
-1@@ -297,7 +297,7 @@ struct enetc_int_vector {char name[ENETC_INT_NAME_MAX ];struct enetc_bdr rx_ring; -struct enetc_bdr tx_ring[]; + struct enetc_bdr tx_ring[] __counted_by(count_tx_rings); }____cacheline_aligned_in_smp ;struct enetc_cls_rule {
PATCH 6/14 net: hisilicon: Annotate struct rcb_common_cb with __counted_by
In reply to Kees CookPrepare 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 rcb_common_cb.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h +1 -1
@@ -108,7 +108,7 @@ struct rcb_common_cb {u32 ring_num;u32 desc_num;/* desc num per queue*/ -struct ring_pair_cb ring_pair_cb[]; + struct ring_pair_cb ring_pair_cb[] __counted_by(ring_num); };int hns_rcb_buf_size2type (u32 buf_size);
Signature · 1 line
2.34.1
Re: [PATCH 06/14] net: hisilicon: Annotate struct rcb_common_cb with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structrcb_common_cb.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Yisen Zhuang <[email protected]>Cc Salil Mehta <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h +1
-1@@ -108,7 +108,7 @@ struct rcb_common_cb {u32 ring_num;u32 desc_num;/* desc num per queue*/ -struct ring_pair_cb ring_pair_cb[]; + struct ring_pair_cb ring_pair_cb[] __counted_by(ring_num); };int hns_rcb_buf_size2type (u32 buf_size);
PATCH 7/14 net: mana: Annotate struct mana_rxq with __counted_by
In reply to Kees CookPrepare 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 mana_rxq.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- include/net/mana/mana.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mana/mana.h +1 -1
@@ -338,7 +338,7 @@ struct mana_rxq {/* MUST BE THE LAST MEMBER: * Each receive buffer has an associated mana_recv_buf_oob. */ -struct mana_recv_buf_oob rx_oobs[]; + struct mana_recv_buf_oob rx_oobs[] __counted_by(num_rx_buf); };struct mana_tx_qp {
Signature · 1 line
2.34.1
Re: [PATCH 07/14] net: mana: Annotate struct mana_rxq with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structmana_rxq.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 14 lines
Cc "K. Y. Srinivasan" <[email protected]>Cc Haiyang Zhang <[email protected]>Cc Wei Liu <[email protected]>Cc Dexuan Cui <[email protected]>Cc Long Li <[email protected]>Cc Ajay Sharma <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- include/net/mana/mana.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/net/mana/mana.h +1
-1@@ -338,7 +338,7 @@ struct mana_rxq {/* MUST BE THE LAST MEMBER: * Each receive buffer has an associated mana_recv_buf_oob. */ -struct mana_recv_buf_oob rx_oobs[]; + struct mana_recv_buf_oob rx_oobs[] __counted_by(num_rx_buf); };struct mana_tx_qp {
PATCH 8/14 net: ipa: Annotate struct ipa_power with __counted_by
In reply to Kees CookPrepare 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 ipa_power.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ipa/ipa_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/ipa_power.c +1 -1
@@ -67,7 +67,7 @@ struct ipa_power {spinlock_t spinlock;/* used with STOPPED/STARTED power flags */ DECLARE_BITMAP (flags,IPA_POWER_FLAG_COUNT );u32 interconnect_count; -struct icc_bulk_data interconnect[]; + struct icc_bulk_data interconnect[] __counted_by(interconnect_count); };/* Initialize interconnects required for IPA operation */
Signature · 1 line
2.34.1
Re: [PATCH 08/14] net: ipa: Annotate struct ipa_power with __counted_by
Quoted 7 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structipa_power.
Looks good, thanks.
Note that there is some interaction between struct ipa_power_data and struct ipa_power (the former is used to initialize the latter). Both of these contain flexible arrays counted by another field in the structure. It seems possible that the way these are initialized might need slight modification to allow the compiler to do its enforcement; if that's the case, please reach out to me.
-Alex
Quoted 26 lines
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc Alex Elder <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>--- drivers/net/ipa/ipa_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ipa/ipa_power.c +1
-1@@ -67,7 +67,7 @@ struct ipa_power {spinlock_t spinlock;/* used with STOPPED/STARTED power flags */ DECLARE_BITMAP (flags,IPA_POWER_FLAG_COUNT );u32 interconnect_count; -struct icc_bulk_data interconnect[]; + struct icc_bulk_data interconnect[] __counted_by(interconnect_count); };/* Initialize interconnects required for IPA operation */
Re: [PATCH 08/14] net: ipa: Annotate struct ipa_power with __counted_by
Quoted 11 lines · Alex Elder
Quoted 7 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structipa_power.Looks good, thanks.
Quoted 8 lines
Reviewed-by Alex Elder <[email protected]>Note that there is some interaction between struct
ipa_power_dataand structipa_power(the former is used to initialize the latter). Both of these contain flexible arrays counted by another field in the structure. It seems possible that the way these are initialized might need slight modification to allow the compiler to do its enforcement; if that's the case, please reach out to me.
I think it's all okay:
struct ipa_power_data {
u32 core_clock_rate;
u32 interconnect_count; /* # entries in interconnect_data[] */
const struct ipa_interconnect_data *interconnect_data;
};"interconnect_data" here is a pointer, not a flexible array. (Yes, __counted_by is expected to be expanded in the future for pointers, but not yet.) Looking at initializers, I didn't see any problems with how struct ipa_power is allocated.
Thanks for the heads-up; I'm sure I'll look at this again when we can further expand __counted_by to pointers. :)
-Kees
Signature · 1 line
Kees Cook
Re: [PATCH 08/14] net: ipa: Annotate struct ipa_power with __counted_by
In reply to Kees CookQuoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structipa_power.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 7 lines
Cc Alex Elder <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ipa/ipa_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ipa/ipa_power.c +1
-1@@ -67,7 +67,7 @@ struct ipa_power {spinlock_t spinlock;/* used with STOPPED/STARTED power flags */ DECLARE_BITMAP (flags,IPA_POWER_FLAG_COUNT );u32 interconnect_count; -struct icc_bulk_data interconnect[]; + struct icc_bulk_data interconnect[] __counted_by(interconnect_count); };/* Initialize interconnects required for IPA operation */
PATCH 9/14 net: mana: Annotate struct hwc_dma_buf with __counted_by
In reply to Kees CookPrepare 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 hwc_dma_buf.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- include/net/mana/hw_channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mana/hw_channel.h +1 -1
@@ -121,7 +121,7 @@ struct hwc_dma_buf {u32 gpa_mkey;u32 num_reqs; -struct hwc_work_request reqs[]; + struct hwc_work_request reqs[] __counted_by(num_reqs); }; typedef void hwc_rx_event_handler_t(void *ctx, u32 gdma_rxq_id,
Signature · 1 line
2.34.1
Re: [PATCH 09/14] net: mana: Annotate struct hwc_dma_buf with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structhwc_dma_buf.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 14 lines
Cc Long Li <[email protected]>Cc Ajay Sharma <[email protected]>Cc "K. Y. Srinivasan" <[email protected]>Cc Haiyang Zhang <[email protected]>Cc Wei Liu <[email protected]>Cc Dexuan Cui <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- include/net/mana/hw_channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/net/mana/hw_channel.h +1
-1@@ -121,7 +121,7 @@ struct hwc_dma_buf {u32 gpa_mkey;u32 num_reqs; -struct hwc_work_request reqs[]; + struct hwc_work_request reqs[] __counted_by(num_reqs); }; typedef void hwc_rx_event_handler_t(void *ctx, u32 gdma_rxq_id,
PATCH 10/14 net: openvswitch: Annotate struct dp_meter_instance with __counted_by
In reply to Kees CookPrepare 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 dp_meter_instance.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- net/openvswitch/meter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/meter.h +1 -1
@@ -45,7 +45,7 @@ struct dp_meter {struct dp_meter_instance {struct rcu_head rcu;u32 n_meters; -struct dp_meter __rcu *dp_meters[]; + struct dp_meter __rcu *dp_meters[] __counted_by(n_meters); };struct dp_meter_table {
Signature · 1 line
2.34.1
Re: [PATCH 10/14] net: openvswitch: Annotate struct dp_meter_instance with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structdp_meter_instance.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Pravin B Shelar <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- net/openvswitch/meter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/openvswitch/meter.h +1
-1@@ -45,7 +45,7 @@ struct dp_meter {struct dp_meter_instance {struct rcu_head rcu;u32 n_meters; -struct dp_meter __rcu *dp_meters[]; + struct dp_meter __rcu *dp_meters[] __counted_by(n_meters); };struct dp_meter_table {
PATCH 11/14 net: enetc: Annotate struct enetc_psfp_gate with __counted_by
In reply to Kees CookPrepare 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 enetc_psfp_gate.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +1 -1
@@ -443,7 +443,7 @@ struct enetc_psfp_gate {u32 num_entries;refcount_t refcount;struct hlist_node node; -struct action_gate_entry entries[]; + struct action_gate_entry entries[] __counted_by(num_entries); };/* Only enable the green color frame now
Signature · 1 line
2.34.1
Re: [PATCH 11/14] net: enetc: Annotate struct enetc_psfp_gate with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structenetc_psfp_gate.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Claudiu Manoil <[email protected]>Cc Vladimir Oltean <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/enetc/enetc_qos.c +1
-1@@ -443,7 +443,7 @@ struct enetc_psfp_gate {u32 num_entries;refcount_t refcount;struct hlist_node node; -struct action_gate_entry entries[]; + struct action_gate_entry entries[] __counted_by(num_entries); };/* Only enable the green color frame now
PATCH 12/14 net: openvswitch: Annotate struct dp_meter with __counted_by
In reply to Kees CookPrepare 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 dp_meter.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- net/openvswitch/meter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/meter.h +1 -1
@@ -39,7 +39,7 @@ struct dp_meter {u32 max_delta_t;u64 used;struct ovs_flow_stats stats; -struct dp_meter_band bands[]; + struct dp_meter_band bands[] __counted_by(n_bands); };struct dp_meter_instance {
Signature · 1 line
2.34.1
Re: [PATCH 12/14] net: openvswitch: Annotate struct dp_meter with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structdp_meter.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc Pravin B Shelar <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- net/openvswitch/meter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/openvswitch/meter.h +1
-1@@ -39,7 +39,7 @@ struct dp_meter {u32 max_delta_t;u64 used;struct ovs_flow_stats stats; -struct dp_meter_band bands[]; + struct dp_meter_band bands[] __counted_by(n_bands); };struct dp_meter_instance {
PATCH 13/14 net: tulip: Annotate struct mediatable with __counted_by
In reply to Kees CookPrepare 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 mediatable.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- drivers/net/ethernet/dec/tulip/tulip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/tulip.h +1 -1
@@ -381,7 +381,7 @@ struct mediatable { unsigned has_reset:6;u32 csr15dir;u32 csr15val;/* 21143 NWay setting. */ -struct medialeaf mleaf[]; + struct medialeaf mleaf[] __counted_by(leafcount); };
Signature · 1 line
2.34.1
Re: [PATCH 13/14] net: tulip: Annotate struct mediatable with __counted_by
Quoted 10 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor struct mediatable.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Quoted 8 lines
Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc Shaokun Zhang <[email protected]>Signed-off-by Kees Cook <[email protected]>
Thanks
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/net/ethernet/dec/tulip/tulip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/dec/tulip/tulip.h +1
-1@@ -381,7 +381,7 @@ struct mediatable { unsigned has_reset:6;u32 csr15dir;u32 csr15val;/* 21143 NWay setting. */ -struct medialeaf mleaf[]; + struct medialeaf mleaf[] __counted_by(leafcount); };
PATCH 14/14 net: sched: Annotate struct tc_pedit with __counted_by
In reply to Kees CookPrepare 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 tc_pedit. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
--- net/sched/act_pedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_pedit.c +1 -1
@@ -515,11 +515,11 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,spin_unlock_bh (&p->tcf_lock);return -ENOBUFS ; } + opt->nkeys = parms->tcfp_nkeys;memcpy (opt->keys, parms->tcfp_keys,flex_array_size (opt, keys, parms->tcfp_nkeys)); opt->index = p->tcf_index; - opt->nkeys = parms->tcfp_nkeys; opt->flags = parms->tcfp_flags; opt->action = p->tcf_action; opt->refcnt =refcount_read (&p->tcf_refcnt) - ref;
Signature · 1 line
2.34.1
Re: [PATCH 14/14] net: sched: Annotate struct tc_pedit with __counted_by
Quoted 44 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structtc_pedit. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc Jamal Hadi Salim <[email protected]>Cc Cong Wang <[email protected]>Cc Jiri Pirko <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>--- net/sched/act_pedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/act_pedit.c +1
-1@@ -515,11 +515,11 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,spin_unlock_bh (&p->tcf_lock);return -ENOBUFS ; } + opt->nkeys = parms->tcfp_nkeys;memcpy (opt->keys, parms->tcfp_keys,flex_array_size (opt, keys, parms->tcfp_nkeys)); opt->index = p->tcf_index; - opt->nkeys = parms->tcfp_nkeys; opt->flags = parms->tcfp_flags; opt->action = p->tcf_action; opt->refcnt =refcount_read (&p->tcf_refcnt) - ref;Signature · 1 line
2.34.1
Gustavo pointed out that the annotation half of this patch in missing. My mistake! I will figure out where it went. :P Ah, the joys of splitting up a treewide patch series...
Signature · 1 line
Kees Cook
Re: [PATCH 14/14] net: sched: Annotate struct tc_pedit with __counted_by
In reply to Kees CookQuoted 45 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structtc_pedit. Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier.[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc Jamal Hadi Salim <[email protected]>Cc Cong Wang <[email protected]>Cc Jiri Pirko <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>--- net/sched/act_pedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/act_pedit.c +1
-1@@ -515,11 +515,11 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,spin_unlock_bh (&p->tcf_lock);return -ENOBUFS ; } + opt->nkeys = parms->tcfp_nkeys;memcpy (opt->keys, parms->tcfp_keys,flex_array_size (opt, keys, parms->tcfp_nkeys)); opt->index = p->tcf_index; - opt->nkeys = parms->tcfp_nkeys; opt->flags = parms->tcfp_flags; opt->action = p->tcf_action; opt->refcnt =refcount_read (&p->tcf_refcnt) - ref;Signature · 1 line
2.34.1
Coccinelle was not happy about the #define ...
struct tc_pedit_sel {
tc_gen;
unsigned char nkeys;
unsigned char flags;
struct tc_pedit_key keys[0];
};#define tc_pedit tc_pedit_sel
Also, it's not been converted to a proper flexible array...
Signature · 1 line
Kees Cook
Re: [PATCH 14/14] net: sched: Annotate struct tc_pedit with __counted_by
In reply to Kees CookQuoted 7 lines · Kees Cook
Prepare for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).As found with Coccinelle[1], add
__counted_byfor structtc_pedit.
I think the annotation for struct tc_pedit_sel is missing.
Thanks
--
Gustavo
Quoted 35 lines
Additionally, since the element count member must be set before accessing the annotated flexible array member, move its initialization earlier.
[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
Cc Jamal Hadi Salim <[email protected]>Cc Cong Wang <[email protected]>Cc Jiri Pirko <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>--- net/sched/act_pedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/act_pedit.c +1
-1@@ -515,11 +515,11 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,spin_unlock_bh (&p->tcf_lock);return -ENOBUFS ; } + opt->nkeys = parms->tcfp_nkeys;memcpy (opt->keys, parms->tcfp_keys,flex_array_size (opt, keys, parms->tcfp_nkeys)); opt->index = p->tcf_index; - opt->nkeys = parms->tcfp_nkeys; opt->flags = parms->tcfp_flags; opt->action = p->tcf_action; opt->refcnt =refcount_read (&p->tcf_refcnt) - ref;
Quoted 7 lines · Kees Cook
This is the batch 1 of patches touching netdev for preparing for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).
Quoted 6 lines
As found with Coccinelle[1], add
__counted_byto structs that would benefit from the annotation.Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.)
Hi, just checking on this batch of changes. Is it possible to take the 1-13 subset:
Quoted 6 lines
Kees Cook (14):
ipv4: Annotate structfib_infowith__counted_byipv4/igmp: Annotate structip_sf_socklistwith__counted_by
ipv6: Annotate structip6_sf_socklistwith__counted_by
net: hns: Annotate structppe_common_cbwith__counted_by
net: enetc: Annotate structenetc_int_vectorwith__counted_by
Quoted 8 lines
net: hisilicon: Annotate struct
rcb_common_cbwith__counted_by
net: mana: Annotate structmana_rxqwith__counted_by
net: ipa: Annotate structipa_powerwith__counted_by
net: mana: Annotate structhwc_dma_bufwith__counted_by
net: openvswitch: Annotate structdp_meter_instancewith__counted_by
net: enetc: Annotate structenetc_psfp_gatewith__counted_by
net: openvswitch: Annotate structdp_meterwith__counted_by
net: tulip: Annotate struct mediatable with__counted_by
I'll respin 14 and add it to the next batch:
Quoted 1 line
net: sched: Annotate struct
tc_peditwith__counted_by
After these 13, there are 32 more patches to various drivers and protocols...
Thanks!
-Kees
Signature · 1 line
Kees Cook
Jakub Kicinski
maintainerQuoted 6 lines · On Wed, 27 Sep 2023 08:57:36 -0700 Kees Cook wrote:
Quoted 3 lines
Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.)
Hi, just checking on this batch of changes. Is it possible to take the 1-13 subset:
On it, sorry for the delay.
Quoted 9 lines · Jakub Kicinski
Quoted 6 lines · On Wed, 27 Sep 2023 08:57:36 -0700 Kees Cook wrote:
Quoted 3 lines
Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.)
Hi, just checking on this batch of changes. Is it possible to take the 1-13 subset:
On it, sorry for the delay.
No worries; thanks for grabbing them!
Signature · 1 line
Kees Cook
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 22 Sep 2023 10:28:42 -0700 you wrote:
Hi,
This is the batch 1 of patches touching netdev for preparing for the coming implementation by GCC and Clang of the
__counted_byattribute. Flexible array members annotated with__counted_bycan have their accesses bounds-checked at run-time checking viaCONFIG_UBSAN_BOUNDS(for array indexing) andCONFIG_FORTIFY_SOURCE(for strcpy/memcpy-family functions).[...]
Here is the summary with links:
- [01/14] ipv4: Annotate struct fib_info with __counted_by
https://git.kernel.org/netdev/net-next/c/5b98fd5dc1e3 - [02/14] ipv4/igmp: Annotate struct ip_sf_socklist with __counted_by https://git.kernel.org/netdev/net-next/c/210d4e9c732f - [03/14] ipv6: Annotate struct ip6_sf_socklist with __counted_by https://git.kernel.org/netdev/net-next/c/5d22b6528073 - [04/14] net: hns: Annotate struct ppe_common_cb with __counted_by https://git.kernel.org/netdev/net-next/c/5b829c8460ae - [05/14] net: enetc: Annotate struct enetc_int_vector with __counted_by https://git.kernel.org/netdev/net-next/c/dd8e215ea9a8 - [06/14] net: hisilicon: Annotate struct rcb_common_cb with __counted_by https://git.kernel.org/netdev/net-next/c/2290999d278e - [07/14] net: mana: Annotate struct mana_rxq with __counted_by https://git.kernel.org/netdev/net-next/c/a3d7a1209bbb - [08/14] net: ipa: Annotate struct ipa_power with __counted_by https://git.kernel.org/netdev/net-next/c/20551ee45d7d - [09/14] net: mana: Annotate struct hwc_dma_buf with __counted_by https://git.kernel.org/netdev/net-next/c/59656519763d - [10/14] net: openvswitch: Annotate struct dp_meter_instance with __counted_by https://git.kernel.org/netdev/net-next/c/e7b34822fa4d - [11/14] net: enetc: Annotate struct enetc_psfp_gate with __counted_by https://git.kernel.org/netdev/net-next/c/93bc6ab6b19d - [12/14] net: openvswitch: Annotate struct dp_meter with __counted_by https://git.kernel.org/netdev/net-next/c/16ae53d80c00 - [13/14] net: tulip: Annotate struct mediatable with __counted_by https://git.kernel.org/netdev/net-next/c/0d01cfe5aaaf
- [14/14] net: sched: Annotate struct tc_pedit with __counted_by (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html