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__ */ From patchwork Thu Apr 27 00:29:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1774298 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=6RCH+4Uu; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6GpW1MxGz23vK for ; Thu, 27 Apr 2023 10:29:55 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1701C3CE4D7 for ; Thu, 27 Apr 2023 02:29:53 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 954A23CE4D3 for ; Thu, 27 Apr 2023 02:29:32 +0200 (CEST) Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) (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-6.smtp.seeweb.it (Postfix) with ESMTPS id E2E4D1400BE2 for ; Thu, 27 Apr 2023 02:29:31 +0200 (CEST) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9a6eeea78cso1259405276.0 for ; Wed, 26 Apr 2023 17:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682555370; x=1685147370; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VEFg6fcUhrfpnj5qs7qTFzI6HoajphnN/fBGZYFt+zo=; b=6RCH+4UuAXlbfD8xxmFnJ5e2beHuMGdu//4e9wVU48YE9dJjhy1B31pleYdg9mxFCd GtJJ1+Ug5bNcFUIn1gzp7W1ANA2i194ULC9eFHq1oHlB168bTXwQdp7HSYShCDH6f0i0 hcDuTZLqhDXWEC9QoreivKRJtRyLctkUKtt/YKm5fbDoRVquRRayN2slVRCyULSlw1vN /lM9NN7nBYyt8LyrczMZViRmoTmcXQQDPYvtw4D/yvia35lFLDhtsCUI0rVb5f9M915g 09Diia+3x3ziqUGABUKRSpAU2sAuiQG3azASSK1i+FWS1yfxk+oLrNPj0yI7PZHIdMoT gfvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682555370; x=1685147370; 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=VEFg6fcUhrfpnj5qs7qTFzI6HoajphnN/fBGZYFt+zo=; b=AKhxeP6Pi5j9JEhiJuiKHjZZDKxKhAz1ANC6Ut2fP8RouaUp0O/ZDKkLvpEsKqb+h5 G+plpiFdI4SR80hNkMm6ATvmNJnshb0tHGdbOt0gQAuP6Fc98NCmuo6xuk0ShLoUav7X PW07jOBZ5a10ZHtv4QxuS/BGF5M3Y0RG4HFz9899Yiob5Xk4i6WyyTpucPk9lXR04P6w GDb6T6ixC/QdkFqrSna7o2a6u64f3L0Ples6IElp7bJ+c+TIigJIiUWfJo93FMCP87qF SgX18Aj4XvpuAjx/3CZo+r1oG9zJxfwJNeuTybycTE4EoNz9ts7uW0q2gO2FidbbN+gJ e6dw== X-Gm-Message-State: AC+VfDx+48rYICbjYmJps8jkWh39Ypg3VE1yw2R6S5eqDWO2WmEuNI5r jXQtExxI+j8ZfFZwLyBQlP55b/3RIJtH1GEvprLeeIci5f4V/qfZp5hqJuJp3HINSbI+QZ4hwgW eZ8KPQkslKPLELmj5FEe1kQ7HOznW3E7zMRTNK79wkrVUuzvPr7L7FWqA X-Google-Smtp-Source: ACHHUZ4RHnWc+uszU1PNVkM7lDR7eMT8CQmKTO6yp234qVmeQtUOFwpQMiJsqiIG1nhQoPWtFwtVyCPqKSo= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a25:e70c:0:b0:b95:3e0b:45b8 with SMTP id e12-20020a25e70c000000b00b953e0b45b8mr96523ybh.2.1682555370563; Wed, 26 Apr 2023 17:29:30 -0700 (PDT) Date: Thu, 27 Apr 2023 00:29:05 +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-3-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 0.102.4 at in-6.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-6.smtp.seeweb.it Subject: [LTP] [PATCH v1 2/2] fcntl{34, 36}: Use arch dependent types for my_flock64 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" On Android arm64, fcntl is not accepting the my_flock64 struct being passed (fails with EINVAL). This modifies the struct type to match the flock64 definition in the kernel. Signed-off-by: Edward Liaw --- testcases/kernel/syscalls/fcntl/fcntl_common.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h index 485a31367..78ffcdc2d 100644 --- a/testcases/kernel/syscalls/fcntl/fcntl_common.h +++ b/testcases/kernel/syscalls/fcntl/fcntl_common.h @@ -16,13 +16,13 @@ #else struct my_flock64 { - int16_t l_type; - int16_t l_whence; - int64_t l_start; - int64_t l_len; - int32_t l_pid; + short l_type; + short l_whence; + off64_t l_start; + off64_t l_len; + pid_t l_pid; #if defined(__sparc__) - int16_t padding; + short padding; #endif };