From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6B772D47E1 for ; Tue, 27 Jan 2026 18:01:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769536891; cv=none; b=Vkg9SkJTEIcpoW+BnGNsCuSAl08cO33EZfglXJPLtdgfsa0SLn3Yrzdl5PaSJkYyJuPnhoe3eswpw0LaSGswCarL9VLjGrFD77xPcKUrwrANUC105rMinjTfDsWapuB4zE8pLzaWXPdqZXNv5Ccv1Tw3IflRbrG8ncZe95Xb4Ek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769536891; c=relaxed/simple; bh=ZM2PfF7OtpvnUz9E7RLzRHHGg4FnN/x9LbgwS06hhgU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WCPiE/muDkrVtUjVDqubcckHiphg1NIxJpHfgeokExRSeS4Wln5lLxVUQf8Of+FS2JY0UXhgDduQogT2K7eSOp1I7RJo1bLMaHOi9MsVmv+S7qUSfmEEC+pAKnbnL7k3cqkPf9CCf/FeQvLrM6xnWwA0ZciKXE39PzQPOCKWBAc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nVOwcHkj; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nVOwcHkj" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-34c1d98ba11so5086291a91.3 for ; Tue, 27 Jan 2026 10:01:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769536890; x=1770141690; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AHiQlC7luusLUwQrvl8no0ei3loryI/DAP75t23pbw0=; b=nVOwcHkjM9ePdK1VGXshYlSGQrysJ5p3hSEKEpX2gh3/vfdVqVjjMf9+tpw7g5eJaN LgO+THNzuPXg6bH5M0L4PqGD+yxdAd0uN9g67RKSUGgELCuoOLm4B1+OuwMANMx390XI Syj8C8TRt2RdXPjPGUWyWCN8MJ8j16g2MM9XExXx/HhSs0YhwO21bbJXcfKofbdPVVwJ 5EI+oNw8KAUeNJ9mdd2UvWeniAbVso9sAywY2dl0SB3EBBXMNzytxDO1pnYEAsDn5evs 5oTVvx7ooObOUMeA8b9V7l8AJTSdsyUOsRfMzUgP/RVdRum2jEg/6pPv1VfsMnWfPK3a sf6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769536890; x=1770141690; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AHiQlC7luusLUwQrvl8no0ei3loryI/DAP75t23pbw0=; b=R5//Cig/Cybfc0GlTQZW5FkMJeljNU/suEDBJMieW8AOZIfeWcDgVY2QX3noXS8pny NhW5mh+/NIB3VYAavHjO2THwPFWiUfmIrkUcSkz9DH5t7vDOtbBwJWJTkfQr4p2pSFPy GZXqZ+86f2Y+MeYiZ6WPJrpw2SU7y36n1m+/hH6GAfbgSQGhMBzwtdzZwpAMNLbSD3is 5X3G+LpnP7Db+TnsT/mRygk9BLfkvm/1q2NanVBDflFM+a1hzlZCW/uJbka2D2SEvPSA DKX3oECqGnEvA56o8f5IHRrW79A/n/zuVY8NEtkbNSsVaY9qkEb8k1F52mBIObTnbiXu NIhA== X-Gm-Message-State: AOJu0Yy6MECPXWq9sawwFw+BNL1gmgqHIhxr3NWaNOAPKNKRy1WmWWPC tKT/JZA2tyiPWZog7fwf7M3sxvdeXLa5vBX2LyLvFkcM0m879cz4JSR6 X-Gm-Gg: AZuq6aK8hAnDfUmN5FrKcrmvskpXSC0emHsktz9YnH/y/Oi37bgL3qmpoFYXlCwlNuL iyGn+w/pRV24or845108iAk1K8g6DlhfGtGBulR92h/fpgECAlqW2LVYtC2iaCT28VX/F3/wusK eATts9YDORGD4d/J4avCPvC9k04RK7EgquQuG8ovYcG+VaE+14g0u8borN07x8TX5QoAL4g2ZwK bkx2Kd4SdmKFCMfEvHrLBAGl0ozqywksLYAucSu5piOfHvkIMGo7K61NqLXvee69daFxojv20Xl rkERpJmgb/Dd0pj0KUOHWmmNoi7HOEkC3L1ULqlH/PCa6AOByXWH56AHAyITofUAdXClFTCmXiR lEjpwv0SZXkgMsL8eQtj9N8l55M9fn7H/bZy2x+q7y5m0s7gYdY2VjKFQSaI3rLaWa2Dk1BZuNq kkE9LF+l+zPTQuRZR7Cc/a+BtSlOvPhopYIqLDP7ZB36I= X-Received: by 2002:a17:90b:1fcc:b0:352:cd8e:3ead with SMTP id 98e67ed59e1d1-353feccd3f9mr2018770a91.10.1769536889714; Tue, 27 Jan 2026 10:01:29 -0800 (PST) Received: from toolbx ([103.230.182.3]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379b1bc68sm216891b3a.2.2026.01.27.10.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 10:01:29 -0800 (PST) From: Dorjoy Chowdhury 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 Message-ID: <20260127180109.66691-1-dorjoychy111@gmail.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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