All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
@ 2022-01-12 15:01 ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2022-01-12 15:01 UTC (permalink / raw)
  To: ltp
  Cc: Petr Vorel, linux-integrity, Mimi Zohar, Alex Henrie,
	alexhenrie24, Cyril Hrubis

It fixes more iterations (e.g. -i2) which is more precise.
date +%s could be used, but it's better use procfs file instead
requiring binary.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi all,

I hope to get this merged into upcoming release (git freeze is going to
be at January the 14), i.e. this Friday.

Kind regards,
Petr

 .../security/integrity/ima/tests/ima_measurements.sh      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
index a83c416de0..6c184f3960 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
@@ -55,7 +55,7 @@ check_iversion_support()
 test1()
 {
 	tst_res TINFO "verify adding record to the IMA measurement list"
-	ROD echo "$(date) this is a test file" \> $TEST_FILE
+	ROD echo "$(cat /proc/uptime) this is a test file" \> $TEST_FILE
 	ima_check $TEST_FILE
 }
 
@@ -64,7 +64,7 @@ test2()
 
 	tst_res TINFO "verify updating record in the IMA measurement list"
 	check_iversion_support || return
-	ROD echo "$(date) modified file" \> $TEST_FILE
+	ROD echo "$(cat /proc/uptime) modified file" \> $TEST_FILE
 	ima_check $TEST_FILE
 }
 
@@ -83,11 +83,11 @@ test3()
 		return
 	fi
 
-	mkdir -m 0700 $dir
+	[ -d "$dir" ] || mkdir -m 0700 $dir
 	chown $user $dir
 	cd $dir
 	# need to read file to get updated $ASCII_MEASUREMENTS
-	sudo -n -u $user sh -c "echo $(date) user file > $file; cat $file > /dev/null"
+	sudo -n -u $user sh -c "echo $(cat /proc/uptime) user file > $file; cat $file > /dev/null"
 	cd ..
 
 	EXPECT_FAIL "grep $file $ASCII_MEASUREMENTS"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
@ 2022-01-12 15:01 ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2022-01-12 15:01 UTC (permalink / raw)
  To: ltp; +Cc: alexhenrie24, Alex Henrie, linux-integrity

It fixes more iterations (e.g. -i2) which is more precise.
date +%s could be used, but it's better use procfs file instead
requiring binary.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi all,

I hope to get this merged into upcoming release (git freeze is going to
be at January the 14), i.e. this Friday.

Kind regards,
Petr

 .../security/integrity/ima/tests/ima_measurements.sh      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
index a83c416de0..6c184f3960 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
@@ -55,7 +55,7 @@ check_iversion_support()
 test1()
 {
 	tst_res TINFO "verify adding record to the IMA measurement list"
-	ROD echo "$(date) this is a test file" \> $TEST_FILE
+	ROD echo "$(cat /proc/uptime) this is a test file" \> $TEST_FILE
 	ima_check $TEST_FILE
 }
 
@@ -64,7 +64,7 @@ test2()
 
 	tst_res TINFO "verify updating record in the IMA measurement list"
 	check_iversion_support || return
-	ROD echo "$(date) modified file" \> $TEST_FILE
+	ROD echo "$(cat /proc/uptime) modified file" \> $TEST_FILE
 	ima_check $TEST_FILE
 }
 
@@ -83,11 +83,11 @@ test3()
 		return
 	fi
 
-	mkdir -m 0700 $dir
+	[ -d "$dir" ] || mkdir -m 0700 $dir
 	chown $user $dir
 	cd $dir
 	# need to read file to get updated $ASCII_MEASUREMENTS
-	sudo -n -u $user sh -c "echo $(date) user file > $file; cat $file > /dev/null"
+	sudo -n -u $user sh -c "echo $(cat /proc/uptime) user file > $file; cat $file > /dev/null"
 	cd ..
 
 	EXPECT_FAIL "grep $file $ASCII_MEASUREMENTS"
-- 
2.34.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
  2022-01-12 15:01 ` [LTP] " Petr Vorel
@ 2022-01-14  1:11   ` Mimi Zohar
  -1 siblings, 0 replies; 6+ messages in thread
From: Mimi Zohar @ 2022-01-14  1:11 UTC (permalink / raw)
  To: Petr Vorel, ltp; +Cc: linux-integrity, Alex Henrie, alexhenrie24, Cyril Hrubis

On Wed, 2022-01-12 at 16:01 +0100, Petr Vorel wrote:
> It fixes more iterations (e.g. -i2) which is more precise.
> date +%s could be used, but it's better use procfs file instead
> requiring binary.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Thanks, Petr.

Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
@ 2022-01-14  1:11   ` Mimi Zohar
  0 siblings, 0 replies; 6+ messages in thread
From: Mimi Zohar @ 2022-01-14  1:11 UTC (permalink / raw)
  To: Petr Vorel, ltp; +Cc: alexhenrie24, linux-integrity, Alex Henrie

On Wed, 2022-01-12 at 16:01 +0100, Petr Vorel wrote:
> It fixes more iterations (e.g. -i2) which is more precise.
> date +%s could be used, but it's better use procfs file instead
> requiring binary.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Thanks, Petr.

Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
  2022-01-14  1:11   ` [LTP] " Mimi Zohar
@ 2022-01-14  8:53     ` Petr Vorel
  -1 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2022-01-14  8:53 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: ltp, linux-integrity, Alex Henrie, alexhenrie24, Cyril Hrubis

Hi Mimi,

> On Wed, 2022-01-12 at 16:01 +0100, Petr Vorel wrote:
> > It fixes more iterations (e.g. -i2) which is more precise.
> > date +%s could be used, but it's better use procfs file instead
> > requiring binary.

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

> Thanks, Petr.

> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>

Thanks a lot for your review, merged.

Kind regards,
Petr


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date
@ 2022-01-14  8:53     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2022-01-14  8:53 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: alexhenrie24, linux-integrity, Alex Henrie, ltp

Hi Mimi,

> On Wed, 2022-01-12 at 16:01 +0100, Petr Vorel wrote:
> > It fixes more iterations (e.g. -i2) which is more precise.
> > date +%s could be used, but it's better use procfs file instead
> > requiring binary.

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

> Thanks, Petr.

> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>

Thanks a lot for your review, merged.

Kind regards,
Petr


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-14  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 15:01 [PATCH 1/1] ima_measurements.sh: Use /proc/uptime instead of date Petr Vorel
2022-01-12 15:01 ` [LTP] " Petr Vorel
2022-01-14  1:11 ` Mimi Zohar
2022-01-14  1:11   ` [LTP] " Mimi Zohar
2022-01-14  8:53   ` Petr Vorel
2022-01-14  8:53     ` [LTP] " Petr Vorel

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.