The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e8b3eeb6096f01c12a5b42f0327c2066e91a640
commit 5e8b3eeb6096f01c12a5b42f0327c2066e91a640 Author: Ricardo Branco <rbra...@suse.de> AuthorDate: 2025-08-04 14:56:17 +0000 Commit: Mark Johnston <ma...@freebsd.org> CommitDate: 2025-08-12 21:45:24 +0000 kern: Allow O_CLOFORK to be passed to shm_open(2) Signed-off-by: Ricardo Branco <rbra...@suse.de> Reviewed by: kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1802 --- lib/libsys/shm_open.2 | 5 +++-- sys/kern/uipc_shm.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libsys/shm_open.2 b/lib/libsys/shm_open.2 index 8bea939690ba..c3196d966e6b 100644 --- a/lib/libsys/shm_open.2 +++ b/lib/libsys/shm_open.2 @@ -26,7 +26,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 30, 2023 +.Dd August 4, 2025 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -74,8 +74,9 @@ must be included in The optional flags .Dv O_CREAT , .Dv O_EXCL , +.Dv O_TRUNC , and -.Dv O_TRUNC +.Dv O_CLOFORK may also be specified. .Pp If diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 85fe48ddd466..eb1327f7f2de 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -1160,7 +1160,8 @@ kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode, if ((flags & O_ACCMODE) != O_RDONLY && (flags & O_ACCMODE) != O_RDWR) return (EINVAL); - if ((flags & ~(O_ACCMODE | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC)) != 0) + if ((flags & ~(O_ACCMODE | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC | + O_CLOFORK)) != 0) return (EINVAL); largepage = (shmflags & SHM_LARGEPAGE) != 0;