From patchwork Thu Apr 27 17:43:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1774580 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=uBsRA/+O; 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 4Q6jl83PRvz23vC for ; Fri, 28 Apr 2023 03:43:32 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3E9003CE93E for ; Thu, 27 Apr 2023 19:43:30 +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]) (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 A0D263CB1F5 for ; Thu, 27 Apr 2023 19:43:18 +0200 (CEST) Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) (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-7.smtp.seeweb.it (Postfix) with ESMTPS id C4DE2200246 for ; Thu, 27 Apr 2023 19:43:17 +0200 (CEST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-555f6759323so143665047b3.2 for ; Thu, 27 Apr 2023 10:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682617396; x=1685209396; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=M9qC7sBNhWxjAncgjmRgJ8gGeWKYKrcTmTzOdQR/P6g=; b=uBsRA/+OUf/JfTdC4ehMZuxAhhLtLDVbTibAb8GCdPSreYhmqO912m4u3PFxZ8xtrN /2aydz9eIc9B/B6PLJirhIwBTQnU6b1qEwQ2IwMsAXFxqYpTazA/Ovs2o3RAa0zhCl8H 1/WrWlep5WkGji0+4w9DZ2+6ZOzwVGFObaLpTaajAf4UNAvDTHHFxG8vSAbqOJfJs90w 9wZFKQusCohmyH7iPhGYI4I9WwUMwORlZswTGEplUVzkGREnfktQoDjAIuVjwSnvaQmk vwb5M2nNGz17lJzHnCLkzQ8wyYB4HG4dQsjhuSd67/MuTx1J13Iu58Qmsve+dsmdaFUe 4T/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682617396; x=1685209396; 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=M9qC7sBNhWxjAncgjmRgJ8gGeWKYKrcTmTzOdQR/P6g=; b=MfRQbRDMzk3ubV+qJnauoTbwoZdkq4MulP+OCt5eNzZyYbmAoped/8irn1DdEN9m9G exyPpic2xfZakGw1d82HIr6j18NI9lE7CpawrKNPg7Idlzb06FdEWWQDZ+Ue4F+lwmNL viuoKED/AVXvk0mOv68muYdZkjEn5WkCHI9gtaFV4lVvkZ+R/HkmwWhrSxXUPGXzjhFq 0ANfalPSjy8Stikzuhy2YvKSWx00NuDh2nhx20HjtfUMM+yEG6L1H0ge30nyICNfSN0J r7vf3WuvH7phZ7+WkbQi+a6qjQHb2Fg0eh1dxRlE87vW1zU/OsrshuYbjGthgFh6rbTf OxTQ== X-Gm-Message-State: AC+VfDxrUIRUDUoy3ssRpjd5Nw6MWrYDNM+196B/CfX13uOpu7IMhV5G yse7LBuZsWGrGsPWtXZIzgM0gYZEPo4foGF7cWwa9F2uJPNQSwcsqRJJ7w0dh+P4lgKT8vZ7++i mNM9Bl8bP2wcYbRfqFzuZoUo/FoWLMNqr2BEI1xOQ8DYU3LEav4faQ+Jd X-Google-Smtp-Source: ACHHUZ4uYqkD+tvikWHb8aL4oRmy3aQ9c6pZqv9Quxg+gsIV989+3QlvI2ruFogVQmK5ltFdimmB9KY74n8= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a81:af27:0:b0:555:fecb:bd14 with SMTP id n39-20020a81af27000000b00555fecbbd14mr1645434ywh.4.1682617396403; Thu, 27 Apr 2023 10:43:16 -0700 (PDT) Date: Thu, 27 Apr 2023 17:43:08 +0000 In-Reply-To: <20230427174309.1479093-1-edliaw@google.com> Mime-Version: 1.0 References: <20230427174309.1479093-1-edliaw@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230427174309.1479093-2-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 0.102.4 at in-7.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-7.smtp.seeweb.it Subject: [LTP] [PATCH v2 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 returns 64, so when compiling with the 32bit abi, the test makes the fcntl syscall instead of fcntl64. The fcntl syscall is not compatible with the flock64 struct being passed on arm64 (x86_64 uses compat_sys_fcntl64 whereas arm64 uses sys_fcntl). Before 7643115aaacb, compiling with FILE_OFFSET_BITS=64 and the 32bit abi would also use fcntl instead of fcntl64. 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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h index 5c130a784..56e871167 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; @@ -26,8 +31,7 @@ struct my_flock64 { * pass the flock sturct directly to the kernel even if it had 32-bit * offsets. * - * Also, if and only if, we are on 32-bit kernel we need to use the - * fcntl64 compat syscall. + * If we are on 32-bit abi we need to use the fcntl64 compat syscall. * * See: * glibc: 06ab719d30 Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) @@ -43,8 +47,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; @@ -56,8 +60,7 @@ static inline int fcntl_compat(const char *file, const int line, const char *cmd return ret; tst_brk_(file, line, TBROK | TERRNO, - "%s(%d, %s, { %d, %d, %"PRId64", %"PRId64", %d })", - tst_kernel_bits() > 32 ? "fcntl" : "fcntl64", + "fcntl64(%d, %s, { %d, %d, %"PRId64", %"PRId64", %d })", fd, cmd_name, l64.l_type, l64.l_whence, l64.l_start, l64.l_len, l64.l_pid); @@ -67,5 +70,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 17:43:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1774581 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=jZHgZ0/1; 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 4Q6jlM32PBz23vC for ; Fri, 28 Apr 2023 03:43:43 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3AEA03CE941 for ; Thu, 27 Apr 2023 19:43:41 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (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 1BF7A3CE4CC for ; Thu, 27 Apr 2023 19:43:20 +0200 (CEST) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (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-4.smtp.seeweb.it (Postfix) with ESMTPS id ABBC91000369 for ; Thu, 27 Apr 2023 19:43:19 +0200 (CEST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-b9a77926afbso1808354276.3 for ; Thu, 27 Apr 2023 10:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682617398; x=1685209398; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uemwQjkNCufSx51G68cnVCAU6I2V5BzeNSAkQQiYb7I=; b=jZHgZ0/1oLYGREkgLzt9shNF+4k0GJPN90h8sGe5g4eiYFcD8ntd68xd3qFCsX/MlX DMTb8sFcWQS9LlNDdmfim7NIvogCy1UcRZuNauKOMIlWk385DwJivuXKwykeo3vbVgsK 1ZBoobwAZ1oASb1VsLZTLoNj23rbGNJCGdB+CKE4Dn/UVW9VZVN1s+ImeoGM2F/iH1RC pGZQeNegSO4lIV6U2hj/0Kqhl4f9x/RdNIvNVnr6Jq74sxuCG9xi2xrU/IzmT6c7fumZ 50H3z4jwD4SPk367lez2Iadw1/6qO8vLObRD04rHbQu0KuveBOYeZ+JiSJ76Hz+HyQ0a a9/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682617398; x=1685209398; 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=uemwQjkNCufSx51G68cnVCAU6I2V5BzeNSAkQQiYb7I=; b=VtPq4Dbh8dChr1/jrZbuE4ULb3qSNbDVAfDYijDFtUN4PAipCmT+CV3dPuuTgHfiPu 9XIa0quz+ueDR93CxEI7vwgX7XAvYUlfbJMEkUerYZzUk6rGszCApvhjyigXL8QKzFlN QJa9g4335Ac0Ad+NTKjhU2dH7aTneXs2U7kvoz13bEgGDMandxwtPZgvZfulyy16J6c7 HKph/bo8HJ12yOuIwm4vhV/nMdoo1n7c1nRQPn9H3f7Vis7UzutogClGZeVTrkiGPe/p tmLL/igXlwKPLC5GHucmRKcDGCs7df/Fdi5mj7hibP5Me3/vj0JGb/AmjY/oVc8VCEYm z0vA== X-Gm-Message-State: AC+VfDwzP/WMJuhoPjlsf2dM5NZ6Ewh1UbZsrhBePutCZ87/garUwUaR r+fhgFKlT4ythoK71ULmXei1VQVQAFos0okkPYP7o1CmiG6nBuJb4Oet2vhp9Yv8WDctEtoZYBS MWEDcC9y/WCRNTkNfb+86J+g+1X/JoPMBCqSXnQfEwnmGl1/8UtuNmzJq X-Google-Smtp-Source: ACHHUZ6wF9CduLzhuR91ge1UtmxpAb2OurigNFklrnfWvn8mJz+aEJX11oNvKStfp3BICKqOJHl7fAIE/jM= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a25:ca93:0:b0:b9a:7e67:5f38 with SMTP id a141-20020a25ca93000000b00b9a7e675f38mr1316295ybg.4.1682617398335; Thu, 27 Apr 2023 10:43:18 -0700 (PDT) Date: Thu, 27 Apr 2023 17:43:09 +0000 In-Reply-To: <20230427174309.1479093-1-edliaw@google.com> Mime-Version: 1.0 References: <20230427174309.1479093-1-edliaw@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230427174309.1479093-3-edliaw@google.com> To: ltp@lists.linux.it X-Virus-Scanned: clamav-milter 0.102.4 at in-4.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-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 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 Reviewed-by: Petr Vorel Tested-by: Petr Vorel --- 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 56e871167..86f2726af 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 };