git: 30c85b7cb9fc - main - linuxulator: return EBADF for O_PATH mmap()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 May 2026 19:50:10 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=30c85b7cb9fc52492f2b3a3ae4e0b16ed717c58a
commit 30c85b7cb9fc52492f2b3a3ae4e0b16ed717c58a
Author: YAO, Xin <mr.yaoxin@outlook.com>
AuthorDate: 2026-05-07 06:39:16 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-05-28 19:47:04 +0000
linuxulator: return EBADF for O_PATH mmap()
This fixes LTP open13, which expects O_PATH mmap() to fail
with EBADF, but FreeBSD returned EACCES.
Signed-off-by: YAO, Xin <mr.yaoxin@outlook.com>
PR: 295571
Reviewed by: kib
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2233
---
sys/compat/linux/linux_mmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c
index a8e790a29da4..9fecb6ebb2ad 100644
--- a/sys/compat/linux/linux_mmap.c
+++ b/sys/compat/linux/linux_mmap.c
@@ -63,6 +63,10 @@ static int
linux_mmap_check_fp(struct file *fp, int flags, int prot, int maxprot)
{
+ /* Linux returns EBADF if mmap() is called on an O_PATH file descriptor */
+ if (fp->f_ops == &path_fileops)
+ return (EBADF);
+
/* Linux mmap() just fails for O_WRONLY files */
if ((fp->f_flag & FREAD) == 0)
return (EACCES);