Linux Test Project
 help / color / mirror / Atom feed
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 1/2] tst_security.sh: Fix SELinux detection
Date: Mon, 17 Feb 2025 14:16:04 +0100	[thread overview]
Message-ID: <f8d6c3fd-7b1d-4d16-b034-a2b01f956870@suse.com> (raw)
In-Reply-To: <20250217130839.2392666-1-pvorel@suse.cz>

Hi!

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

On 2/17/25 14:08, Petr Vorel wrote:
> Some SLES15 versions create /selinux directory which fails the detection
> if SELinux is actually not enabled. Therefore detect if directory
> actually contains the 'enforce' file.
>
> Also drop /selinux directory detection and detect only /sys/fs/selinux,
> /sys/fs/selinux mount point was added in kernel 3.0 in commit
> 7a627e3b9a2b ("SELINUX: add /sys/fs/selinux mount point to put selinuxfs")
> 14 years is enough, kernel 3.0 is not even supported in current LTP and
> we don't even support /selinux in C API (tst_security.c).
>
> Fixes: e7b804df65 ("shell: Add tst_security.sh helper")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>   testcases/lib/tst_security.sh | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
> index 05640234ea..356c28fc73 100644
> --- a/testcases/lib/tst_security.sh
> +++ b/testcases/lib/tst_security.sh
> @@ -127,8 +127,7 @@ tst_get_selinux_dir()
>   {
>   	local dir="/sys/fs/selinux"
>   
> -	[ -d "$dir" ] || dir="/selinux"
> -	[ -d "$dir" ] && echo "$dir"
> +	[ -f "$dir/enforce" ] && echo "$dir"
>   }
>   
>   # Get SELinux enforce file path

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2025-02-17 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 13:08 [LTP] [PATCH 1/2] tst_security.sh: Fix SELinux detection Petr Vorel
2025-02-17 13:08 ` [LTP] [PATCH 2/2] ima_selinux.sh: Detect SELinux before loading policy Petr Vorel
2025-02-17 13:26   ` Andrea Cervesato via ltp
2025-02-17 14:16     ` Petr Vorel
2025-02-17 13:47   ` Petr Vorel
2025-02-17 13:16 ` Andrea Cervesato via ltp [this message]
2025-02-17 14:35   ` [LTP] [PATCH 1/2] tst_security.sh: Fix SELinux detection 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=f8d6c3fd-7b1d-4d16-b034-a2b01f956870@suse.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=linux-integrity@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox