netdevsim: Fix hwstats debugfs file permissions
Subsystems (3)
PATCH 1/1 netdevsim: Fix hwstats debugfs file permissions
The hwstats debugfs files are only writeable, but they are created with read and write permissions, causing certain selftests to fail [1].
Fix by creating the files with write permission only.
[1]
# ./test_offload.py
Test destruction of generic XDP...
Traceback (most recent call last):
File "/home/idosch/code/linux/tools/testing/selftests/bpf/./test_offload.py", line 810, in <module>
simdev = NetdevSimDev()
[...]
Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex cat: /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex: Invalid argument
--- drivers/net/netdevsim/hwstats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/netdevsim/hwstats.c +3 -3
@@ -433,11 +433,11 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev) goto err_remove_hwstats_recursive; } -debugfs_create_file ("enable_ifindex" ,0600 , hwstats->l3_ddir, hwstats, +debugfs_create_file ("enable_ifindex" ,0200 , hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_enable_fops.fops); -debugfs_create_file ("disable_ifindex" ,0600 , hwstats->l3_ddir, hwstats, +debugfs_create_file ("disable_ifindex" ,0200 , hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_disable_fops.fops); -debugfs_create_file ("fail_next_enable" ,0600 , hwstats->l3_ddir, hwstats, +debugfs_create_file ("fail_next_enable" ,0200 , hwstats->l3_ddir, hwstats, &nsim_dev_hwstats_l3_fail_fops.fops); INIT_DELAYED_WORK(&hwstats->traffic_dw,
Signature · 1 line
2.37.1
Quoted 14 lines · Ido Schimmel
The hwstats debugfs files are only writeable, but they are created with read and write permissions, causing certain selftests to fail [1].
Fix by creating the files with write permission only.
[1]
# ./test_offload.py Test destruction of generic XDP... Traceback (most recent call last): File "/home/idosch/code/linux/tools/testing/selftests/bpf/./test_offload.py", line 810, in <module> simdev = NetdevSimDev() [...] Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex
Quoted 6 lines
cat:
/sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex: Invalid argumentFixes 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats")Reported-by Jie2x Zhou <[email protected]>Tested-by Jie2x Zhou <[email protected]>Signed-off-by Ido Schimmel <[email protected]>
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 14 lines · On Fri, 9 Sep 2022 18:38:30 +0300 you wrote:
The hwstats debugfs files are only writeable, but they are created with read and write permissions, causing certain selftests to fail [1].
Fix by creating the files with write permission only.
[1]
# ./test_offload.py Test destruction of generic XDP... Traceback (most recent call last): File "/home/idosch/code/linux/tools/testing/selftests/bpf/./test_offload.py", line 810, in <module> simdev = NetdevSimDev() [...] Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex
Quoted 1 line
[...]
Here is the summary with links:
- [net] netdevsim: Fix hwstats debugfs file permissions
https://git.kernel.org/netdev/net/c/34513ada53eb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html