lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vabulcn5q5hm4qhiol75cwuztq4wijcjkiw4oy4wjckaybbq5m@54xt4qxhwnls>
Date: Tue, 22 Jul 2025 11:22:08 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Tariq Toukan <tariqt@...dia.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Donald Hunter <donald.hunter@...il.com>, 
	Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, Mark Bloch <mbloch@...dia.com>, Jiri Pirko <jiri@...dia.com>, 
	Cosmin Ratiu <cratiu@...dia.com>, Gal Pressman <gal@...dia.com>, 
	Carolina Jubran <cjubran@...dia.com>
Subject: Re: [PATCH net-next] devlink: Fix excessive stack usage in rate TC
 bandwidth parsing

Tue, Jul 22, 2025 at 11:13:29AM +0200, tariqt@...dia.com wrote:
>From: Carolina Jubran <cjubran@...dia.com>
>
>The devlink_nl_rate_tc_bw_parse function uses a large stack array for
>devlink attributes, which triggers a warning about excessive stack
>usage:
>
>net/devlink/rate.c: In function 'devlink_nl_rate_tc_bw_parse':
>net/devlink/rate.c:382:1: error: the frame size of 1648 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>
>Introduce a separate attribute set specifically for rate TC bandwidth
>parsing that only contains the two attributes actually used: index
>and bandwidth. This reduces the stack array from DEVLINK_ATTR_MAX
>entries to just 2 entries, solving the stack usage issue.
>
>Update devlink selftest to use the new 'index' and 'bw' attribute names
>consistent with the YAML spec.
>
>Example usage with ynl with the new spec:
>
>    ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
>      --do rate-set --json '{
>      "bus-name": "pci",
>      "dev-name": "0000:08:00.0",
>      "port-index": 1,
>      "rate-tc-bws": [
>        {"index": 0, "bw": 50},
>        {"index": 1, "bw": 50},
>        {"index": 2, "bw": 0},
>        {"index": 3, "bw": 0},
>        {"index": 4, "bw": 0},
>        {"index": 5, "bw": 0},
>        {"index": 6, "bw": 0},
>        {"index": 7, "bw": 0}
>      ]
>    }'
>
>    ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
>      --do rate-get --json '{
>      "bus-name": "pci",
>      "dev-name": "0000:08:00.0",
>      "port-index": 1
>    }'
>
>    output for rate-get:
>    {'bus-name': 'pci',
>     'dev-name': '0000:08:00.0',
>     'port-index': 1,
>     'rate-tc-bws': [{'bw': 50, 'index': 0},
>                     {'bw': 50, 'index': 1},
>                     {'bw': 0, 'index': 2},
>                     {'bw': 0, 'index': 3},
>                     {'bw': 0, 'index': 4},
>                     {'bw': 0, 'index': 5},
>                     {'bw': 0, 'index': 6},
>                     {'bw': 0, 'index': 7}],
>     'rate-tx-max': 0,
>     'rate-tx-priority': 0,
>     'rate-tx-share': 0,
>     'rate-tx-weight': 0,
>     'rate-type': 'leaf'}
>
>Fixes: 566e8f108fc7 ("devlink: Extend devlink rate API with traffic classes bandwidth management")
>Reported-by: Arnd Bergmann <arnd@...db.de>
>Closes: https://lore.kernel.org/netdev/20250708160652.1810573-1-arnd@kernel.org/
>Reported-by: kernel test robot <lkp@...el.com>
>Closes: https://lore.kernel.org/oe-kbuild-all/202507171943.W7DJcs6Y-lkp@intel.com/
>Suggested-by: Jakub Kicinski <kuba@...nel.org>
>Signed-off-by: Jakub Kicinski <kuba@...nel.org>
>Signed-off-by: Carolina Jubran <cjubran@...dia.com>
>Tested-by: Carolina Jubran <cjubran@...dia.com>
>Signed-off-by: Tariq Toukan <tariqt@...dia.com>

Reviewed-by: Jiri Pirko <jiri@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ