acct: fix version check on big endian system
PATCH v2 1/1 acct: fix version check on big endian system
ac_version = ACCT_VERION | ACCT_BYTEORDER which is 0x83 (131) on big endian system.
failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'struct acct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO: ac_version != 3 (131) acct02.c:192: 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 != 34501 (34500) acct02.c:147: INFO: ac_version != 3 (131) acct02.c:182: FAIL: end of file reached
--- include/lapi/acct.h | 5 +++++ testcases/kernel/syscalls/acct/acct02.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
include/lapi/acct.h +5 -0
@@ -64,6 +64,11 @@ enum {ACORE =0x08 ,AXSIG =0x10 }; +# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define ACCT_BYTEORDER 0x80 +# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define ACCT_BYTEORDER 0x00 +# endif #endif /* HAVE_STRUCT_ACCT_V3 */ #endif /* LAPI_ACCT_H */
testcases/kernel/syscalls/acct/acct02.c +1 -1
@@ -142,7 +142,7 @@ static int verify_acct(void *acc, int elap_time) ret =1 ; } -if (ACCT_MEMBER_V3 (ac_version) !=3 ) { +if (ACCT_MEMBER_V3 (ac_version) != (3 |ACCT_BYTEORDER )) {tst_res (TINFO ,"ac_version != 3 (%d)" ,ACCT_MEMBER_V3 (ac_version)); ret =1 ;
Signature · 1 line
2.21.0
PATCH v2 1/1 acct: fix version check on big endian system
Ping Fang <[email protected]> wrote:
ac_version = ACCT_VERION | ACCT_BYTEORDER
Quoted 18 lines
which is
0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reached
I'm wondering that is there any necessary to use do{}...while loop for entry many times? Since the verify_acct() only check the dummy program(acct02_helper) accounting struct. So in the error logs, we could see some meaningless data(acct02) in entry 2.
acct02.c:192: 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 != 34501 (34500)This needs to be fixed in a separate patch.
Quoted 2 lines
Signed-off-by Ping Fang <[email protected]>
The patch itself looks good. Ack.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20191010/8384c718/attachment.htm>
PATCH v2 1/1 acct: fix version check on big endian system
Quoted 23 lines · Li Wang
Ping Fang <[email protected]> wrote:
ac_version=ACCT_VERION|ACCT_BYTEORDERQuoted 18 lines
which is
0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reached
Quoted 5 lines
I'm wondering that is there any necessary to use do{}...while loop for entry many times? Since the
verify_acct()only check the dummyprogram(acct02_helper)accounting struct. So in the error logs, we could see some meaningless data(acct02) in entry 2.
It turns out I was wrong, if accounting is turned on, system records for each terminating process but not only for that process, so we need to pick up the correct acct_struct in acct_file via the while loop.
Sorry for making noise, I pull back my comments here.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20191010/43cf5f53/attachment-0001.htm>
PATCH v2 1/1 acct: fix version check on big endian system
Hi Li, Ping, Cyril,
Quoted 30 lines · Li Wang
Quoted 23 lines
Ping Fang <[email protected]> wrote:
ac_version=ACCT_VERION|ACCT_BYTEORDERQuoted 17 lines
which is
0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reachedQuoted 4 lines
I'm wondering that is there any necessary to use do{}...while loop for entry many times? Since the
verify_acct()only check the dummyprogram(acct02_helper)accounting struct. So in the error logs, we could see some meaningless data(acct02) in entry 2.
Quoted 5 lines
It turns out I was wrong, if accounting is turned on, system records for each terminating process but not only for that process, so we need to pick up the correct
acct_structinacct_filevia the while loop.Sorry for making noise, I pull back my comments here.
Thanks for a fix, merged.
Petr
PATCH v2 1/1 acct: fix version check on big endian system
In reply to Ping FangHi!
Quoted 18 lines
ac_version=ACCT_VERION|ACCT_BYTEORDERwhich is0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reached
Looks good, acked.
Also please consider a patch to the man 5 acct, it says that the version is always set to 3 for acct_v3 structure.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/1 acct: fix version check on big endian system
Hi,
Quoted 19 lines
Quoted 18 lines
ac_version=ACCT_VERION|ACCT_BYTEORDERwhich is0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reached
Quoted 4 lines
Looks good, acked.
Also please consider a patch to the man 5 acct, it says that the version is always set to 3 for
acct_v3structure.
+1.
Kind regards,
Petr
PATCH v2 1/1 acct: fix version check on big endian system
In reply to Ping FangHi Ping,
Quoted 19 lines
ac_version=ACCT_VERION|ACCT_BYTEORDERwhich is0x83(131) on big endian system.failure output:
tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s tst_kconfig.c:62: INFO: Parsing kernel config '/boot/config-4.18.0-147.el8.s390x' acct02.c:239: INFO: Verifying using 'structacct_v3' acct02.c:192: INFO: == entry 1 ==
acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:192: 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!= 34501 (34500) acct02.c:147: INFO:ac_version!= 3 (131) acct02.c:182: FAIL: end of file reached
Quoted 1 line
Signed-off-by Ping Fang <[email protected]>
Thanks for fixing the issue.
Kind regards,
Petr