From: Amir Goldstein <amir73il@gmail.com>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>, Jan Kara <jack@suse.cz>,
Matthew Bobrowski <mbobrowski@mbobrowski.org>,
linux-man@vger.kernel.org
Subject: [PATCH v2 2/4] fanotify_init.2, fanotify_mark.2, fanotify.7: Configurable limits
Date: Sat, 20 Nov 2021 19:12:51 +0200 [thread overview]
Message-ID: <20211120171253.1385863-3-amir73il@gmail.com> (raw)
In-Reply-To: <20211120171253.1385863-1-amir73il@gmail.com>
Update documentation about the new configurable fanotify limits
that will be available from Linux kernel 5.13.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
man2/fanotify_init.2 | 22 ++++++++++++++++------
man2/fanotify_mark.2 | 5 ++++-
man7/fanotify.7 | 35 +++++++++++++++++++++++++++++++++--
3 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/man2/fanotify_init.2 b/man2/fanotify_init.2
index b2ceb17f3..0d83e817f 100644
--- a/man2/fanotify_init.2
+++ b/man2/fanotify_init.2
@@ -53,9 +53,10 @@ descriptor.
Multiple programs may be using the fanotify interface at the same time to
monitor the same files.
.PP
-In the current implementation, the number of fanotify groups per user is
-limited to 128.
-This limit cannot be overridden.
+The number of fanotify groups per user is limited.
+See
+.BR fanotify (7)
+for details about this limit.
.PP
The
.I flags
@@ -130,13 +131,19 @@ fails with the error
.BR EAGAIN .
.TP
.B FAN_UNLIMITED_QUEUE
-Remove the limit of 16384 events for the event queue.
+Remove the limit on the number of events in the event queue.
+See
+.BR fanotify (7)
+for details about this limit.
Use of this flag requires the
.B CAP_SYS_ADMIN
capability.
.TP
.B FAN_UNLIMITED_MARKS
-Remove the limit of 8192 marks.
+Remove the limit on the number of fanotify marks per user.
+See
+.BR fanotify (7)
+for details about this limit.
Use of this flag requires the
.B CAP_SYS_ADMIN
capability.
@@ -366,7 +373,10 @@ defines all allowable bits for
.IR flags .
.TP
.B EMFILE
-The number of fanotify groups for this user exceeds 128.
+The number of fanotify groups for this user exceeds the limit.
+See
+.BR fanotify (7)
+for details about this limit.
.TP
.B EMFILE
The per-process limit on the number of open file descriptors has been reached.
diff --git a/man2/fanotify_mark.2 b/man2/fanotify_mark.2
index 9cf71320c..cb69ac592 100644
--- a/man2/fanotify_mark.2
+++ b/man2/fanotify_mark.2
@@ -431,10 +431,13 @@ which is not marked.
The necessary memory could not be allocated.
.TP
.B ENOSPC
-The number of marks exceeds the limit of 8192 and the
+The number of marks for this user exceeds the limit and the
.B FAN_UNLIMITED_MARKS
flag was not specified when the fanotify file descriptor was created with
.BR fanotify_init (2).
+See
+.BR fanotify (7)
+for details about this limit.
.TP
.B ENOSYS
This kernel does not implement
diff --git a/man7/fanotify.7 b/man7/fanotify.7
index 9c66c24f0..455e3ed17 100644
--- a/man7/fanotify.7
+++ b/man7/fanotify.7
@@ -336,7 +336,7 @@ A file or directory that was opened read-only
was closed.
.TP
.B FAN_Q_OVERFLOW
-The event queue exceeded the limit of 16384 entries.
+The event queue exceeded the limit on number of events.
This limit can be overridden by specifying the
.BR FAN_UNLIMITED_QUEUE
flag when calling
@@ -606,7 +606,7 @@ are freed for reuse by the kernel.
Upon
.BR close (2),
outstanding permission events will be set to allowed.
-.SS /proc/[pid]/fdinfo
+.SS /proc interfaces
The file
.I /proc/[pid]/fdinfo/[fd]
contains information about fanotify marks for file descriptor
@@ -616,6 +616,37 @@ of process
See
.BR proc (5)
for details.
+.PP
+Since Linux 5.13,
+.\" commit 5b8fea65d197f408bb00b251c70d842826d6b70b
+the following interfaces can be used to control the amount of
+kernel resources consumed by fanotify:
+.TP
+.I /proc/sys/fs/fanotify/max_queued_events
+The value in this file is used when an application calls
+.BR fanotify_init (2)
+to set an upper limit on the number of events that can be
+queued to the corresponding fanotify group.
+Events in excess of this limit are dropped, but an
+.B FAN_Q_OVERFLOW
+event is always generated.
+Prior to Linux kernel 5.13,
+.\" commit 5b8fea65d197f408bb00b251c70d842826d6b70b
+the hardcoded limit was 16384 events.
+.TP
+.I /proc/sys/fs/fanotify/max_user_group
+This specifies an upper limit on the number of fanotify groups
+that can be created per real user ID.
+Prior to Linux kernel 5.13,
+.\" commit 5b8fea65d197f408bb00b251c70d842826d6b70b
+the hardcoded limit was 128 groups per user.
+.TP
+.I /proc/sys/fs/fanotify/max_user_marks
+This specifies an upper limit on the number of fanotify marks
+that can be created per real user ID.
+Prior to Linux kernel 5.13,
+.\" commit 5b8fea65d197f408bb00b251c70d842826d6b70b
+the hardcoded limit was 8192 marks per group (not per user).
.SH ERRORS
In addition to the usual errors for
.BR read (2),
--
2.33.1
next prev parent reply other threads:[~2021-11-20 17:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-20 17:12 [PATCH v2 0/4] fanotify man page updates for v5.13 Amir Goldstein
2021-11-20 17:12 ` [PATCH v2 1/4] fanotify_init.2, fanotify_mark.2: Document unprivileged listener Amir Goldstein
2021-11-20 17:19 ` Amir Goldstein
2021-11-20 17:12 ` Amir Goldstein [this message]
2021-11-20 17:19 ` [PATCH v2 2/4] fanotify_init.2, fanotify_mark.2, fanotify.7: Configurable limits Amir Goldstein
2021-11-20 17:12 ` [PATCH v2 3/4] fanotify_mark.2: Update w.r.t tmpfs support Amir Goldstein
2021-11-20 17:12 ` [PATCH v2 4/4] fanotify_init.2: Document kernel commits Amir Goldstein
2021-11-22 16:56 ` [PATCH v2 0/4] fanotify man page updates for v5.13 Alejandro Colomar (man-pages)
2021-12-10 9:37 ` Amir Goldstein
2021-12-10 13:56 ` Alejandro Colomar (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211120171253.1385863-3-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=alx.manpages@gmail.com \
--cc=jack@suse.cz \
--cc=linux-man@vger.kernel.org \
--cc=mbobrowski@mbobrowski.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox