Skip to contentSkip to conversation

fanotify.7: BUGS, error handling in fanotify_read

PATCH In review Heinrich Schuchardt 3 participants 4 messages May 14, 2014 – May 15, 2014 4 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH v2 1/1 fanotify.7: BUGS, error handling in fanotify_read

The patch in
http://www.spinics.net/lists/linux-man/msg05589.html
was not accepted.

Michael Kerrisk suggested in a private mail to add a comment in the BUGS section.

---
 man7/fanotify.7 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
man7/fanotify.7 +12 -2
index 2a92908..c6cec7c 100644
@@ -164,7 +164,7 @@ so that multiple events can be retrieved by a single
 The return value of
 .BR read (2)
 is the number of bytes placed in the buffer,
-or \-1 in case of an error.
+or \-1 in case of an error (but see BUGS).
 
 The fields of the
 .I fanotify_event_metadata
@@ -468,7 +468,7 @@ The event queue can overflow.
 In this case, events are lost.
 .SH BUGS
 As of Linux 3.15,
-the following bug exists:
+the following bugs exists:
 .IP * 3
 .\" FIXME: A patch was proposed.
 When an event is generated,
@@ -478,6 +478,16 @@ before passing a file descriptor for that file.
 This poses a security risk, when the
 .B CAP_SYS_ADMIN
 capability is set for programs executed by unprivileged users.
+.IP *
+If a call to
+.BR read( 2 )
+processes multiple events from the fanotify queue and an error occurs, the
+return value will be the cumulated length of the events successfully copied to
+the user space buffer before the error occured.
+The return value will not be \-1.
+.I errno
+will not be set.
+Thus, the user program has no way to detect the error.
 .SH EXAMPLE
 The following program demonstrates the usage of the fanotify API.
 It marks the mount point passed as a command-line argument
Signature · 6 lines
2.0.0.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1400091016-17670-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org

#4 lore raw

[Expanded CC]

Jan, Eric,

Do you have any comments/additions for this man-pages patch?

Cheers,

Michael

Quoted 54 lines · Heinrich Schuchardt

The patch in
http://www.spinics.net/lists/linux-man/msg05589.html
was not accepted.

Michael Kerrisk suggested in a private mail to add a comment in the BUGS section.

---
 man7/fanotify.7 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
man7/fanotify.7 +12 -3
index 2a92908..c6cec7c 100644
@@ -164,7 +164,7 @@ so that multiple events can be retrieved by a single
 The return value of
 .BR read (2)
 is the number of bytes placed in the buffer,
-or \-1 in case of an error.
+or \-1 in case of an error (but see BUGS).
 
 The fields of the
 .I fanotify_event_metadata
@@ -468,7 +468,7 @@ The event queue can overflow.
 In this case, events are lost.
 .SH BUGS
 As of Linux 3.15,
-the following bug exists:
+the following bugs exists:
 .IP * 3
 .\" FIXME: A patch was proposed.
 When an event is generated,
@@ -478,6 +478,16 @@ before passing a file descriptor for that file.
 This poses a security risk, when the
 .B CAP_SYS_ADMIN
 capability is set for programs executed by unprivileged users.
+.IP *
+If a call to
+.BR read( 2 )
+processes multiple events from the fanotify queue and an error occurs, the
+return value will be the cumulated length of the events successfully copied to
+the user space buffer before the error occured.
+The return value will not be \-1.
+.I errno
+will not be set.
+Thus, the user program has no way to detect the error.
 .SH EXAMPLE
 The following program demonstrates the usage of the fanotify API.
 It marks the mount point passed as a command-line argument
--

2.0.0.rc0

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAKgNAki6E91d+GJnev5UWc4KPuXSTCnPnXE56fsDtoRerUS3jg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Hello,

Quoted 1 line · Michael Kerrisk (man-pages)

Do you have any comments/additions for this man-pages patch?

No, it looks good to me.

Honza

Quoted 62 lines · Heinrich Schuchardt
Quoted 54 lines

The patch in
http://www.spinics.net/lists/linux-man/msg05589.html
was not accepted.

Michael Kerrisk suggested in a private mail to add a comment in the BUGS section.

---
 man7/fanotify.7 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
man7/fanotify.7 +12 -3
index 2a92908..c6cec7c 100644
@@ -164,7 +164,7 @@ so that multiple events can be retrieved by a single
 The return value of
 .BR read (2)
 is the number of bytes placed in the buffer,
-or \-1 in case of an error.
+or \-1 in case of an error (but see BUGS).
 
 The fields of the
 .I fanotify_event_metadata
@@ -468,7 +468,7 @@ The event queue can overflow.
 In this case, events are lost.
 .SH BUGS
 As of Linux 3.15,
-the following bug exists:
+the following bugs exists:
 .IP * 3
 .\" FIXME: A patch was proposed.
 When an event is generated,
@@ -478,6 +478,16 @@ before passing a file descriptor for that file.
 This poses a security risk, when the
 .B CAP_SYS_ADMIN
 capability is set for programs executed by unprivileged users.
+.IP *
+If a call to
+.BR read( 2 )
+processes multiple events from the fanotify queue and an error occurs, the
+return value will be the cumulated length of the events successfully copied to
+the user space buffer before the error occured.
+The return value will not be \-1.
+.I errno
+will not be set.
+Thus, the user program has no way to detect the error.
 .SH EXAMPLE
 The following program demonstrates the usage of the fanotify API.
 It marks the mount point passed as a command-line argument
--

2.0.0.rc0

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
Signature · 6 lines
Jan Kara <[email protected]>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by Jan Kara
#7 lore raw
In reply to a message not in the archive
Quoted 6 lines · Heinrich Schuchardt

The patch in
http://www.spinics.net/lists/linux-man/msg05589.html
was not accepted.

Michael Kerrisk suggested in a private mail to add a comment in the BUGS section.

Hi Heinrich,

Thanks! I've applied this patch (and fixed a few typos) and added

Cheers,

Michael

Quoted 45 lines
---
 man7/fanotify.7 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
man7/fanotify.7 +12 -2
index 2a92908..c6cec7c 100644
@@ -164,7 +164,7 @@ so that multiple events can be retrieved by a single
 The return value of
 .BR read (2)
 is the number of bytes placed in the buffer,
-or \-1 in case of an error.
+or \-1 in case of an error (but see BUGS).
 
 The fields of the
 .I fanotify_event_metadata
@@ -468,7 +468,7 @@ The event queue can overflow.
 In this case, events are lost.
 .SH BUGS
 As of Linux 3.15,
-the following bug exists:
+the following bugs exists:
 .IP * 3
 .\" FIXME: A patch was proposed.
 When an event is generated,
@@ -478,6 +478,16 @@ before passing a file descriptor for that file.
 This poses a security risk, when the
 .B CAP_SYS_ADMIN
 capability is set for programs executed by unprivileged users.
+.IP *
+If a call to
+.BR read( 2 )
+processes multiple events from the fanotify queue and an error occurs, the
+return value will be the cumulated length of the events successfully copied to
+the user space buffer before the error occured.
+The return value will not be \-1.
+.I errno
+will not be set.
+Thus, the user program has no way to detect the error.
 .SH EXAMPLE
 The following program demonstrates the usage of the fanotify API.
 It marks the mount point passed as a command-line argument
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html