mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Disha Goel <disgoel@linux.ibm.com>
To: shuah@kernel.org
Cc: aleksa@amutable.com, brauner@kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Disha Goel <disgoel@linux.ibm.com>
Subject: [PATCH 1/2] selftests/filesystems/openat2: fix O_LARGEFILE definitions for non-arm64 architectures
Date: Thu, 17 Sep 2026 15:27:05 +0530	[thread overview]
Message-ID: <20260917095707.16986-1-disgoel@linux.ibm.com> (raw)

The openat2_test.c code previously hardcoded O_LARGEFILE to 0x8000 on
all architectures other than arm64 (aarch64).

However, on several architectures this value is different. For example,
on PowerPC (including ppc64le), O_LARGEFILE is defined as 0x10000,
whereas 0x8000 is actually O_NOFOLLOW.

This mismatch caused the flag_validation test case to pass
O_PATH | O_NOFOLLOW instead of O_PATH | O_LARGEFILE. Since
O_PATH | O_NOFOLLOW is a valid and compatible flag combination, the
kernel successfully opened the file instead of failing with -EINVAL,
causing a false test failure on PowerPC.

Fix this by introducing proper architecture-specific definitions for
O_LARGEFILE matching their respective UAPI asm/fcntl.h values.

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
 .../selftests/filesystems/openat2/openat2_test.c       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/filesystems/openat2/openat2_test.c b/tools/testing/selftests/filesystems/openat2/openat2_test.c
index 6f5afbe2d8d3..e08c94ce0530 100644
--- a/tools/testing/selftests/filesystems/openat2/openat2_test.c
+++ b/tools/testing/selftests/filesystems/openat2/openat2_test.c
@@ -23,8 +23,16 @@
  * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
  */
 #undef	O_LARGEFILE
-#ifdef __aarch64__
+#if defined(__aarch64__) || defined(__alpha__)
 #define	O_LARGEFILE 0x20000
+#elif defined(__powerpc__) || defined(__ppc__)
+#define	O_LARGEFILE 0x10000
+#elif defined(__sparc__)
+#define O_LARGEFILE 0x40000
+#elif defined(__mips__)
+#define O_LARGEFILE 0x2000
+#elif defined(__parisc__)
+#define O_LARGEFILE 0x800
 #else
 #define	O_LARGEFILE 0x8000
 #endif
-- 
2.45.1


             reply	other threads:[~2026-09-17  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  9:57 Disha Goel [this message]
2026-09-17  9:57 ` [PATCH 2/2] selftests/filesystems/openat2: make /tmp a mountpoint inside private namespace Disha Goel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260917095707.16986-1-disgoel@linux.ibm.com \
    --to=disgoel@linux.ibm.com \
    --cc=aleksa@amutable.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®