selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: Mimi Zohar <zohar@linux.ibm.com>,
	Paul Moore <paul@paul-moore.com>,
	linux-integrity@vger.kernel.org, selinux@vger.kernel.org,
	Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
	Stephen Smalley <stephen.smalley.work@gmail.com>
Subject: Re: [PATCH] tst_security.sh: Use the same value for checkreqprot
Date: Fri, 8 Aug 2025 09:16:32 +0200	[thread overview]
Message-ID: <20250808071632.GA406350@pevik> (raw)
In-Reply-To: <20250425125057.38992-1-pvorel@suse.cz>

Hi all,

FYI patch merged.

Kind regards,
Petr

> kernel commit e9c38f9fc2cc ("Documentation,selinux: deprecate setting
> checkreqprot to 1") from v5.10-rc1 deprecated checkreqprot value 1
> (emit warning in dmesg). Code is used only in ima_selinux.sh
> which requires 5.12. Touching /sys/fs/selinux/checkreqprot is required
> to trigger the measurement via selinux_ima_measure_state().

> Using the same value (0 by default) works on recent 6.14, it should be
> safe changing to use the same value. This way misleading warning is
> avoided and hopefully kept working in the future.

> Also, this way it does not modify SUT setting (don't influence other
> tests), which is always better.

> Fixes: 36c695e497 ("tst_security.sh: Add helper tst_update_selinux_state()")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> @SELinux developers: FYI tst_security.sh is used in LTP test in
> ima_selinux.sh [1] test.

> Kind regards,
> Petr

> [1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh

>  testcases/lib/tst_security.sh | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

> diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
> index 4e2d34ca98..820736c723 100644
> --- a/testcases/lib/tst_security.sh
> +++ b/testcases/lib/tst_security.sh
> @@ -142,11 +142,10 @@ tst_get_enforce()

>  tst_update_selinux_state()
>  {
> -	local cur_val new_val
> +	local val
>  	local dir=$(tst_get_selinux_dir)
>  	[ -n "$dir" ] || return 1

> -	cur_val=$(cat $dir/checkreqprot)
> -	[ $cur_val = 1 ] && new_val=0 || new_val=1
> -	echo $new_val > $dir/checkreqprot
> +	val=$(cat $dir/checkreqprot)
> +	echo $val > $dir/checkreqprot
>  }

      reply	other threads:[~2025-08-08  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 12:50 [PATCH] tst_security.sh: Use the same value for checkreqprot Petr Vorel
2025-08-08  7:16 ` Petr Vorel [this message]

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=20250808071632.GA406350@pevik \
    --to=pvorel@suse.cz \
    --cc=linux-integrity@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=nramas@linux.microsoft.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=zohar@linux.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).