Skip to contentSkip to conversation

syscalls/acct02: Check read size.

PATCH New Cyril Hrubis 4 participants 15 messages Sep 25, 2019 – Nov 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

This is just a minor adjustements that checks that we get correct size from read before we attempt to validate the data we read in order to print more meaningful failure message.

---
 testcases/kernel/syscalls/acct/acct02.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/acct/acct02.c +14 -2
index 110d99359..bdb7c1194 100644
@@ -171,10 +171,21 @@ static void run(void)
 	acct(NULL);
 
 	do {
-		tst_res(TINFO, "== entry %d ==", ++i);
-
 		read_bytes = SAFE_READ(0, fd, &acct_struct, acct_size);
 
+		if (i == 0 && read_bytes == 0) {
+			tst_res(TFAIL, "acct file is empty");
+			goto exit;
+		}
+
+		if (read_bytes != acct_size) {
+			tst_res(TFAIL, "incomplete read %i bytes, expected %i",
+			        read_bytes, acct_size);
+			goto exit;
+		}
+
+		tst_res(TINFO, "== entry %d ==", ++i);
+
 		if (v3)
 			ret = verify_acct(&acct_struct.v3, acct_struct.v3.ac_etime);
 		else
@@ -192,6 +203,7 @@ static void run(void)
 	else
 		tst_res(TPASS, "acct() wrote correct file contents!");
 
+exit:
 	SAFE_CLOSE(fd);
 }
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Hi Cyril,

Quoted 5 lines

This is just a minor adjustements that checks that we get correct size from read before we attempt to validate the data we read in order to print more meaningful failure message.

Quoted 1 line
 testcases/kernel/syscalls/acct/acct02.c | 16 ++++++++++++++--

...

Quoted 22 lines
testcases/kernel/syscalls/acct/acct02.c +13 -2
 	do {
-		tst_res(TINFO, "== entry %d ==", ++i);
-
 		read_bytes = SAFE_READ(0, fd, &acct_struct, acct_size);
 
+		if (i == 0 && read_bytes == 0) {
+			tst_res(TFAIL, "acct file is empty");
+			goto exit;
+		}
+
+		if (read_bytes != acct_size) {
+			tst_res(TFAIL, "incomplete read %i bytes, expected %i",
+			        read_bytes, acct_size);
+			goto exit;
+		}
+
+		tst_res(TINFO, "== entry %d ==", ++i);
+
 		if (v3)
 			ret = verify_acct(&acct_struct.v3, acct_struct.v3.ac_etime);
 		else

testcases/kernel/syscalls/acct/acct02.c static void run(void) · line 208

Quoted 6 lines
testcases/kernel/syscalls/acct/acct02.c +1 -0
@@ -192,6 +203,7 @@ static void run(void)
 	else
 		tst_res(TPASS, "acct() wrote correct file contents!");
 
+exit:
 	SAFE_CLOSE(fd);
 }

OK, on s390 where it's failing it actually catches "incomplete read":

tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' acct02.c:234: INFO: Verifying using 'struct acct_v3' acct02.c:187: INFO: == entry 1 ==
acct02.c:147: INFO: ac_version != 3 (131) acct02.c:187: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 54783 (54781) acct02.c:147: INFO: ac_version != 3 (131) acct02.c:183: FAIL: incomplete read 0 bytes, expected 64

Kind regards,
Petr

#2 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Hi!

Quoted 31 lines
Quoted 22 lines
testcases/kernel/syscalls/acct/acct02.c +13 -2
 	do {
-		tst_res(TINFO, "== entry %d ==", ++i);
-
 		read_bytes = SAFE_READ(0, fd, &acct_struct, acct_size);
 
+		if (i == 0 && read_bytes == 0) {
+			tst_res(TFAIL, "acct file is empty");
+			goto exit;
+		}
+
+		if (read_bytes != acct_size) {
+			tst_res(TFAIL, "incomplete read %i bytes, expected %i",
+			        read_bytes, acct_size);
+			goto exit;
+		}
+
+		tst_res(TINFO, "== entry %d ==", ++i);
+
 		if (v3)
 			ret = verify_acct(&acct_struct.v3, acct_struct.v3.ac_etime);
 		else

testcases/kernel/syscalls/acct/acct02.c static void run(void) · line 208

Quoted 6 lines
testcases/kernel/syscalls/acct/acct02.c +1 -0
@@ -192,6 +203,7 @@ static void run(void)
 	else
 		tst_res(TPASS, "acct() wrote correct file contents!");
 
+exit:
 	SAFE_CLOSE(fd);
 }

OK, on s390 where it's failing it actually catches "incomplete read":

Quoted 12 lines

tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' acct02.c:234: INFO: Verifying using 'struct acct_v3' acct02.c:187: INFO: == entry 1 ==
acct02.c:147: INFO: ac_version != 3 (131) acct02.c:187: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 54783 (54781) acct02.c:147: INFO: ac_version != 3 (131) acct02.c:183: FAIL: incomplete read 0 bytes, expected 64

Isn't that just end-of-file? I guess that we should just break the loop if i != 0 and read returned 0.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

In reply to Petr Vorel

Hi!
I've just pushed this patch + one more special case for read_bytes == 0, can you please give it a try and check that at least the test works where it was working previously?

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Hi Cyril,

Quoted 4 lines

Hi!
I've just pushed this patch + one more special case for read_bytes == 0, can you please give it a try and check that at least the test works where it was working previously?

Yep, confirm that it's working as expected :).

Kind regards,
Petr

#5 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

In reply to Petr Vorel

----- Original Message -----

Quoted 15 lines

OK, on s390 where it's failing it actually catches "incomplete read":

tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' acct02.c:234: INFO: Verifying using 'struct acct_v3' acct02.c:187: INFO: == entry 1 ==
acct02.c:147: INFO: ac_version != 3 (131) acct02.c:187: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 54783 (54781) acct02.c:147: INFO: ac_version != 3 (131) acct02.c:183: FAIL: incomplete read 0 bytes, expected 64

I'm seeing similar failure:

tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3'
acct02.c:192: INFO: == entry 1 ==
acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)
acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02')
acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)
acct02.c:133: INFO: ac_exitcode != 32768 (0)
acct02.c:141: INFO: ac_ppid != 25608 (25607)
acct02.c:182: FAIL: end of file reached

but I don't get what process is this record from.
I see 3 pids: library, main and 'acct02_helper'. What 'acct02' process terminated?

#6 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

----- Original Message -----

Quoted 21 lines

----- Original Message -----

Quoted 15 lines

OK, on s390 where it's failing it actually catches "incomplete read":

tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz' acct02.c:234: INFO: Verifying using 'struct acct_v3' acct02.c:187: INFO: == entry 1 ==
acct02.c:147: INFO: ac_version != 3 (131) acct02.c:187: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 54783 (54781) acct02.c:147: INFO: ac_version != 3 (131) acct02.c:183: FAIL: incomplete read 0 bytes, expected 64

I'm seeing similar failure:

Quoted 8 lines

tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 == acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)

^^ This is 'acct02_helper', which seemingly started before 'start_time'.

ac_btime is calculated back from current time and elapsed time@fill_ac():

  ac->ac_btime = get_seconds() - elapsed;

s390s are slower, so my guess is another second ticks before btime gets calculated, and it appears to have started later.

Quoted 5 lines

acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:88: INFO: ac_btime < 1572367954 (1572367953) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 25608 (25607)

The 2nd record is filled at acct(NULL), even though process still runs:

[ 1156.025654] CPU: 0 PID: 11772 Comm: acct02_helper Tainted: G           OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1156.027105]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1156.027108] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1156.027110]  [<00000000001de3ae>] acct_process+0xf6/0x140
[ 1156.027112]  [<000000000014de32>] do_exit+0x752/0xa38
[ 1156.027116]  [<000000000014e216>] do_group_exit+0x66/0xf8
[ 1156.027118]  [<000000000014e2ea>] SyS_exit_group+0x42/0x48
[ 1157.033294] CPU: 1 PID: 11771 Comm: acct02 Tainted: G           OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1157.033384]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1157.033386] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1157.033389]  [<00000000001ddcda>] acct_pin_kill+0x52/0xa8
[ 1157.033391]  [<000000000034a83e>] pin_kill+0xb6/0x178
[ 1157.033395]  [<00000000001ddfe8>] SyS_acct+0x2b8/0x350
#7 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Hi Jan,

Quoted 11 lines
Quoted 10 lines

I'm seeing similar failure:

tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 == acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)

Quoted 8 lines

^^ This is 'acct02_helper', which seemingly started before 'start_time'.

ac_btime is calculated back from current time and elapsed time at fill_ac():

  ac->ac_btime = get_seconds() - elapsed;

s390s are slower, so my guess is another second ticks before btime gets calculated, and it appears to have started later.

Agree.

Quoted 17 lines
Quoted 5 lines

acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:88: INFO: ac_btime < 1572367954 (1572367953) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 25608 (25607)

The 2nd record is filled at acct(NULL), even though process still runs:

[ 1156.025654] CPU: 0 PID: 11772 Comm: acct02_helper Tainted: G           OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1156.027105]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1156.027108] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1156.027110]  [<00000000001de3ae>] acct_process+0xf6/0x140
[ 1156.027112]  [<000000000014de32>] do_exit+0x752/0xa38
[ 1156.027116]  [<000000000014e216>] do_group_exit+0x66/0xf8
[ 1156.027118]  [<000000000014e2ea>] SyS_exit_group+0x42/0x48
Quoted 7 lines
[ 1157.033294] CPU: 1 PID: 11771 Comm: acct02 Tainted: G           OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1157.033384]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1157.033386] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1157.033389]  [<00000000001ddcda>] acct_pin_kill+0x52/0xa8
[ 1157.033391]  [<000000000034a83e>] pin_kill+0xb6/0x178
[ 1157.033395]  [<00000000001ddfe8>] SyS_acct+0x2b8/0x350

Hm, did you reproduce it on 4.18 (rhel8)?

Kind regards,
Petr

#8 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

----- Original Message -----

Quoted 52 lines

Hi Jan,

Quoted 13 lines
Quoted 10 lines

I'm seeing similar failure:

tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 == acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)

^^ This is 'acct02_helper', which seemingly started before 'start_time'.

Quoted 8 lines

ac_btime is calculated back from current time and elapsed time at fill_ac():

  ac->ac_btime = get_seconds() - elapsed;

s390s are slower, so my guess is another second ticks before btime gets calculated,
and it appears to have started later.

Agree.

Quoted 18 lines
Quoted 5 lines

acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:88: INFO: ac_btime < 1572367954 (1572367953) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 25608 (25607)

The 2nd record is filled at acct(NULL), even though process still runs:

[ 1156.025654] CPU: 0 PID: 11772 Comm: acct02_helper Tainted: G
OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1156.027105]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1156.027108] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1156.027110]  [<00000000001de3ae>] acct_process+0xf6/0x140
[ 1156.027112]  [<000000000014de32>] do_exit+0x752/0xa38
[ 1156.027116]  [<000000000014e216>] do_group_exit+0x66/0xf8
[ 1156.027118]  [<000000000014e2ea>] SyS_exit_group+0x42/0x48
Quoted 8 lines
[ 1157.033294] CPU: 1 PID: 11771 Comm: acct02 Tainted: G           OE
------------   3.10.0-1106.el7.s390x #1
<>
[ 1157.033384]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1157.033386] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1157.033389]  [<00000000001ddcda>] acct_pin_kill+0x52/0xa8
[ 1157.033391]  [<000000000034a83e>] pin_kill+0xb6/0x178
[ 1157.033395]  [<00000000001ddfe8>] SyS_acct+0x2b8/0x350
Quoted 1 line

Hm, did you reproduce it on 4.18 (rhel8)?

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

We can tweak 'ac_btime' condition, but I think the test will remain race-y in environments with higher steal time:

acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 43213 (43212) acct02.c:182: FAIL: end of file reached

#9 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Quoted 58 lines · Jan Stancek

----- Original Message -----

Quoted 14 lines

Hi Jan,

Quoted 12 lines
Quoted 10 lines

I'm seeing similar failure:

tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-3.10.0-1106.el7.cki.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 == acct02.c:88: INFO: ac_btime < 1572367954 (1572367953)

^^ This is 'acct02_helper', which seemingly started before

'start_time'.

Quoted 38 lines
Quoted 9 lines

ac_btime is calculated back from current time and elapsed time at fill_ac():

  ac->ac_btime = get_seconds() - elapsed;

s390s are slower, so my guess is another second ticks before btime gets calculated,
and it appears to have started later.

Agree.

Quoted 18 lines
Quoted 5 lines

acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:88: INFO: ac_btime < 1572367954 (1572367953) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 25608 (25607)

The 2nd record is filled at acct(NULL), even though process still runs:

[ 1156.025654] CPU: 0 PID: 11772 Comm: acct02_helper Tainted: G
OE  ------------   3.10.0-1106.el7.s390x #1
<>
[ 1156.027105]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1156.027108] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1156.027110]  [<00000000001de3ae>] acct_process+0xf6/0x140
[ 1156.027112]  [<000000000014de32>] do_exit+0x752/0xa38
[ 1156.027116]  [<000000000014e216>] do_group_exit+0x66/0xf8
[ 1156.027118]  [<000000000014e2ea>] SyS_exit_group+0x42/0x48
Quoted 8 lines
[ 1157.033294] CPU: 1 PID: 11771 Comm: acct02 Tainted: G           OE
------------   3.10.0-1106.el7.s390x #1
<>
[ 1157.033384]  [<00000000001dd630>] fill_ac+0x0/0x440
[ 1157.033386] ([<00000000001ddae8>] do_acct_process+0x78/0x1a0)
[ 1157.033389]  [<00000000001ddcda>] acct_pin_kill+0x52/0xa8
[ 1157.033391]  [<000000000034a83e>] pin_kill+0xb6/0x178
[ 1157.033395]  [<00000000001ddfe8>] SyS_acct+0x2b8/0x350
Quoted 1 line

Hm, did you reproduce it on 4.18 (rhel8)?

Quoted 8 lines

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

We can tweak 'ac_btime' condition, but I think the test will remain

How much time of the ac_btime shaking to be tolerated is proper?

Quoted 2 lines

race-y in environments with higher steal time:

I'm sorry, what does it mean here?

Quoted 15 lines

acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 43213 (43212) acct02.c:182: FAIL: end of file reached

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

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20191031/b174faa0/attachment.htm>
#10 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

----- Original Message -----

Quoted 10 lines
Quoted 8 lines

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

We can tweak 'ac_btime' condition, but I think the test will remain

How much time of the ac_btime shaking to be tolerated is proper?

I wanted to go with 1 sec:

@@ -83,7 +83,7 @@ static int verify_acct(void *acc, int elap_time)

                ret = 1;
        }

- if (ACCT_MEMBER(ac_btime) < start_time) {

+       if (ACCT_MEMBER(ac_btime) + 1 < start_time) {
                tst_res(TINFO, "ac_btime < %d (%d)", start_time,
                        ACCT_MEMBER(ac_btime));
                ret = 1;
Quoted 5 lines
Quoted 3 lines

race-y in environments with higher steal time:

I'm sorry, what does it mean here?

I was referring to failed check below. s390 is scarce resource and when over-committed, sleeps are less consistent. E.g. sleep(1) taking 2+ seconds:
nanosleep({1, 0}, NULL) = 0 <1.926617>

Quoted 13 lines
Quoted 13 lines

acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 43213 (43212) acct02.c:182: FAIL: end of file reached

#11 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

Hi Jan,

Review static int verify_acct(void *acc, int elap_time) · line 89

Quoted 13 lines
Quoted 1 line

How much time of the ac_btime shaking to be tolerated is proper?

I wanted to go with 1 sec:

(quoted diff) +1 -1
@@ -83,7 +83,7 @@ static int verify_acct(void *acc, int elap_time)
                ret = 1;
        }
 
-       if (ACCT_MEMBER(ac_btime) < start_time) {
+       if (ACCT_MEMBER(ac_btime) + 1 < start_time) {
                tst_res(TINFO, "ac_btime < %d (%d)", start_time,
                        ACCT_MEMBER(ac_btime));
                ret = 1;

Ack.

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

race-y in environments with higher steal time:

I'm sorry, what does it mean here?

I was referring to failed check below. s390 is scarce resource and when over-committed, sleeps are less consistent. E.g. sleep(1) taking 2+ seconds:
nanosleep({1, 0}, NULL) = 0 <1.926617>

Lol :)

Kind regards,
Petr

#12 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

In reply to Jan Stancek
Quoted 8 lines · Jan Stancek

----- Original Message -----

Quoted 6 lines
Quoted 6 lines

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

We can tweak 'ac_btime' condition, but I think the test will remain

How much time of the ac_btime shaking to be tolerated is proper?

I wanted to go with 1 sec:

I'm ok with that. Seems no better way so far.

Quoted 15 lines
(quoted diff) +1 -1
@@ -83,7 +83,7 @@ static int verify_acct(void *acc, int elap_time)
                ret = 1;
        }
 
-       if (ACCT_MEMBER(ac_btime) < start_time) {
+       if (ACCT_MEMBER(ac_btime) + 1 < start_time) {
                tst_res(TINFO, "ac_btime < %d (%d)", start_time,
                        ACCT_MEMBER(ac_btime));
                ret = 1;
Quoted 5 lines
Quoted 4 lines

race-y in environments with higher steal time:

Quoted 7 lines
Quoted 1 line

I'm sorry, what does it mean here?

I was referring to failed check below. s390 is scarce resource and when over-committed, sleeps are less consistent. E.g. sleep(1) taking 2+ seconds:
nanosleep({1, 0}, NULL) = 0 <1.926617>

Okay.

Quoted 15 lines
Quoted 14 lines
Quoted 14 lines

acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 43213 (43212) acct02.c:182: FAIL: end of file reached

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20191101/eb7d8888/attachment.htm>
#13 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

----- Original Message -----

Quoted 13 lines · Jan Stancek
Quoted 12 lines

----- Original Message -----

Quoted 9 lines
Quoted 8 lines

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

We can tweak 'ac_btime' condition, but I think the test will remain

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

How much time of the ac_btime shaking to be tolerated is proper?

I wanted to go with 1 sec:

I'm ok with that. Seems no better way so far.

I want to look at this a bit more, and add some extra traces to kernel.

#14 lore raw

PATCH 1/1 syscalls/acct02: Check read size.

In reply to Jan Stancek

Hi Jan,

Quoted 4 lines
Quoted 1 line

Hm, did you reproduce it on 4.18 (rhel8)?

Above was RHEL7. Do you expect different outcome on RHEL8? I was looking at upstream sources too and it looked similar.

I know it was RHEL7. Good it's not affected by old kernel code, but rather by overloaded host. Agree, that some tolerance is needed.

Quoted 6 lines

Anyway, I don't think this part is an issue, test will skip it because "comm" doesn't match.

We can tweak 'ac_btime' condition, but I think the test will remain race-y in environments with higher steal time:

Quoted 9 lines

acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:192: INFO: == entry 2 ==
acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02') acct02.c:127: INFO: elap_time/clock_ticks >= 2 (236/100: 2.00) acct02.c:133: INFO: ac_exitcode != 32768 (0) acct02.c:141: INFO: ac_ppid != 43213 (43212) acct02.c:182: FAIL: end of file reached

Kind regards,
Petr