From: Dorjoy Chowdhury <dorjoychy111@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
brauner@kernel.org, jack@suse.cz, jlayton@kernel.org,
chuck.lever@oracle.com, alex.aring@gmail.com, arnd@arndb.de,
adilger@dilger.ca
Subject: [PATCH v3 0/4] O_REGULAR flag support for open
Date: Tue, 27 Jan 2026 23:58:16 +0600 [thread overview]
Message-ID: <20260127180109.66691-1-dorjoychy111@gmail.com> (raw)
Changes in v3:
- included motivation about O_REGULAR flag in commit message e.g., programs not wanting to be tricked into opening device nodes
- fixed commit message wrongly referencing ENOTREGULAR instead of ENOTREG
- fixed the O_REGULAR flag in arch/parisc/include/uapi/asm/fcntl.h from 060000000 to 0100000000
- added 2 commits converting arch/{mips,sparc}/include/uapi/asm/fcntl.h O_* macros from hex to octal
- v2 is at: https://lore.kernel.org/linux-fsdevel/20260126154156.55723-1-dorjoychy111@gmail.com/T/
Changes in v2:
- rename ENOTREGULAR to ENOTREG
- define ENOTREG in uapi/asm-generic/errno.h (instead of errno-base.h) and in arch/*/include/uapi/asm/errno.h files
- override O_REGULAR in arch/{alpha,sparc,parisc}/include/uapi/asm/fcntl.h due to clash with include/uapi/asm-generic/fcntl.h
- I have kept the kselftest but now that O_REGULAR and ENOTREG can have different value on different architectures I am not sure if it's right
- v1 is at: https://lore.kernel.org/linux-fsdevel/20260125141518.59493-1-dorjoychy111@gmail.com/T/
Hi,
I came upon this "Ability to only open regular files" uapi feature suggestion
from https://uapi-group.org/kernel-features/#ability-to-only-open-regular-files
and thought it would be something I could do as a first patch and get to
know the kernel code a bit better.
I am not quite sure if the semantics that I baked into the code for this
O_REGULAR flag's behavior when combined with other flags like O_CREAT look
good and if there are other places that need the checks. I can fixup my
patch according to suggestions for improvement. I did some happy path testing
and the O_REGULAR flag seems to work as intended.
Thanks.
Regards,
Dorjoy
Dorjoy Chowdhury (4):
open: new O_REGULAR flag support
kselftest/openat2: test for O_REGULAR flag
sparc/fcntl.h: convert O_* flag macros from hex to octal
mips/fcntl.h: convert O_* flag macros from hex to octal
arch/alpha/include/uapi/asm/errno.h | 2 +
arch/alpha/include/uapi/asm/fcntl.h | 1 +
arch/mips/include/uapi/asm/errno.h | 2 +
arch/mips/include/uapi/asm/fcntl.h | 22 +++++------
arch/parisc/include/uapi/asm/errno.h | 2 +
arch/parisc/include/uapi/asm/fcntl.h | 1 +
arch/sparc/include/uapi/asm/errno.h | 2 +
arch/sparc/include/uapi/asm/fcntl.h | 35 +++++++++---------
fs/fcntl.c | 2 +-
fs/namei.c | 6 +++
fs/open.c | 4 +-
include/linux/fcntl.h | 2 +-
include/uapi/asm-generic/errno.h | 2 +
include/uapi/asm-generic/fcntl.h | 4 ++
tools/arch/alpha/include/uapi/asm/errno.h | 2 +
tools/arch/mips/include/uapi/asm/errno.h | 2 +
tools/arch/parisc/include/uapi/asm/errno.h | 2 +
tools/arch/sparc/include/uapi/asm/errno.h | 2 +
tools/include/uapi/asm-generic/errno.h | 2 +
.../testing/selftests/openat2/openat2_test.c | 37 ++++++++++++++++++-
20 files changed, 102 insertions(+), 32 deletions(-)
--
2.52.0
next reply other threads:[~2026-01-27 18:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 17:58 Dorjoy Chowdhury [this message]
2026-01-27 17:58 ` [PATCH v3 1/4] open: new O_REGULAR flag support Dorjoy Chowdhury
2026-01-27 23:23 ` Aleksa Sarai
2026-01-28 7:12 ` Mateusz Guzik
2026-01-28 16:57 ` Dorjoy Chowdhury
2026-01-28 19:26 ` Aleksa Sarai
2026-01-27 23:52 ` Jeff Layton
2026-01-28 15:36 ` Dorjoy Chowdhury
2026-01-28 15:51 ` Jeff Layton
2026-01-28 16:29 ` Dorjoy Chowdhury
2026-01-29 12:33 ` Christian Brauner
2026-01-29 13:12 ` Jeff Layton
2026-01-29 13:42 ` Jeff Layton
2026-02-18 18:26 ` Dorjoy Chowdhury
2026-02-18 19:01 ` Jeff Layton
2026-02-18 19:19 ` Dorjoy Chowdhury
2026-02-18 19:32 ` Jeff Layton
2026-02-18 19:44 ` Dorjoy Chowdhury
2026-01-29 14:01 ` Jeff Layton
2026-01-29 10:49 ` Christian Brauner
2026-01-29 16:55 ` Dorjoy Chowdhury
2026-01-29 17:03 ` Aleksa Sarai
2026-01-29 17:41 ` Dorjoy Chowdhury
2026-01-27 17:58 ` [PATCH v3 2/4] kselftest/openat2: test for O_REGULAR flag Dorjoy Chowdhury
2026-01-27 17:58 ` [PATCH v3 3/4] sparc/fcntl.h: convert O_* flag macros from hex to octal Dorjoy Chowdhury
2026-01-27 17:58 ` [PATCH v3 4/4] mips/fcntl.h: " Dorjoy Chowdhury
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=20260127180109.66691-1-dorjoychy111@gmail.com \
--to=dorjoychy111@gmail.com \
--cc=adilger@dilger.ca \
--cc=alex.aring@gmail.com \
--cc=arnd@arndb.de \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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®