Skip to contentSkip to conversation

fanotify.7: wfix

PATCH In review Amir Goldstein 2 participants 9 messages Mar 31, 2025 – Apr 2, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 fanotify.7: wfix

Since the introduction of the FAN_AUDIT response flag, the response field of fanotify_response is no longer an enum it is now a bitmask, so fix the wording around FAN_ALLOW and FAN_DENY.

---
 man/man7/fanotify.7 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man/man7/fanotify.7 +1 -1
index a5ddf1df0..ad864b762 100644
@@ -769,7 +769,7 @@ This is the file descriptor from the structure
 .TP
 .I response
 This field indicates whether or not the permission is to be granted.
-Its value must be either
+Its value must contain either the flag
 .B FAN_ALLOW
 to allow the file operation or
 .B FAN_DENY
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/3 fanotify.7: Document FAN_RESPONSE_INFO_AUDIT_RULE

Document FAN_RESPONSE_INFO_AUDIT_RULE extended response info record that was added in v6.3.

Cc Jan Kara <[email protected]>
Cc Richard Guy Briggs <[email protected]>
---
 man/man7/fanotify.7 | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
man/man7/fanotify.7 +43 -0
index ad864b762..863578bd7 100644
@@ -787,6 +787,49 @@ flag can be set in the
 field.
 In that case, the audit subsystem will log information about the access
 decision to the audit logs.
+.P
+Since Linux 6.3,
+.\" commit 70529a199574c15a40f46b14256633b02ba10ca2
+the
+.B FAN_INFO
+flag can be set in the
+.I .response
+field.
+It indicates that an extra variable-length response record follows the
+.I fanotify_response
+structure.
+Extra response records start with a common header:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_header {
+    __u8 type;
+    __u8 pad;
+    __u16 len;
+};
+.EE
+.in
+.P
+The value of
+.I .type
+determines the format of the extra response record.
+In case the value of
+.I .type
+is
+.BR FAN_RESPONSE_INFO_AUDIT_RULE ,
+the following response record is expected
+with extra details for the audit log:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_audit_rule {
+    struct fanotify_response_info_header hdr;
+    __u32 rule_number;
+    __u32 subj_trust;
+    __u32 obj_trust;
+};
+.EE
+.in
 .\"
 .SS Monitoring filesystems for errors
 A single
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 2/3] fanotify.7: Document FAN_RESPONSE_INFO_AUDIT_RULE

Hi Amir,

Quoted 38 lines · Amir Goldstein

Document FAN_RESPONSE_INFO_AUDIT_RULE extended response info record that was added in v6.3.

Cc Jan Kara <[email protected]>
Cc Richard Guy Briggs <[email protected]>
---
 man/man7/fanotify.7 | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
man/man7/fanotify.7 +20 -0
index ad864b762..863578bd7 100644
@@ -787,6 +787,49 @@ flag can be set in the
 field.
 In that case, the audit subsystem will log information about the access
 decision to the audit logs.
+.P
+Since Linux 6.3,
+.\" commit 70529a199574c15a40f46b14256633b02ba10ca2
+the
+.B FAN_INFO
+flag can be set in the
+.I .response
+field.
+It indicates that an extra variable-length response record follows the
+.I fanotify_response
+structure.
+Extra response records start with a common header:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_header {
+    __u8 type;
+    __u8 pad;
+    __u16 len;
+};

man/man7/fanotify.7 flag can be set in the · line 819

Quoted 10 lines
man/man7/fanotify.7 +10 -0
+.EE
+.in
+.P
+The value of
+.I .type
+determines the format of the extra response record.
+In case the value of
+.I .type
+is
+.BR FAN_RESPONSE_INFO_AUDIT_RULE ,

How about making this more schematic? I'm thinking of the following (see diff for both the source code and the rendered page).

Cheers,
Alex

$ git diff
man/man7/fanotify.7 +4 -6
index 863578bd7..4b1e2c215 100644
@@ -813,13 +813,11 @@ .SS Dealing with permission events
 The value of
 .I .type
 determines the format of the extra response record.
-In case the value of
-.I .type
-is
-.BR FAN_RESPONSE_INFO_AUDIT_RULE ,
-the following response record is expected
+.TP
+.BR FAN_RESPONSE_INFO_AUDIT_RULE
+The following response record is expected
 with extra details for the audit log:
-.P
+.IP
 .in +4n
 .EX
 struct fanotify_response_info_audit_rule {
$ MANWIDTH=72 diffman-git 
--- HEAD:man/man7/fanotify.7
+++ ./man/man7/fanotify.7
@@ -539,16 +539,18 @@
          };

The value of .type determines the format of the extra response

-     record.   In  case  the  value  of  .type is FAN_RESPONSE_INFO_AU‐
-     DIT_RULE, the following response record is expected with extra de‐
-     tails for the audit log:
+     record.

- struct fanotify_response_info_audit_rule {

-             struct fanotify_response_info_header hdr;
-             __u32 rule_number;
-             __u32 subj_trust;
-             __u32 obj_trust;

- };
+ FAN_RESPONSE_INFO_AUDIT_RULE
+ The following response record is expected with extra de‐
+ tails for the audit log:
+
+ struct fanotify_response_info_audit_rule {

+                    struct fanotify_response_info_header hdr;
+                    __u32 rule_number;
+                    __u32 subj_trust;
+                    __u32 obj_trust;

+ };

Monitoring filesystems for errors
A single FAN_FS_ERROR event is stored per filesystem at once. Ex‐

Quoted 19 lines
man/man7/fanotify.7 +13 -0
+the following response record is expected
+with extra details for the audit log:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_audit_rule {
+    struct fanotify_response_info_header hdr;
+    __u32 rule_number;
+    __u32 subj_trust;
+    __u32 obj_trust;
+};
+.EE
+.in
 .\"
 .SS Monitoring filesystems for errors
 A single
Signature · 1 line
2.34.1
Signature · 1 line
<https://www.alejandro-colomar.es/>
#3 lore raw

Re: [PATCH v2 2/3] fanotify.7: Document FAN_RESPONSE_INFO_AUDIT_RULE

Quoted 105 lines · Alejandro Colomar

Hi Amir,

Quoted 38 lines · Amir Goldstein

Document FAN_RESPONSE_INFO_AUDIT_RULE extended response info record that was added in v6.3.

Cc Jan Kara <[email protected]>
Cc Richard Guy Briggs <[email protected]>
---
 man/man7/fanotify.7 | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
man/man7/fanotify.7 +20 -0
index ad864b762..863578bd7 100644
@@ -787,6 +787,49 @@ flag can be set in the
 field.
 In that case, the audit subsystem will log information about the access
 decision to the audit logs.
+.P
+Since Linux 6.3,
+.\" commit 70529a199574c15a40f46b14256633b02ba10ca2
+the
+.B FAN_INFO
+flag can be set in the
+.I .response
+field.
+It indicates that an extra variable-length response record follows the
+.I fanotify_response
+structure.
+Extra response records start with a common header:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_header {
+    __u8 type;
+    __u8 pad;
+    __u16 len;
+};

man/man7/fanotify.7 flag can be set in the · line 819

Quoted 10 lines
man/man7/fanotify.7 +10 -0
+.EE
+.in
+.P
+The value of
+.I .type
+determines the format of the extra response record.
+In case the value of
+.I .type
+is
+.BR FAN_RESPONSE_INFO_AUDIT_RULE ,

How about making this more schematic? I'm thinking of the following (see diff for both the source code and the rendered page).

Cheers,
Alex

$ git diff
man/man7/fanotify.7 +4 -6
index 863578bd7..4b1e2c215 100644
@@ -813,13 +813,11 @@ .SS Dealing with permission events
 The value of
 .I .type
 determines the format of the extra response record.
-In case the value of
-.I .type
-is
-.BR FAN_RESPONSE_INFO_AUDIT_RULE ,
-the following response record is expected
+.TP
+.BR FAN_RESPONSE_INFO_AUDIT_RULE
+The following response record is expected
 with extra details for the audit log:
-.P
+.IP
 .in +4n
 .EX
 struct fanotify_response_info_audit_rule {
$ MANWIDTH=72 diffman-git
man/man7/fanotify.7 renamed from man7/fanotify.7 +4 -9
@@ -539,16 +539,18 @@
          };
 
      The value of .type determines the format  of  the  extra  response
-     record.   In  case  the  value  of  .type is FAN_RESPONSE_INFO_AU‐
-     DIT_RULE, the following response record is expected with extra de‐
-     tails for the audit log:
+     record.
 
-         struct fanotify_response_info_audit_rule {
-             struct fanotify_response_info_header hdr;
-             __u32 rule_number;
-             __u32 subj_trust;
-             __u32 obj_trust;
-         };
+     FAN_RESPONSE_INFO_AUDIT_RULE
+            The  following  response  record is expected with extra de‐
+            tails for the audit log:

man/man7/fanotify.7 line 556

Quoted 10 lines
man/man7/fanotify.7 renamed from man7/fanotify.7 +7 -0
+
+                struct fanotify_response_info_audit_rule {
+                    struct fanotify_response_info_header hdr;
+                    __u32 rule_number;
+                    __u32 subj_trust;
+                    __u32 obj_trust;
+                };
 
    Monitoring filesystems for errors
      A single FAN_FS_ERROR event is stored per filesystem at once.  Ex‐

I think this is nicer.
Feel free to apply your version.

While at it, you may want to consider a similar reformatting to the section describing the extra information records in events starting with:

"Information records are supplemental pieces of information..."

and then with:

"Information records that are supplied alongside..."

I know making an order in this would be too much for me...

Thanks,
Amir.

#4 lore raw

Re: [PATCH v2 2/3] fanotify.7: Document FAN_RESPONSE_INFO_AUDIT_RULE

Hi Amir,

Quoted 70 lines · Amir Goldstein
Quoted 52 lines

How about making this more schematic? I'm thinking of the following (see diff for both the source code and the rendered page).

Cheers,
Alex

$ git diff
man/man7/fanotify.7 +4 -6
index 863578bd7..4b1e2c215 100644
@@ -813,13 +813,11 @@ .SS Dealing with permission events
 The value of
 .I .type
 determines the format of the extra response record.
-In case the value of
-.I .type
-is
-.BR FAN_RESPONSE_INFO_AUDIT_RULE ,
-the following response record is expected
+.TP
+.BR FAN_RESPONSE_INFO_AUDIT_RULE
+The following response record is expected
 with extra details for the audit log:
-.P
+.IP
 .in +4n
 .EX
 struct fanotify_response_info_audit_rule {
$ MANWIDTH=72 diffman-git
man/man7/fanotify.7 renamed from man7/fanotify.7 +4 -9
@@ -539,16 +539,18 @@
          };
 
      The value of .type determines the format  of  the  extra  response
-     record.   In  case  the  value  of  .type is FAN_RESPONSE_INFO_AU‐
-     DIT_RULE, the following response record is expected with extra de‐
-     tails for the audit log:
+     record.
 
-         struct fanotify_response_info_audit_rule {
-             struct fanotify_response_info_header hdr;
-             __u32 rule_number;
-             __u32 subj_trust;
-             __u32 obj_trust;
-         };
+     FAN_RESPONSE_INFO_AUDIT_RULE
+            The  following  response  record is expected with extra de‐
+            tails for the audit log:

man/man7/fanotify.7 line 556

Quoted 10 lines
man/man7/fanotify.7 renamed from man7/fanotify.7 +7 -0
+
+                struct fanotify_response_info_audit_rule {
+                    struct fanotify_response_info_header hdr;
+                    __u32 rule_number;
+                    __u32 subj_trust;
+                    __u32 obj_trust;
+                };
 
    Monitoring filesystems for errors
      A single FAN_FS_ERROR event is stored per filesystem at once.  Ex‐

I think this is nicer.
Feel free to apply your version.

While at it, you may want to consider a similar reformatting to the section describing the extra information records in events starting with:

Quoted 5 lines

"Information records are supplemental pieces of information..."

and then with:

"Information records that are supplied alongside..."

Thanks! I will.

Cheers,
Alex

Quoted 5 lines

I know making an order in this would be too much for me...

Thanks,
Amir.

Signature · 1 line
<https://www.alejandro-colomar.es/>
#5 lore raw

Re: [PATCH v2 2/3] fanotify.7: Document FAN_RESPONSE_INFO_AUDIT_RULE

In reply to Amir Goldstein

Hi Amir,

Quoted 113 lines · Amir Goldstein
Quoted 112 lines · Alejandro Colomar

Hi Amir,

Quoted 38 lines · Amir Goldstein

Document FAN_RESPONSE_INFO_AUDIT_RULE extended response info record that was added in v6.3.

Cc Jan Kara <[email protected]>
Cc Richard Guy Briggs <[email protected]>
---
 man/man7/fanotify.7 | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
man/man7/fanotify.7 +20 -0
index ad864b762..863578bd7 100644
@@ -787,6 +787,49 @@ flag can be set in the
 field.
 In that case, the audit subsystem will log information about the access
 decision to the audit logs.
+.P
+Since Linux 6.3,
+.\" commit 70529a199574c15a40f46b14256633b02ba10ca2
+the
+.B FAN_INFO
+flag can be set in the
+.I .response
+field.
+It indicates that an extra variable-length response record follows the
+.I fanotify_response
+structure.
+Extra response records start with a common header:
+.P
+.in +4n
+.EX
+struct fanotify_response_info_header {
+    __u8 type;
+    __u8 pad;
+    __u16 len;
+};

man/man7/fanotify.7 flag can be set in the · line 819

Quoted 10 lines
man/man7/fanotify.7 +10 -0
+.EE
+.in
+.P
+The value of
+.I .type
+determines the format of the extra response record.
+In case the value of
+.I .type
+is
+.BR FAN_RESPONSE_INFO_AUDIT_RULE ,

How about making this more schematic? I'm thinking of the following (see diff for both the source code and the rendered page).

Cheers,
Alex

$ git diff
man/man7/fanotify.7 +4 -6
index 863578bd7..4b1e2c215 100644
@@ -813,13 +813,11 @@ .SS Dealing with permission events
 The value of
 .I .type
 determines the format of the extra response record.
-In case the value of
-.I .type
-is
-.BR FAN_RESPONSE_INFO_AUDIT_RULE ,
-the following response record is expected
+.TP
+.BR FAN_RESPONSE_INFO_AUDIT_RULE
+The following response record is expected
 with extra details for the audit log:
-.P
+.IP
 .in +4n
 .EX
 struct fanotify_response_info_audit_rule {
$ MANWIDTH=72 diffman-git
man/man7/fanotify.7 renamed from man7/fanotify.7 +11 -9
@@ -539,16 +539,18 @@
          };
 
      The value of .type determines the format  of  the  extra  response
-     record.   In  case  the  value  of  .type is FAN_RESPONSE_INFO_AU‐
-     DIT_RULE, the following response record is expected with extra de‐
-     tails for the audit log:
+     record.
 
-         struct fanotify_response_info_audit_rule {
-             struct fanotify_response_info_header hdr;
-             __u32 rule_number;
-             __u32 subj_trust;
-             __u32 obj_trust;
-         };
+     FAN_RESPONSE_INFO_AUDIT_RULE
+            The  following  response  record is expected with extra de‐
+            tails for the audit log:
+
+                struct fanotify_response_info_audit_rule {
+                    struct fanotify_response_info_header hdr;
+                    __u32 rule_number;
+                    __u32 subj_trust;
+                    __u32 obj_trust;
+                };
 
Quoted 6 lines

man/man7/fanotify.7 line 556

Quoted 3 lines
man/man7/fanotify.7 renamed from man7/fanotify.7 +0 -0
    Monitoring filesystems for errors
      A single FAN_FS_ERROR event is stored per filesystem at once.  Ex‐

I think this is nicer.
Feel free to apply your version.

I have applied your patch amended with my diff.

Cheers,
Alex

Quoted 15 lines

While at it, you may want to consider a similar reformatting to the section describing the extra information records in events starting with:

"Information records are supplemental pieces of information..."

and then with:

"Information records that are supplied alongside..."

I know making an order in this would be too much for me...

Thanks,
Amir.

Signature · 3 lines
<https://www.alejandro-colomar.es/>
<https://www.alejandro-colomar.es:8443/>
<http://www.alejandro-colomar.es:8080/>
#6 lore raw

PATCH v2 3/3 fanotify.7: Document FAN_DENY_ERRNO()

In reply to Amir Goldstein

Document FAN_DENY_ERRNO(), that was added in v6.13 to report specific errors on file access.

---

Changes since v1:
- Split out to 3 patches
- Add example of FAN_DENY_ERRNO

 man/man7/fanotify.7 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
man/man7/fanotify.7 +22 -0
index 863578bd7..a532a963a 100644
@@ -778,6 +778,28 @@ to deny the file operation.
 If access is denied, the requesting application call will receive an
 .B EPERM
 error.
+Since Linux 6.13,
+.\" commit b4b2ff4f61ded819bfa22e50fdec7693f51cbbee
+if a notification group is initialized with class
+.BR FAN_CLASS_PRE_CONTENT ,
+the file operation can be denied with errors other than
+.BR EPERM .
+For example, for the requesting application to get the
+.B EIO
+error, the event listener can write the response
+.BR FAN_DENY_ERRNO ( EIO ).
+At the time of writing,
+only the following error values could be returned to the application with
+.BR FAN_DENY_ERRNO
+macro:
+.BR EPERM ,
+.BR EIO ,
+.BR EBUSY ,
+.BR ETXTBSY ,
+.BR EAGAIN ,
+.BR ENOSPC ,
+.BR EDQUOT .
+.P
 Additionally, if the notification group has been created with the
 .B FAN_ENABLE_AUDIT
 flag, then the
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH v2 3/3] fanotify.7: Document FAN_DENY_ERRNO()

Hi Amir,

Quoted 7 lines · Amir Goldstein

Document FAN_DENY_ERRNO(), that was added in v6.13 to report specific errors on file access.

---

Thanks! I've applied the patch.

Cheers,
Alex

Quoted 44 lines

Changes since v1:
- Split out to 3 patches
- Add example of FAN_DENY_ERRNO

 man/man7/fanotify.7 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
man/man7/fanotify.7 +22 -0
index 863578bd7..a532a963a 100644
@@ -778,6 +778,28 @@ to deny the file operation.
 If access is denied, the requesting application call will receive an
 .B EPERM
 error.
+Since Linux 6.13,
+.\" commit b4b2ff4f61ded819bfa22e50fdec7693f51cbbee
+if a notification group is initialized with class
+.BR FAN_CLASS_PRE_CONTENT ,
+the file operation can be denied with errors other than
+.BR EPERM .
+For example, for the requesting application to get the
+.B EIO
+error, the event listener can write the response
+.BR FAN_DENY_ERRNO ( EIO ).
+At the time of writing,
+only the following error values could be returned to the application with
+.BR FAN_DENY_ERRNO
+macro:
+.BR EPERM ,
+.BR EIO ,
+.BR EBUSY ,
+.BR ETXTBSY ,
+.BR EAGAIN ,
+.BR ENOSPC ,
+.BR EDQUOT .
+.P
 Additionally, if the notification group has been created with the
 .B FAN_ENABLE_AUDIT
 flag, then the
Signature · 1 line
2.34.1
Signature · 1 line
<https://www.alejandro-colomar.es/>
#8 lore raw
In reply to Amir Goldstein

Hi Amir,

Quoted 6 lines · Amir Goldstein

Since the introduction of the FAN_AUDIT response flag, the response field of fanotify_response is no longer an enum it is now a bitmask, so fix the wording around FAN_ALLOW and FAN_DENY.

Thanks! I've applied the patch. BTW, I've reworded the subject:

man/man7/fanotify.7: The response field is now a bit mask instead of an enum

Cheers,
Alex

Quoted 20 lines
---
 man/man7/fanotify.7 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man/man7/fanotify.7 +1 -1
index a5ddf1df0..ad864b762 100644
@@ -769,7 +769,7 @@ This is the file descriptor from the structure
 .TP
 .I response
 This field indicates whether or not the permission is to be granted.
-Its value must be either
+Its value must contain either the flag
 .B FAN_ALLOW
 to allow the file operation or
 .B FAN_DENY
Signature · 1 line
2.34.1
Signature · 1 line
<https://www.alejandro-colomar.es/>