git: f77d37cffdf3 - main - linuxulator: Return EINVAL for invalid inotify flags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 01 Jun 2026 18:42:52 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=f77d37cffdf3951b7f28b97005467241aa27c183
commit f77d37cffdf3951b7f28b97005467241aa27c183
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-06-01 18:22:09 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-06-01 18:42:38 +0000
linuxulator: Return EINVAL for invalid inotify flags
We implement all of the currently-defined Linux inotify mask bits and
flags, with the same values as Linux. Return EINVAL for unknown bits,
as Linux does.
This also moves the translation inline into linux_inotify_add_watch.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57387
---
sys/compat/linux/linux_file.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 30e79a53ad2a..9a1f21d5feb7 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -2034,23 +2034,17 @@ _Static_assert(LINUX_IN_ONESHOT == IN_ONESHOT,
_Static_assert(LINUX_IN_EXCL_UNLINK == IN_EXCL_UNLINK,
"IN_EXCL_UNLINK mismatch");
-static int
-linux_inotify_watch_flags(int l_flags)
-{
- if ((l_flags & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
- linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
- l_flags);
- }
-
- return (l_flags);
-}
-
int
linux_inotify_add_watch(struct thread *td,
struct linux_inotify_add_watch_args *args)
{
+ if ((args->mask & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
+ linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
+ args->mask);
+ return (EINVAL);
+ }
return (kern_inotify_add_watch(args->fd, AT_FDCWD, args->pathname,
- linux_inotify_watch_flags(args->mask), td));
+ args->mask, td));
}
int