* [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr
@ 2024-11-05 4:13 Li Wang
2024-11-05 4:13 ` [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size Li Wang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Li Wang @ 2024-11-05 4:13 UTC (permalink / raw)
To: ltp
Mainline kernel commit 21d52e295 ("landlock: Add abstract UNIX socket scoping")
introduces a new "scoped" member to the struct landlock_ruleset_attr.
Signed-off-by: Li Wang <liwang@redhat.com>
---
include/lapi/landlock.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/lapi/landlock.h b/include/lapi/landlock.h
index 211d171eb..5fb6d3755 100644
--- a/include/lapi/landlock.h
+++ b/include/lapi/landlock.h
@@ -19,6 +19,7 @@ struct landlock_ruleset_attr
{
uint64_t handled_access_fs;
uint64_t handled_access_net;
+ uint64_t scoped;
};
#endif
--
2.47.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size
2024-11-05 4:13 [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Li Wang
@ 2024-11-05 4:13 ` Li Wang
2024-11-05 10:43 ` Wei Gao via ltp
2024-11-05 10:43 ` [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Wei Gao via ltp
2024-11-05 11:20 ` Andrea Cervesato via ltp
2 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2024-11-05 4:13 UTC (permalink / raw)
To: ltp
The landlock01 test is failing on kernel v6.12-rc6 with the
following error:
landlock01.c:49: TFAIL: Size is too small expected EINVAL: ENOMSG (42)
Previously, rule_small_size was calculated conditionally based
on the presence of the handled_access_net field in the struct
landlock_ruleset_attr.
However, the kernel's landlock_create_ruleset() function still uses
the size up to handled_access_fs to determine the minimal acceptable
size for backward compatibility, regardless of any new fields added.
According to the Landlock maintainer[1], this behavior will remain
for backward compatibility reasons. Therefore, it's unnecessary to
conditionally adjust rule_small_size based on new fields.
This patch simplifies the test by setting rule_small_size to
'sizeof(__u64) - 1', which effectively tests the minimal size based
on handled_access_fs.
[1] https://lists.linux.it/pipermail/ltp/2024-July/039084.html
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/syscalls/landlock/landlock01.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/landlock/landlock01.c b/testcases/kernel/syscalls/landlock/landlock01.c
index 083685c64..c375e5154 100644
--- a/testcases/kernel/syscalls/landlock/landlock01.c
+++ b/testcases/kernel/syscalls/landlock/landlock01.c
@@ -62,11 +62,17 @@ static void setup(void)
rule_size = sizeof(struct landlock_ruleset_attr);
-#ifdef HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET
- rule_small_size = rule_size - sizeof(uint64_t) - 1;
-#else
- rule_small_size = rule_size - 1;
-#endif
+ /*
+ * Kernel introduces two new fields 'handled_access_net' and 'scoped'
+ * in the structure 'landlock_ruleset_attr'. However, in the function
+ * 'landlock_create_ruleset()', it still uses the first field
+ * 'handled_access_fs' to calculate the minimal size for backward
+ * compatibility reason.
+ *
+ * Therefore, here test 'sizeof(__u64) - 1' is sufficient to determine
+ * the minimum size for 'rule_small_size'.
+ */
+ rule_small_size = sizeof(__u64) - 1;
rule_big_size = SAFE_SYSCONF(_SC_PAGESIZE) + 1;
}
--
2.47.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size
2024-11-05 4:13 ` [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size Li Wang
@ 2024-11-05 10:43 ` Wei Gao via ltp
2024-11-05 12:00 ` Li Wang
0 siblings, 1 reply; 6+ messages in thread
From: Wei Gao via ltp @ 2024-11-05 10:43 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
On Tue, Nov 05, 2024 at 12:13:25PM +0800, Li Wang wrote:
> The landlock01 test is failing on kernel v6.12-rc6 with the
> following error:
>
> landlock01.c:49: TFAIL: Size is too small expected EINVAL: ENOMSG (42)
>
> Previously, rule_small_size was calculated conditionally based
> on the presence of the handled_access_net field in the struct
> landlock_ruleset_attr.
>
> However, the kernel's landlock_create_ruleset() function still uses
> the size up to handled_access_fs to determine the minimal acceptable
> size for backward compatibility, regardless of any new fields added.
>
> According to the Landlock maintainer[1], this behavior will remain
> for backward compatibility reasons. Therefore, it's unnecessary to
> conditionally adjust rule_small_size based on new fields.
>
> This patch simplifies the test by setting rule_small_size to
> 'sizeof(__u64) - 1', which effectively tests the minimal size based
> on handled_access_fs.
>
> [1] https://lists.linux.it/pipermail/ltp/2024-July/039084.html
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> testcases/kernel/syscalls/landlock/landlock01.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/landlock/landlock01.c b/testcases/kernel/syscalls/landlock/landlock01.c
> index 083685c64..c375e5154 100644
> --- a/testcases/kernel/syscalls/landlock/landlock01.c
> +++ b/testcases/kernel/syscalls/landlock/landlock01.c
> @@ -62,11 +62,17 @@ static void setup(void)
>
> rule_size = sizeof(struct landlock_ruleset_attr);
>
> -#ifdef HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET
> - rule_small_size = rule_size - sizeof(uint64_t) - 1;
> -#else
> - rule_small_size = rule_size - 1;
> -#endif
Since we do not need HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET anymore, so i suppose we can remove
following change in configure.ac?
AC_CHECK_MEMBERS([struct landlock_ruleset_attr.handled_access_net],,,[#include <linux/landlock.h>])
> + /*
> + * Kernel introduces two new fields 'handled_access_net' and 'scoped'
> + * in the structure 'landlock_ruleset_attr'. However, in the function
> + * 'landlock_create_ruleset()', it still uses the first field
> + * 'handled_access_fs' to calculate the minimal size for backward
> + * compatibility reason.
> + *
> + * Therefore, here test 'sizeof(__u64) - 1' is sufficient to determine
> + * the minimum size for 'rule_small_size'.
> + */
> + rule_small_size = sizeof(__u64) - 1;
>
> rule_big_size = SAFE_SYSCONF(_SC_PAGESIZE) + 1;
> }
> --
> 2.47.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr
2024-11-05 4:13 [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Li Wang
2024-11-05 4:13 ` [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size Li Wang
@ 2024-11-05 10:43 ` Wei Gao via ltp
2024-11-05 11:20 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 6+ messages in thread
From: Wei Gao via ltp @ 2024-11-05 10:43 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
On Tue, Nov 05, 2024 at 12:13:24PM +0800, Li Wang wrote:
> Mainline kernel commit 21d52e295 ("landlock: Add abstract UNIX socket scoping")
> introduces a new "scoped" member to the struct landlock_ruleset_attr.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> include/lapi/landlock.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/lapi/landlock.h b/include/lapi/landlock.h
> index 211d171eb..5fb6d3755 100644
> --- a/include/lapi/landlock.h
> +++ b/include/lapi/landlock.h
> @@ -19,6 +19,7 @@ struct landlock_ruleset_attr
> {
> uint64_t handled_access_fs;
> uint64_t handled_access_net;
> + uint64_t scoped;
> };
> #endif
Reviewed-by: Wei Gao <wegao@suse.com>
>
> --
> 2.47.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr
2024-11-05 4:13 [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Li Wang
2024-11-05 4:13 ` [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size Li Wang
2024-11-05 10:43 ` [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Wei Gao via ltp
@ 2024-11-05 11:20 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2024-11-05 11:20 UTC (permalink / raw)
To: ltp
Hi Li,
please check my latest landlock network v2 testing suite, because the
paradigm will change due to incompatibility between ABI v1 and v4 of
landlock implementation. We need to simplify the way we fallback
landlock_ruleset_attr.
Andrea
On 11/5/24 05:13, Li Wang wrote:
> Mainline kernel commit 21d52e295 ("landlock: Add abstract UNIX socket scoping")
> introduces a new "scoped" member to the struct landlock_ruleset_attr.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> include/lapi/landlock.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/lapi/landlock.h b/include/lapi/landlock.h
> index 211d171eb..5fb6d3755 100644
> --- a/include/lapi/landlock.h
> +++ b/include/lapi/landlock.h
> @@ -19,6 +19,7 @@ struct landlock_ruleset_attr
> {
> uint64_t handled_access_fs;
> uint64_t handled_access_net;
> + uint64_t scoped;
> };
> #endif
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size
2024-11-05 10:43 ` Wei Gao via ltp
@ 2024-11-05 12:00 ` Li Wang
0 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2024-11-05 12:00 UTC (permalink / raw)
To: Wei Gao; +Cc: ltp
On Tue, Nov 5, 2024 at 6:43 PM Wei Gao <wegao@suse.com> wrote:
> On Tue, Nov 05, 2024 at 12:13:25PM +0800, Li Wang wrote:
> > The landlock01 test is failing on kernel v6.12-rc6 with the
> > following error:
> >
> > landlock01.c:49: TFAIL: Size is too small expected EINVAL: ENOMSG (42)
> >
> > Previously, rule_small_size was calculated conditionally based
> > on the presence of the handled_access_net field in the struct
> > landlock_ruleset_attr.
> >
> > However, the kernel's landlock_create_ruleset() function still uses
> > the size up to handled_access_fs to determine the minimal acceptable
> > size for backward compatibility, regardless of any new fields added.
> >
> > According to the Landlock maintainer[1], this behavior will remain
> > for backward compatibility reasons. Therefore, it's unnecessary to
> > conditionally adjust rule_small_size based on new fields.
> >
> > This patch simplifies the test by setting rule_small_size to
> > 'sizeof(__u64) - 1', which effectively tests the minimal size based
> > on handled_access_fs.
> >
> > [1] https://lists.linux.it/pipermail/ltp/2024-July/039084.html
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> > testcases/kernel/syscalls/landlock/landlock01.c | 16 +++++++++++-----
> > 1 file changed, 11 insertions(+), 5 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/landlock/landlock01.c
> b/testcases/kernel/syscalls/landlock/landlock01.c
> > index 083685c64..c375e5154 100644
> > --- a/testcases/kernel/syscalls/landlock/landlock01.c
> > +++ b/testcases/kernel/syscalls/landlock/landlock01.c
> > @@ -62,11 +62,17 @@ static void setup(void)
> >
> > rule_size = sizeof(struct landlock_ruleset_attr);
> >
> > -#ifdef HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET
> > - rule_small_size = rule_size - sizeof(uint64_t) - 1;
> > -#else
> > - rule_small_size = rule_size - 1;
> > -#endif
> Since we do not need HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET
> anymore, so i suppose we can remove
> following change in configure.ac?
>
Theirecally that's correct, but I see Andrea achieving V2 patchset for
landlock.
Let's not delete the macro yet but check which method works first.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-05 12:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05 4:13 [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Li Wang
2024-11-05 4:13 ` [LTP] [PATCH 2/2] landlock01: used fixed size for rule_small_size Li Wang
2024-11-05 10:43 ` Wei Gao via ltp
2024-11-05 12:00 ` Li Wang
2024-11-05 10:43 ` [LTP] [PATCH 1/2] lapi: Add new field socket scoping to landlock_ruleset_attr Wei Gao via ltp
2024-11-05 11:20 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox