1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/intel/iavf
Jakub Kicinski 74f9d556f9 Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says:

====================
virtchnl: fix fake 1-elem arrays

Alexander Lobakin says:

6.5-rc1 started spitting warning splats when composing virtchnl
messages, precisely on virtchnl_rss_key and virtchnl_lut:

[   84.167709] memcpy: detected field-spanning write (size 52) of single
field "vrk->key" at drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1095
(size 1)
[   84.169915] WARNING: CPU: 3 PID: 11 at drivers/net/ethernet/intel/
iavf/iavf_virtchnl.c:1095 iavf_set_rss_key+0x123/0x140 [iavf]
...
[   84.191982] Call Trace:
[   84.192439]  <TASK>
[   84.192900]  ? __warn+0xc9/0x1a0
[   84.193353]  ? iavf_set_rss_key+0x123/0x140 [iavf]
[   84.193818]  ? report_bug+0x12c/0x1b0
[   84.194266]  ? handle_bug+0x42/0x70
[   84.194714]  ? exc_invalid_op+0x1a/0x50
[   84.195149]  ? asm_exc_invalid_op+0x1a/0x20
[   84.195592]  ? iavf_set_rss_key+0x123/0x140 [iavf]
[   84.196033]  iavf_watchdog_task+0xb0c/0xe00 [iavf]
...
[   84.225476] memcpy: detected field-spanning write (size 64) of single
field "vrl->lut" at drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1127
(size 1)
[   84.227190] WARNING: CPU: 27 PID: 1044 at drivers/net/ethernet/intel/
iavf/iavf_virtchnl.c:1127 iavf_set_rss_lut+0x123/0x140 [iavf]
...
[   84.246601] Call Trace:
[   84.247228]  <TASK>
[   84.247840]  ? __warn+0xc9/0x1a0
[   84.248263]  ? iavf_set_rss_lut+0x123/0x140 [iavf]
[   84.248698]  ? report_bug+0x12c/0x1b0
[   84.249122]  ? handle_bug+0x42/0x70
[   84.249549]  ? exc_invalid_op+0x1a/0x50
[   84.249970]  ? asm_exc_invalid_op+0x1a/0x20
[   84.250390]  ? iavf_set_rss_lut+0x123/0x140 [iavf]
[   84.250820]  iavf_watchdog_task+0xb16/0xe00 [iavf]

Gustavo already tried to fix those back in 2021[0][1]. Unfortunately,
a VM can run a different kernel than the host, meaning that those
structures are sorta ABI.
However, it is possible to have proper flex arrays + struct_size()
calculations and still send the very same messages with the same sizes.
The common rule is:

elem[1] -> elem[]
size = struct_size() + <difference between the old and the new msg size>

The "old" size in the current code is calculated 3 different ways for
10 virtchnl structures total. Each commit addresses one of the ways
cumulatively instead of per-structure.

I was planning to send it to -net initially, but given that virtchnl was
renamed from i40evf and got some fat style cleanup commits in the past,
it's not very straightforward to even pick appropriate SHAs, not
speaking of automatic portability. I may send manual backports for
a couple of the latest supported kernels later on if anyone needs it
at all.

[0] https://lore.kernel.org/all/20210525230912.GA175802@embeddedor
[1] https://lore.kernel.org/all/20210525231851.GA176647@embeddedor

* '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  virtchnl: fix fake 1-elem arrays for structures allocated as `nents`
  virtchnl: fix fake 1-elem arrays in structures allocated as `nents + 1`
  virtchnl: fix fake 1-elem arrays in structs allocated as `nents + 1` - 1
====================

Link: https://lore.kernel.org/r/20230816210657.1326772-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-08-18 15:22:05 -07:00
..
iavf.h virtchnl: fix fake 1-elem arrays in structures allocated as nents + 1 2023-08-16 09:05:04 -07:00
iavf_adminq.c iavf: Fix adminq error handling 2022-08-12 08:22:55 -07:00
iavf_adminq.h intel-ethernet: clean up W=1 warnings in kdoc 2020-09-25 16:28:59 -07:00
iavf_adminq_cmd.h iavf: replace i40e variables with iavf 2019-05-31 01:02:53 -07:00
iavf_adv_rss.c iavf: Support for modifying SCTP RSS flow hashing 2021-04-22 09:26:23 -07:00
iavf_adv_rss.h iavf: Support for modifying SCTP RSS flow hashing 2021-04-22 09:26:23 -07:00
iavf_alloc.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_client.c virtchnl: fix fake 1-elem arrays for structures allocated as nents 2023-08-16 09:14:14 -07:00
iavf_client.h virtchnl: fix fake 1-elem arrays for structures allocated as nents 2023-08-16 09:14:14 -07:00
iavf_common.c iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_devids.h
iavf_ethtool.c iavf: fix FDIR rule fields masks validation 2023-08-16 08:27:29 -07:00
iavf_fdir.c iavf: fix FDIR rule fields masks validation 2023-08-16 08:27:29 -07:00
iavf_fdir.h iavf: fix FDIR rule fields masks validation 2023-08-16 08:27:29 -07:00
iavf_main.c net: flow_dissector: Use 64bits for used_keys 2023-07-31 09:11:24 +01:00
iavf_osdep.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_prototype.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_register.h iavf: remove mask from iavf_irq_enable_queues() 2023-06-10 00:09:54 -07:00
iavf_status.h virtchnl: i40e/iavf: rename iwarp to rdma 2023-01-25 08:55:19 -08:00
iavf_trace.h intel-ethernet: clean up W=1 warnings in kdoc 2020-09-25 16:28:59 -07:00
iavf_txrx.c iavf: make functions static where possible 2023-06-22 09:27:08 -07:00
iavf_txrx.h iavf: make functions static where possible 2023-06-22 09:27:08 -07:00
iavf_type.h iavf: clean up packet type lookup table 2021-06-18 09:04:44 -07:00
iavf_virtchnl.c virtchnl: fix fake 1-elem arrays for structures allocated as nents 2023-08-16 09:14:14 -07:00
Makefile iavf: Support for modifying TCP RSS flow hashing 2021-04-22 09:26:23 -07:00