* [PATCH net] netdevsim: Fix hwstats debugfs file permissions
@ 2022-09-09 15:38 Ido Schimmel
2022-09-12 8:57 ` Petr Machata
2022-09-20 1:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ido Schimmel @ 2022-09-09 15:38 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, pabeni, edumazet, petrm, jie2x.zhou, mlxsw,
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
cat: /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex: Invalid argument
Fixes: 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats")
Reported-by: Jie2x Zhou <jie2x.zhou@intel.com>
Tested-by: Jie2x Zhou <jie2x.zhou@intel.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
drivers/net/netdevsim/hwstats.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/netdevsim/hwstats.c b/drivers/net/netdevsim/hwstats.c
index 605a38e16db0..0e58aa7f0374 100644
--- a/drivers/net/netdevsim/hwstats.c
+++ b/drivers/net/netdevsim/hwstats.c
@@ -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,
--
2.37.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] netdevsim: Fix hwstats debugfs file permissions
2022-09-09 15:38 [PATCH net] netdevsim: Fix hwstats debugfs file permissions Ido Schimmel
@ 2022-09-12 8:57 ` Petr Machata
2022-09-20 1:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Petr Machata @ 2022-09-12 8:57 UTC (permalink / raw)
To: Ido Schimmel
Cc: netdev, davem, kuba, pabeni, edumazet, petrm, jie2x.zhou, mlxsw
Ido Schimmel <idosch@nvidia.com> writes:
> 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
>
> Fixes: 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats")
> Reported-by: Jie2x Zhou <jie2x.zhou@intel.com>
> Tested-by: Jie2x Zhou <jie2x.zhou@intel.com>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] netdevsim: Fix hwstats debugfs file permissions
2022-09-09 15:38 [PATCH net] netdevsim: Fix hwstats debugfs file permissions Ido Schimmel
2022-09-12 8:57 ` Petr Machata
@ 2022-09-20 1:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-20 1:00 UTC (permalink / raw)
To: Ido Schimmel
Cc: netdev, davem, kuba, pabeni, edumazet, petrm, jie2x.zhou, mlxsw
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
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
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-20 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09 15:38 [PATCH net] netdevsim: Fix hwstats debugfs file permissions Ido Schimmel
2022-09-12 8:57 ` Petr Machata
2022-09-20 1:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).