From patchwork Thu Oct 10 08:17:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Fang X-Patchwork-Id: 1174366 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pkVQ25KPz9sCJ for ; Thu, 10 Oct 2019 19:18:06 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A9A533C1C87 for ; Thu, 10 Oct 2019 10:18:03 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id 67FDE3C0B87 for ; Thu, 10 Oct 2019 10:18:00 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 7A3C520127C for ; Thu, 10 Oct 2019 10:18:00 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C72410DCC9D for ; Thu, 10 Oct 2019 08:17:59 +0000 (UTC) Received: from dhcp-0-148.nay.redhat.com (dhcp-0-148.nay.redhat.com [10.66.0.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBB23196B2; Thu, 10 Oct 2019 08:17:57 +0000 (UTC) From: Ping Fang To: ltp@lists.linux.it Date: Thu, 10 Oct 2019 16:17:52 +0800 Message-Id: <20191010081752.11334-1-pifang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Thu, 10 Oct 2019 08:17:59 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH v2] acct: fix version check on big endian system X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liwan@redhat.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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 Signed-off-by: Ping Fang Reviewed-by: Petr Vorel --- include/lapi/acct.h | 5 +++++ testcases/kernel/syscalls/acct/acct02.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/lapi/acct.h b/include/lapi/acct.h index ebd65bbf4..c81b78b44 100644 --- a/include/lapi/acct.h +++ b/include/lapi/acct.h @@ -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 */ diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c index 7c2a27046..4d95aafec 100644 --- a/testcases/kernel/syscalls/acct/acct02.c +++ b/testcases/kernel/syscalls/acct/acct02.c @@ -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;