NetBSD Problem Report #60335
From www@netbsd.org Mon Jun 15 19:05:23 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2234E1A923A
for <gnats-bugs@gnats.NetBSD.org>; Mon, 15 Jun 2026 19:05:23 +0000 (UTC)
Message-Id: <20260615190522.180DE1A923B@mollari.NetBSD.org>
Date: Mon, 15 Jun 2026 19:05:22 +0000 (UTC)
From: contact+netbsd.org@hacktivis.me
Reply-To: contact+netbsd.org@hacktivis.me
To: gnats-bugs@NetBSD.org
Subject: fcntl.h in POSIX 2008 or later mode lacks O_EXEC
X-Send-Pr-Version: www-1.0
X-From4GNATS: "contact+netbsd.org@hacktivis.me via gnats" <gnats-admin@NetBSD.org>
>Number: 60335
>Category: standards
>Synopsis: fcntl.h in POSIX 2008 or later mode lacks O_EXEC
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: standards-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 15 19:10:01 +0000 2026
>Closed-Date: Tue Jun 16 11:02:12 +0000 2026
>Last-Modified: Tue Jun 16 11:02:12 +0000 2026
>Originator: Haelwenn Monnier
>Release: 10.0
>Organization:
>Environment:
NetBSD build 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
POSIX.1-2008 added O_EXEC to fcntl.h
>How-To-Repeat:
Use `#define _POSIX_C_SOURCE 200809L` without also defining `_NETBSD_SOURCE` and try to use O_EXEC.
>Fix:
Untested patch but very likely correct:
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -112,21 +112,21 @@
#define O_DIRECT 0x00080000 /* direct I/O hint */
#endif
#define O_DIRECTORY 0x00200000 /* fail if not a directory */
#define O_CLOEXEC 0x00400000 /* set close on exec */
#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
defined(_NETBSD_SOURCE)
#define O_SEARCH 0x00800000 /* skip search permission checks */
+#define O_EXEC 0x04000000 /* open for executing only */
#endif
#if defined(_NETBSD_SOURCE)
#define O_NOSIGPIPE 0x01000000 /* don't deliver sigpipe */
#define O_REGULAR 0x02000000 /* fail if not a regular file */
-#define O_EXEC 0x04000000 /* open for executing only */
#endif
#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \
defined(_NETBSD_SOURCE)
#define O_CLOFORK 0x08000000 /* set close on fork */
#endif
#ifdef _KERNEL
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->needs-pullups
State-Changed-By: kre@NetBSD.org
State-Changed-When: Mon, 15 Jun 2026 20:17:06 +0000
State-Changed-Why:
Needs pullups to NetBSD -9 -10 & -11
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60335 CVS commit: src/sys/sys
Date: Mon, 15 Jun 2026 20:16:29 +0000
Module Name: src
Committed By: kre
Date: Mon Jun 15 20:16:29 UTC 2026
Modified Files:
src/sys/sys: fcntl.h
Log Message:
PR standards/60335 -- expose O_EXEC for Posix I7 & beyond
XXX pullup -9 -10 -11
To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/sys/fcntl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: kre@NetBSD.org
State-Changed-When: Mon, 15 Jun 2026 20:42:49 +0000
State-Changed-Why:
[pullup-10 #1272] requested
[pullup-11 #312] requested
Despite earlier assertions, there will be no pullup to -9
which does not define (or implement) O_EXEC.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60335 CVS commit: [netbsd-11] src/sys/sys
Date: Tue, 16 Jun 2026 09:06:50 +0000
Module Name: src
Committed By: martin
Date: Tue Jun 16 09:06:50 UTC 2026
Modified Files:
src/sys/sys [netbsd-11]: fcntl.h
Log Message:
Pull up following revision(s) (requested by kre in ticket #312):
sys/sys/fcntl.h: revision 1.59
PR standards/60335 -- expose O_EXEC for Posix 7 & beyond
To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/sys/fcntl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60335 CVS commit: [netbsd-10] src/sys/sys
Date: Tue, 16 Jun 2026 09:08:13 +0000
Module Name: src
Committed By: martin
Date: Tue Jun 16 09:08:12 UTC 2026
Modified Files:
src/sys/sys [netbsd-10]: fcntl.h
Log Message:
Pull up following revision(s) (requested by kre in ticket #1272):
sys/sys/fcntl.h: revision 1.59
PR standards/60335 -- expose O_EXEC for Posix 7 & beyond
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.22.1 src/sys/sys/fcntl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Tue, 16 Jun 2026 11:02:12 +0000
State-Changed-Why:
Pullups completed. Thanks for the PR.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.