From patchwork Thu Apr 27 00:29:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1774297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) 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: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=5iiDJcfy; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6GpJ65f8z23vK for ; Thu, 27 Apr 2023 10:29:44 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3B19E3CE4D6 for ; Thu, 27 Apr 2023 02:29:42 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2E4A13CBFAF for ; Thu, 27 Apr 2023 02:29:31 +0200 (CEST) Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 88D0F1A00981 for ; Thu, 27 Apr 2023 02:29:30 +0200 (CEST) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-517baf1bc93so7704829a12.0 for ; Wed, 26 Apr 2023 17:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682555369; x=1685147369; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xvLVIpEtbEhbI8/Ore/Z8JPmtlBF8S/oxC18r3bKGkU=; b=5iiDJcfyCfU9VfP/n8RxlpMsHNMOI3GQU/0+4llkUNsvxOfZOqwKNM3SptTKc+ERIk i2lbmS/LwTzygQoUa3X/WIoYJOXV8GwDCnjkxoTwqmcZgygRETdhzSLoWIw77Sehs8cs a6oxfNxAUHmKPONCHXvyAn8M0bXa7h5kIt6Ge0WroEnmOQVdPZoM18fcBx7EdLGotlLe BM4YhxfSjCvhFbg0wSMoZVEdWiOCBmnBNXpn5AsymFqidKy51PyL59F6LVeooCbPS4PF zrtz0mLD6M+cPh53l/yxKABoumH2CpUIkqNJEoB6Eo+pQYtIdTuReWyw9YebJomjcvGz QL3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682555369; x=1685147369; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xvLVIpEtbEhbI8/Ore/Z8JPmtlBF8S/oxC18r3bKGkU=; b=JpVHszcnf2avFh5lrjhqu7Nct3x8anjP4eKRMvCqht7vWq6gcUgelNgc9QD3X4xVV0 74iOjElN3c6oYjVJaSERjfAUSxkGh/sG/aBXn95BV6O8ktHp4ydFVKXSOnQtMX0iwZn1 yjKOOBbB1/ReUIbsRkGJaXheTf+SmjoPOa5Ory4TseCLqKzoja5A39RrU7sR1IVfIElx 2l2N7qd7nIRwjAhKO4zXHU4j3SRdjsJy3ss7mtfDWgDb82qi9bRaFZM6Zn6PKTbuFq/h i89ym7/HPkPB6H8psJSXDG6bFTbw6bCib/LGqch85cuMh7K6+sx++EPIgOyfwI1NcK8F xZsQ== X-Gm-Message-State: AAQBX9f7qIUT8GrATpKDORBtiHTgiyeuZECCtH/Ew8oDfUlSrQfDdKsL 4cqDkWM853ngJOg4nWTTmYqDMxlEPlq1RZ30Qka8eqLf7ByCJ4SUhhJEzZr8Yr+SBEVB9JMGzRz 6o9+7WGLn0zdcwTe0bRh/418a8PSmyW0mIw7lnQXse1gcQ7mmvtmAMiFN X-Google-Smtp-Source: AKy350ZJGpH3HYynrc1ekVxU0Y2F+yPIGy05yVCwyHJg5X2vqTijBAZ4SqeqLxPSF0apAYkxCUMTTnlmOXg= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a63:dd0c:0:b0:513:efd4:d76 with SMTP id t12-20020a63dd0c000000b00513efd40d76mr3860991pgg.5.1682555368730; Wed, 26 Apr 2023 17:29:28 -0700 (PDT) Date: Thu, 27 Apr 2023 00:29:04 +0000 In-Reply-To: <20230427002905.1354207-1-edliaw@google.com> Mime-Version: 1.0 References: <20230427002905.1354207-1-edliaw@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230427002905.1354207-2-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-7.4 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH v1 1/2] fcntl{34, 36}: Only use fcntl64 with 32bit abi 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: , X-Patchwork-Original-From: Edward Liaw via ltp From: Edward Liaw Reply-To: Edward Liaw Cc: kernel-team@android.com, rpalethorpe@suse.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Fixes: 7643115aaacb ("fcntl{34,36}: Always use 64-bit flock struct to avoid EINVAL") On Android arm64, tst_kernel_bits is disregarding the abi, so compiling with the 32bit abi is calling the fcntl syscall instead of fcntl64. The fcntl syscall is not compatible with the flock64 struct being passed (this doesn't seem to be the case with x86_64, only with arm64). This changes it to only use the fcntl64 compat syscall with the 32bit abi. Signed-off-by: Edward Liaw Reviewed-by: Petr Vorel --- testcases/kernel/syscalls/fcntl/fcntl_common.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h index 5c130a784..485a31367 100644 --- a/testcases/kernel/syscalls/fcntl/fcntl_common.h +++ b/testcases/kernel/syscalls/fcntl/fcntl_common.h @@ -10,6 +10,11 @@ #include "lapi/abisize.h" #include "lapi/fcntl.h" +#if defined(TST_ABI64) +#define FCNTL_COMPAT(fd, cmd, flock) \ + SAFE_FCNTL(fd, cmd, flock) + +#else struct my_flock64 { int16_t l_type; int16_t l_whence; @@ -43,8 +48,8 @@ static inline int fcntl_compat(const char *file, const int line, const char *cmd .l_len = lck->l_len, .l_pid = lck->l_pid, }; - const int sysno = tst_kernel_bits() > 32 ? __NR_fcntl : __NR_fcntl64; - const int ret = tst_syscall(sysno, fd, cmd, &l64); + + const int ret = tst_syscall(__NR_fcntl64, fd, cmd, &l64); lck->l_type = l64.l_type; lck->l_whence = l64.l_whence; @@ -57,7 +62,7 @@ static inline int fcntl_compat(const char *file, const int line, const char *cmd tst_brk_(file, line, TBROK | TERRNO, "%s(%d, %s, { %d, %d, %"PRId64", %"PRId64", %d })", - tst_kernel_bits() > 32 ? "fcntl" : "fcntl64", + "fcntl64", fd, cmd_name, l64.l_type, l64.l_whence, l64.l_start, l64.l_len, l64.l_pid); @@ -67,5 +72,6 @@ static inline int fcntl_compat(const char *file, const int line, const char *cmd #define FCNTL_COMPAT(fd, cmd, flock) \ fcntl_compat(__FILE__, __LINE__, #cmd, fd, cmd, flock) +#endif #endif /* FCNTL_COMMON_H__ */