All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: ltp@lists.linux.it, Stefan Berger <stefanb@linux.ibm.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier
Date: Tue, 4 Mar 2025 13:57:49 +0100	[thread overview]
Message-ID: <20250304125749.GA81126@pevik> (raw)
In-Reply-To: <20250304115331.524842-1-zohar@linux.ibm.com>

Hi Mimi,

> Violation tests are dependent on searching the $LOG file, which may
> itself result in a ToMToU violation.  Preempt getting an additional
> violation during the tests by forcing the $LOG ToMToU violation
> earlier.

> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
>  testcases/kernel/security/integrity/ima/tests/ima_violations.sh | 1 +
>  1 file changed, 1 insertion(+)

> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> index 37d8d473c..22863fb72 100755
> --- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> @@ -30,6 +30,7 @@ setup()
>  	if [ ! -e "$LOG" ]; then
>  		tst_brk TCONF "log file not found, install auditd"
>  	fi
> +	exec 3< $LOG || tst_brk TBROK "failed to read log file"
>  	tst_res TINFO "using log $LOG"

If you don't mind, I would reverse the order to get info about which log is
used:

	tst_res TINFO "using log $LOG"
	exec 3< $LOG || tst_brk TBROK "failed to read log file"

Or, if it's needed to for some reason to run it before (no idea why, but I might
miss something), I would merge it as:

	exec 3< $LOG || tst_brk TBROK "failed to read $LOG"
	tst_res TINFO "using log $LOG"

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <pvorel@suse.cz>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org, ltp@lists.linux.it,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [LTP] [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier
Date: Tue, 4 Mar 2025 13:57:49 +0100	[thread overview]
Message-ID: <20250304125749.GA81126@pevik> (raw)
In-Reply-To: <20250304115331.524842-1-zohar@linux.ibm.com>

Hi Mimi,

> Violation tests are dependent on searching the $LOG file, which may
> itself result in a ToMToU violation.  Preempt getting an additional
> violation during the tests by forcing the $LOG ToMToU violation
> earlier.

> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
>  testcases/kernel/security/integrity/ima/tests/ima_violations.sh | 1 +
>  1 file changed, 1 insertion(+)

> diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> index 37d8d473c..22863fb72 100755
> --- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> +++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
> @@ -30,6 +30,7 @@ setup()
>  	if [ ! -e "$LOG" ]; then
>  		tst_brk TCONF "log file not found, install auditd"
>  	fi
> +	exec 3< $LOG || tst_brk TBROK "failed to read log file"
>  	tst_res TINFO "using log $LOG"

If you don't mind, I would reverse the order to get info about which log is
used:

	tst_res TINFO "using log $LOG"
	exec 3< $LOG || tst_brk TBROK "failed to read log file"

Or, if it's needed to for some reason to run it before (no idea why, but I might
miss something), I would merge it as:

	exec 3< $LOG || tst_brk TBROK "failed to read $LOG"
	tst_res TINFO "using log $LOG"

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

  parent reply	other threads:[~2025-03-04 12:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 11:53 [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier Mimi Zohar
2025-03-04 11:53 ` [LTP] " Mimi Zohar
2025-03-04 11:53 ` [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations Mimi Zohar
2025-03-04 11:53   ` [LTP] " Mimi Zohar
2025-03-04 13:31   ` Petr Vorel
2025-03-04 13:31     ` [LTP] " Petr Vorel
2025-03-04 14:44     ` Mimi Zohar
2025-03-04 14:44       ` [LTP] " Mimi Zohar
2025-03-04 14:59       ` Mimi Zohar
2025-03-04 14:59         ` [LTP] " Mimi Zohar
2025-03-04 17:43         ` Petr Vorel
2025-03-04 17:43           ` [LTP] " Petr Vorel
2025-03-04 21:33           ` Mimi Zohar
2025-03-04 21:33             ` [LTP] " Mimi Zohar
2025-03-04 11:53 ` [PATCH v2 3/4] ima_violations.sh: additional open-writer violation tests Mimi Zohar
2025-03-04 11:53   ` [LTP] " Mimi Zohar
2025-03-04 11:53 ` [PATCH v2 4/4] ima_violations.sh: additional ToMToU " Mimi Zohar
2025-03-04 11:53   ` [LTP] " Mimi Zohar
2025-03-04 12:57 ` Petr Vorel [this message]
2025-03-04 12:57   ` [LTP] [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier Petr Vorel
2025-03-04 13:06   ` Mimi Zohar
2025-03-04 13:06     ` [LTP] " Mimi Zohar
2025-03-04 13:34     ` Petr Vorel
2025-03-04 13:34       ` [LTP] " 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=20250304125749.GA81126@pevik \
    --to=pvorel@suse.cz \
    --cc=linux-integrity@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=stefanb@linux.ibm.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 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.