linux-stable/net/bridge/netfilter
GONG, Ruiqi a7ed3465da netfilter: ebtables: fix fortify warnings in size_entry_mwt()
When compiling with gcc 13 and CONFIG_FORTIFY_SOURCE=y, the following
warning appears:

In function ‘fortify_memcpy_chk’,
    inlined from ‘size_entry_mwt’ at net/bridge/netfilter/ebtables.c:2118:2:
./include/linux/fortify-string.h:592:25: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Werror=attribute-warning]
  592 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The compiler is complaining:

memcpy(&offsets[1], &entry->watchers_offset,
                       sizeof(offsets) - sizeof(offsets[0]));

where memcpy reads beyong &entry->watchers_offset to copy
{watchers,target,next}_offset altogether into offsets[]. Silence the
warning by wrapping these three up via struct_group().

Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
2023-08-22 15:13:20 +02:00
..
Kconfig netfilter: nf_log_bridge: merge with nf_log_syslog 2021-03-31 22:34:05 +02:00
Makefile netfilter: nf_log_bridge: merge with nf_log_syslog 2021-03-31 22:34:05 +02:00
ebt_802_3.c netfilter: inline xt_hashlimit, ebt_802_3 and xt_physdev headers 2019-09-13 12:32:48 +02:00
ebt_among.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_arp.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_arpreply.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_dnat.c netfilter: ebtables: Fixes dropping of small packets in bridge nat 2020-10-20 13:54:53 +02:00
ebt_ip.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_ip6.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_limit.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_log.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_mark.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_mark_m.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_nflog.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_pkttype.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ebt_redirect.c netfilter: ebtables: Fixes dropping of small packets in bridge nat 2020-10-20 13:54:53 +02:00
ebt_snat.c netfilter: ebtables: Fixes dropping of small packets in bridge nat 2020-10-20 13:54:53 +02:00
ebt_stp.c netfilter: ebt_stp: Remove unused macro BPDU_TYPE_TCN 2020-09-08 12:56:38 +02:00
ebt_vlan.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
ebtable_broute.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtable_filter.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtable_nat.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtables.c netfilter: ebtables: fix fortify warnings in size_entry_mwt() 2023-08-22 15:13:20 +02:00
nf_conntrack_bridge.c bridge: use skb_ip_totlen in br netfilter 2023-02-01 20:54:27 -08:00
nft_meta_bridge.c netfilter: bridge: introduce broute meta statement 2023-03-08 14:21:18 +01:00
nft_reject_bridge.c netfilter: nf_tables: do not reduce read-only expressions 2022-03-20 00:29:46 +01:00