From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it, "Avinesh Kumar" <akumar@suse.de>,
"Mickaël Salaün" <mic@digikod.net>,
"Günther Noack" <gnoack@google.com>,
linux-security-module@vger.kernel.org
Subject: Re: [LTP] [PATCH v4 7/7] Add lsm_set_self_attr01 test
Date: Thu, 5 Jun 2025 10:13:09 +0200 [thread overview]
Message-ID: <20250605081309.GD1190804@pevik> (raw)
In-Reply-To: <20250429-lsm-v4-7-602b7097e722@suse.com>
Hi Andrea, all,
> Verify that lsm_set_self_attr syscall is raising errors when invalid
> data is provided.
...
> diff --git a/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c b/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..caccdda7ecf2edaac1fa8e2dc2ccdd0aff020804
> --- /dev/null
> +++ b/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c
> @@ -0,0 +1,110 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * Verify that lsm_set_self_attr syscall is raising errors when invalid data is
> + * provided.
> + */
> +
> +#include "lsm_common.h"
> +
> +static struct lsm_ctx *ctx;
> +static struct lsm_ctx *ctx_orig;
> +static struct lsm_ctx *ctx_null;
> +static uint32_t ctx_size;
> +static uint32_t ctx_size_small;
> +static uint32_t ctx_size_big;
> +static uint32_t page_size;
> +
> +static struct tcase {
> + uint32_t attr;
> + struct lsm_ctx **ctx;
> + uint32_t *size;
> + uint32_t flags;
> + int exp_errno;
> + char *msg;
> +} tcases[] = {
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx_null,
> + .size = &ctx_size,
> + .exp_errno = EFAULT,
> + .msg = "ctx is NULL",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size_small,
> + .exp_errno = EINVAL,
> + .msg = "size is too small",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size_big,
> + .exp_errno = E2BIG,
> + .msg = "size is too big",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size,
> + .flags = 1,
> + .exp_errno = EINVAL,
> + .msg = "flags must be zero",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT | LSM_ATTR_EXEC,
> + .ctx = &ctx,
> + .size = &ctx_size,
> + .exp_errno = EINVAL,
> + .msg = "attr is overset",
FYI The test fails on this check on current Tumbleweed with new
6.15.0-1-default. It worked on 6.14.
Looking at 6.15 landlock related changes (added Landlock audit support and
Landlock signal scope fixes) test might needs to be updated.
https://kernelnewbies.org/Linux_6.15#Security
@Andrea could you please have a look?
Kind regards,
Petr
WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: "Mickaël Salaün" <mic@digikod.net>,
"Günther Noack" <gnoack@google.com>,
linux-security-module@vger.kernel.org, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 7/7] Add lsm_set_self_attr01 test
Date: Thu, 5 Jun 2025 10:13:09 +0200 [thread overview]
Message-ID: <20250605081309.GD1190804@pevik> (raw)
In-Reply-To: <20250429-lsm-v4-7-602b7097e722@suse.com>
Hi Andrea, all,
> Verify that lsm_set_self_attr syscall is raising errors when invalid
> data is provided.
...
> diff --git a/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c b/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..caccdda7ecf2edaac1fa8e2dc2ccdd0aff020804
> --- /dev/null
> +++ b/testcases/kernel/syscalls/lsm/lsm_set_self_attr01.c
> @@ -0,0 +1,110 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * Verify that lsm_set_self_attr syscall is raising errors when invalid data is
> + * provided.
> + */
> +
> +#include "lsm_common.h"
> +
> +static struct lsm_ctx *ctx;
> +static struct lsm_ctx *ctx_orig;
> +static struct lsm_ctx *ctx_null;
> +static uint32_t ctx_size;
> +static uint32_t ctx_size_small;
> +static uint32_t ctx_size_big;
> +static uint32_t page_size;
> +
> +static struct tcase {
> + uint32_t attr;
> + struct lsm_ctx **ctx;
> + uint32_t *size;
> + uint32_t flags;
> + int exp_errno;
> + char *msg;
> +} tcases[] = {
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx_null,
> + .size = &ctx_size,
> + .exp_errno = EFAULT,
> + .msg = "ctx is NULL",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size_small,
> + .exp_errno = EINVAL,
> + .msg = "size is too small",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size_big,
> + .exp_errno = E2BIG,
> + .msg = "size is too big",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT,
> + .ctx = &ctx,
> + .size = &ctx_size,
> + .flags = 1,
> + .exp_errno = EINVAL,
> + .msg = "flags must be zero",
> + },
> + {
> + .attr = LSM_ATTR_CURRENT | LSM_ATTR_EXEC,
> + .ctx = &ctx,
> + .size = &ctx_size,
> + .exp_errno = EINVAL,
> + .msg = "attr is overset",
FYI The test fails on this check on current Tumbleweed with new
6.15.0-1-default. It worked on 6.14.
Looking at 6.15 landlock related changes (added Landlock audit support and
Landlock signal scope fixes) test might needs to be updated.
https://kernelnewbies.org/Linux_6.15#Security
@Andrea could you please have a look?
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-06-05 8:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 7:18 [LTP] [PATCH v4 0/7] LSM testing suite Andrea Cervesato
2025-04-29 7:18 ` [LTP] [PATCH v4 1/7] Add fallback definitions of LSM syscalls Andrea Cervesato
2025-06-02 12:05 ` Cyril Hrubis
2025-04-29 7:18 ` [LTP] [PATCH v4 2/7] Add lsm_get_self_attr01 test Andrea Cervesato
2025-04-29 7:18 ` [LTP] [PATCH v4 3/7] Add lsm_get_self_attr02 test Andrea Cervesato
2025-06-02 12:16 ` Cyril Hrubis
2025-04-29 7:18 ` [LTP] [PATCH v4 4/7] Add lsm_get_self_attr03 test Andrea Cervesato
2025-06-02 12:46 ` Cyril Hrubis
2025-06-02 13:18 ` Andrea Cervesato via ltp
2025-06-02 14:38 ` Cyril Hrubis
2025-06-02 16:35 ` Andrea Cervesato via ltp
2025-04-29 7:18 ` [LTP] [PATCH v4 5/7] Add lsm_list_modules01 test Andrea Cervesato
2025-04-29 7:18 ` [LTP] [PATCH v4 6/7] Add lsm_list_modules02 test Andrea Cervesato
2025-06-02 14:59 ` Cyril Hrubis
2025-04-29 7:18 ` [LTP] [PATCH v4 7/7] Add lsm_set_self_attr01 test Andrea Cervesato
2025-06-02 15:17 ` Cyril Hrubis
2025-06-05 8:13 ` Petr Vorel [this message]
2025-06-05 8:13 ` Petr Vorel
2025-06-05 8:18 ` Petr Vorel
2025-06-05 8:18 ` Petr Vorel
2025-06-05 8:25 ` Andrea Cervesato
2025-06-05 8:25 ` Andrea Cervesato via ltp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250605081309.GD1190804@pevik \
--to=pvorel@suse.cz \
--cc=akumar@suse.de \
--cc=andrea.cervesato@suse.de \
--cc=gnoack@google.com \
--cc=linux-security-module@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=mic@digikod.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.