Re: [PATCH v2] Documentation: KUnit: Update filename best practices

2024-07-20 Thread Kees Cook
On Sat, Jul 20, 2024 at 10:59:10AM -0700, John Hubbard wrote: > On 7/20/24 9:54 AM, Kees Cook wrote: > > Based on feedback from Linus[1] and follow-up discussions, change the > > suggested file naming for KUnit tests. > > > > Link: > > https://lore.kernel.org/lkml/CAHk-=wgim6pNiGTBMhP8Kd3tsB7_JTA

[PATCH] lib: Move KUnit tests into tests/ subdirectory

2024-07-20 Thread Kees Cook
Following from the recent KUnit file naming discussion[1], move all KUnit tests in lib/ into lib/tests/. Link: https://lore.kernel.org/lkml/20240720165441.it.320-k...@kernel.org/ [1] Signed-off-by: Kees Cook --- I can carry this in the hardening tree. To disrupt people as little as possible, I'm

Re: [PATCH v2] Documentation: KUnit: Update filename best practices

2024-07-20 Thread John Hubbard
On 7/20/24 9:54 AM, Kees Cook wrote: Based on feedback from Linus[1] and follow-up discussions, change the suggested file naming for KUnit tests. Link: https://lore.kernel.org/lkml/CAHk-=wgim6pNiGTBMhP8Kd3tsB7_JTAuvNJ=XYd3wPvvk=o...@mail.gmail.com/ [1] Signed-off-by: Kees Cook --- Cc: David G

[PATCH v2] Documentation: KUnit: Update filename best practices

2024-07-20 Thread Kees Cook
Based on feedback from Linus[1] and follow-up discussions, change the suggested file naming for KUnit tests. Link: https://lore.kernel.org/lkml/CAHk-=wgim6pNiGTBMhP8Kd3tsB7_JTAuvNJ=XYd3wPvvk=o...@mail.gmail.com/ [1] Signed-off-by: Kees Cook --- Cc: David Gow Cc: Brendan Higgins Cc: Rae Moar

[PATCH bpf-next 4/4] selftests/bpf: Drop __start_server in network_helpers

2024-07-20 Thread Geliang Tang
From: Geliang Tang The helper start_server_addr() is a wrapper of __start_server(), the only difference between them is __start_server() accepts a sockaddr type address parameter, but start_server_addr() accepts a sockaddr_storage one. This patch drops __start_server(), and updates the callers t

[PATCH bpf-next 1/4] selftests/bpf: Drop make_client in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_to_addr_str() in sk_lookup.c to create the client socket and connect to the server, instead of using local defined function make_client(). This local function can be dropped then. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_t

[PATCH bpf-next 3/4] selftests/bpf: Drop inetaddr_len in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang No need to use a dedicated helper inetaddr_len() to get the length of the IPv4 or IPv6 address, it can be got by make_sockaddr(), this patch drops it. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 21 --- 1 file changed, 9 in

[PATCH bpf-next 2/4] selftests/bpf: Drop make_socket in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang This patch uses the public network helers client_socket() + make_sockaddr() in sk_lookup.c to create the client socket, set the timeout sockopts, and make the connecting address. The local defined function make_socket() can be dropped then. Signed-off-by: Geliang Tang --- ..

[PATCH bpf-next 0/4] use network helpers, part 10

2024-07-20 Thread Geliang Tang
From: Geliang Tang This set is part 10 of series "use network helpers" all BPF selftests wide. Patches 1-3 drop local functions make_client(), make_socket() and inetaddr_len() in sk_lookup.c. Patch 4 drops a useless function __start_server() in network_helpers.c. Geliang Tang (4): selftests/b

Re: [PATCH v4 7/20] lsm: Refactor return value of LSM hook setprocattr

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook setprocattr to 0 or a negative error code. Before: - Hook setprocattr returns the number of bytes written on success or a negative error code on

Re: [PATCH v4 10/20] lsm: Refactor return value of LSM hook audit_rule_match

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook audit_rule_match to 0 or a negative error code. Before: - Hook audit_rule_match returns 1 if the rule matches, 0 if it not, and negative error co

Re: [PATCH v4 9/20] lsm: Refactor return value of LSM hook key_getsecurity

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook key_getsecurity to 0 or a negative error code. Before: - Hook key_getsecurity returns length of value on success or a negative error code on fail

Re: [PATCH v4 8/20] lsm: Refactor return value of LSM hook getprocattr

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook getprocattr to 0 or a negative error code. Before: - Hook getprocattr returns length of value on success or a negative error code on failure. Af

Re: [PATCH v4 6/20] lsm: Refactor return value of LSM hook getselfattr

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook getselfattr to 0 or a negative error code. Before: - Hook getselfattr returns number of attributes found on success or a negative error code on f

Re: [PATCH v4 5/20] lsm: Refactor return value of LSM hook inode_copy_up_xattr

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook inode_copy_up_xattr to 0 or a negative error code. Before: - Hook inode_copy_up_xattr returns 0 when accepting xattr, 1 when discarding xattr, -E

Re: [PATCH v4 4/20] lsm: Refactor return value of LSM hook inode_listsecurity

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook inode_listsecurity to 0 or a negative error code. Before: - Hook inode_listsecurity returns number of bytes used/required on success or a negativ

Re: [PATCH v4 3/20] lsm: Refactor return value of LSM hook inode_getsecurity

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook inode_getsecurity to 0 or a negative error code. Before: - Hook inode_getsecurity returns size of buffer on success or a negative error code on f

Re: [PATCH v4 2/20] lsm: Refactor return value of LSM hook inode_need_killpriv

2024-07-20 Thread Xu Kuohai
On 7/19/2024 10:08 AM, Paul Moore wrote: On Jul 11, 2024 Xu Kuohai wrote: To be consistent with most LSM hooks, convert the return value of hook inode_need_killpriv to 0 or a negative error code. Before: - Both hook inode_need_killpriv and func security_inode_need_killpriv return > 0 if se