From: Andrea Cervesato <andrea.cervesato@suse.com>
To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
Cc: linux-integrity@vger.kernel.org
Subject: Re: [LTP] [PATCH 2/2] ima_selinux.sh: Detect SELinux before loading policy
Date: Mon, 17 Feb 2025 14:26:28 +0100 [thread overview]
Message-ID: <ea6764ea-db92-4f49-ba5a-650f62bcfa23@suse.com> (raw)
In-Reply-To: <20250217130839.2392666-2-pvorel@suse.cz>
Hi!
On 2/17/25 14:08, Petr Vorel wrote:
> Adding TST_SETUP_EARLY to run test specific setup before loading policy.
> That allows to avoid loading IMA policy (which usually request reboot)
> if the test would be skipped anyway.
>
> Fixes: aac97cca96 ("ima_setup.sh: Allow to load predefined policy")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/kernel/security/integrity/ima/tests/ima_selinux.sh | 3 ++-
> testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> index 97c5d64ec5..577f7c2aca 100755
> --- a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> @@ -13,9 +13,10 @@
>
> TST_NEEDS_CMDS="awk cut grep tail"
> TST_CNT=2
> -TST_SETUP="setup"
> TST_MIN_KVER="5.12"
>
> +TST_SETUP_EARLY="setup"
> +
> REQUIRED_POLICY_CONTENT='selinux.policy'
>
> setup()
> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> index 1f1c267c4b..2a9f64978e 100644
> --- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> @@ -265,6 +265,8 @@ ima_setup()
> cd "$TST_MNTPOINT"
> fi
>
> + [ -n "$TST_SETUP_EARLY" ] && $TST_SETUP_EARLY
> +
Why not doing ". ima_setup.sh" at the end of setup() ?
> if ! verify_ima_policy; then
> load_ima_policy
> fi
Andrea
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
Cc: linux-integrity@vger.kernel.org
Subject: Re: [LTP] [PATCH 2/2] ima_selinux.sh: Detect SELinux before loading policy
Date: Mon, 17 Feb 2025 14:26:28 +0100 [thread overview]
Message-ID: <ea6764ea-db92-4f49-ba5a-650f62bcfa23@suse.com> (raw)
In-Reply-To: <20250217130839.2392666-2-pvorel@suse.cz>
Hi!
On 2/17/25 14:08, Petr Vorel wrote:
> Adding TST_SETUP_EARLY to run test specific setup before loading policy.
> That allows to avoid loading IMA policy (which usually request reboot)
> if the test would be skipped anyway.
>
> Fixes: aac97cca96 ("ima_setup.sh: Allow to load predefined policy")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/kernel/security/integrity/ima/tests/ima_selinux.sh | 3 ++-
> testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> index 97c5d64ec5..577f7c2aca 100755
> --- a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
> @@ -13,9 +13,10 @@
>
> TST_NEEDS_CMDS="awk cut grep tail"
> TST_CNT=2
> -TST_SETUP="setup"
> TST_MIN_KVER="5.12"
>
> +TST_SETUP_EARLY="setup"
> +
> REQUIRED_POLICY_CONTENT='selinux.policy'
>
> setup()
> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> index 1f1c267c4b..2a9f64978e 100644
> --- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
> @@ -265,6 +265,8 @@ ima_setup()
> cd "$TST_MNTPOINT"
> fi
>
> + [ -n "$TST_SETUP_EARLY" ] && $TST_SETUP_EARLY
> +
Why not doing ". ima_setup.sh" at the end of setup() ?
> if ! verify_ima_policy; then
> load_ima_policy
> fi
Andrea
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-02-17 13:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 13:08 [PATCH 1/2] tst_security.sh: Fix SELinux detection Petr Vorel
2025-02-17 13:08 ` [LTP] " Petr Vorel
2025-02-17 13:08 ` [PATCH 2/2] ima_selinux.sh: Detect SELinux before loading policy Petr Vorel
2025-02-17 13:08 ` [LTP] " Petr Vorel
2025-02-17 13:26 ` Andrea Cervesato [this message]
2025-02-17 13:26 ` Andrea Cervesato via ltp
2025-02-17 14:16 ` Petr Vorel
2025-02-17 14:16 ` Petr Vorel
2025-02-17 13:47 ` Petr Vorel
2025-02-17 13:47 ` [LTP] " Petr Vorel
2025-02-17 13:16 ` [LTP] [PATCH 1/2] tst_security.sh: Fix SELinux detection Andrea Cervesato
2025-02-17 13:16 ` Andrea Cervesato via ltp
2025-02-17 14:35 ` Petr Vorel
2025-02-17 14:35 ` Petr Vorel
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=ea6764ea-db92-4f49-ba5a-650f62bcfa23@suse.com \
--to=andrea.cervesato@suse.com \
--cc=linux-integrity@vger.kernel.org \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/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.