* [PATCH] sendfile.2: Document more return values
@ 2015-12-11 8:03 Laurent Georget
[not found] ` <1449820983-17810-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Laurent Georget @ 2015-12-11 8:03 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk; +Cc: Laurent Georget
Signed-off-by: Laurent Georget <laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
Some return values are not documented in sendfile.2, this patch adds some
details.
---
man2/sendfile.2 | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/man2/sendfile.2 b/man2/sendfile.2
index 93cf7e1..b56365e 100644
--- a/man2/sendfile.2
+++ b/man2/sendfile.2
@@ -136,7 +136,10 @@ Bad address.
Descriptor is not valid or locked, or an
.BR mmap (2)-like
operation is not available for
-.IR in_fd .
+.IR in_fd ,
+or
+.I count
+is negative.
.TP
.B EINVAL
.I out_fd
@@ -153,6 +156,20 @@ Unspecified error while reading from
.B ENOMEM
Insufficient memory to read from
.IR in_fd .
+.TP
+.B EOVERFLOW
+.I count
+is too large, the operation would result in exceeding the maximum size of either
+the input file or the output file.
+.TP
+.B EPERM
+Permissions are insufficient for reading from the input file or writing to the
+output file.
+.TP
+.B ESPIPE
+.I offset
+is not NULL but the input file is not
+.BR seek (2)-able.
.SH VERSIONS
.BR sendfile ()
first appeared in Linux 2.2.
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sendfile.2: Document more return values
[not found] ` <1449820983-17810-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
@ 2015-12-11 18:55 ` Michael Kerrisk (man-pages)
2015-12-11 20:10 ` [PATCH v2] " Laurent Georget
1 sibling, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-12-11 18:55 UTC (permalink / raw)
To: Laurent Georget, linux-man-u79uwXL29TY76Z2rM5mHXA
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
Hello Laurent,
On 12/11/2015 09:03 AM, Laurent Georget wrote:
> Signed-off-by: Laurent Georget <laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
Would you be willing to resubmit this with a commit message that notes how
you determined that each of these errors can occur? (E.g., testing,
reference to kernel source file, etc.)
Thanks,
Michael
> Some return values are not documented in sendfile.2, this patch adds some
> details.
> ---
> man2/sendfile.2 | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/man2/sendfile.2 b/man2/sendfile.2
> index 93cf7e1..b56365e 100644
> --- a/man2/sendfile.2
> +++ b/man2/sendfile.2
> @@ -136,7 +136,10 @@ Bad address.
> Descriptor is not valid or locked, or an
> .BR mmap (2)-like
> operation is not available for
> -.IR in_fd .
> +.IR in_fd ,
> +or
> +.I count
> +is negative.
> .TP
> .B EINVAL
> .I out_fd
> @@ -153,6 +156,20 @@ Unspecified error while reading from
> .B ENOMEM
> Insufficient memory to read from
> .IR in_fd .
> +.TP
> +.B EOVERFLOW
> +.I count
> +is too large, the operation would result in exceeding the maximum size of either
> +the input file or the output file.
> +.TP
> +.B EPERM
> +Permissions are insufficient for reading from the input file or writing to the
> +output file.
> +.TP
> +.B ESPIPE
> +.I offset
> +is not NULL but the input file is not
> +.BR seek (2)-able.
> .SH VERSIONS
> .BR sendfile ()
> first appeared in Linux 2.2.
>
--
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] sendfile.2: Document more return values
[not found] ` <1449820983-17810-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
2015-12-11 18:55 ` Michael Kerrisk (man-pages)
@ 2015-12-11 20:10 ` Laurent Georget
[not found] ` <1449864604-32189-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Laurent Georget @ 2015-12-11 20:10 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk; +Cc: Laurent Georget
As of version 4.3, sendfile(2) can return more error codes than are
documented in sendfile.2. This patch adds some details:
- EINVAL can be returned if count is negative, from function rw_verify_area
in fs/read_write.c, called from do_sendfile, called from sys_sendfile.
- EOVERFLOW can be returned if count is too large, from rw_verify_area,
called from do_sendfile, called from sys_sendfile, or directly from
do_sendfile in one case (pos + count > max size of either in_fd or
out_fd).
- ESPIPE can be returned if offset is not a NULL pointer but the input file
does not support FMODE_PREAD, from do_sendfile, called from sys_sendfile.
Signed-off-by: Laurent Georget <laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
---
I removed EPERM from the patch because actually, it cannot be returned in a
vanilla kernel. I had it in my case because of SELinux. There is a call to the
LSM hook security_file_permission inside the function rw_verify_area.
Cheers,
Laurent
man2/sendfile.2 | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/man2/sendfile.2 b/man2/sendfile.2
index 93cf7e1..b56365e 100644
--- a/man2/sendfile.2
+++ b/man2/sendfile.2
@@ -136,7 +136,10 @@ Bad address.
Descriptor is not valid or locked, or an
.BR mmap (2)-like
operation is not available for
-.IR in_fd .
+.IR in_fd ,
+or
+.I count
+is negative.
.TP
.B EINVAL
.I out_fd
@@ -153,6 +156,16 @@ Unspecified error while reading from
.B ENOMEM
Insufficient memory to read from
.IR in_fd .
+.TP
+.B EOVERFLOW
+.I count
+is too large, the operation would result in exceeding the maximum size of either
+the input file or the output file.
+.TP
+.B ESPIPE
+.I offset
+is not NULL but the input file is not
+.BR seek (2)-able.
.SH VERSIONS
.BR sendfile ()
first appeared in Linux 2.2.
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] sendfile.2: Document more return values
[not found] ` <1449864604-32189-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
@ 2015-12-16 15:13 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-12-16 15:13 UTC (permalink / raw)
To: Laurent Georget, linux-man-u79uwXL29TY76Z2rM5mHXA
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
On 12/11/2015 09:10 PM, Laurent Georget wrote:
> As of version 4.3, sendfile(2) can return more error codes than are
> documented in sendfile.2. This patch adds some details:
>
> - EINVAL can be returned if count is negative, from function rw_verify_area
> in fs/read_write.c, called from do_sendfile, called from sys_sendfile.
> - EOVERFLOW can be returned if count is too large, from rw_verify_area,
> called from do_sendfile, called from sys_sendfile, or directly from
> do_sendfile in one case (pos + count > max size of either in_fd or
> out_fd).
> - ESPIPE can be returned if offset is not a NULL pointer but the input file
> does not support FMODE_PREAD, from do_sendfile, called from sys_sendfile.
>
> Signed-off-by: Laurent Georget <laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
> ---
>
> I removed EPERM from the patch because actually, it cannot be returned in a
> vanilla kernel. I had it in my case because of SELinux. There is a call to the
> LSM hook security_file_permission inside the function rw_verify_area.
>
> Cheers,
Thanks, Laurent. Applied.
Cheers,
Michael
> man2/sendfile.2 | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/man2/sendfile.2 b/man2/sendfile.2
> index 93cf7e1..b56365e 100644
> --- a/man2/sendfile.2
> +++ b/man2/sendfile.2
> @@ -136,7 +136,10 @@ Bad address.
> Descriptor is not valid or locked, or an
> .BR mmap (2)-like
> operation is not available for
> -.IR in_fd .
> +.IR in_fd ,
> +or
> +.I count
> +is negative.
> .TP
> .B EINVAL
> .I out_fd
> @@ -153,6 +156,16 @@ Unspecified error while reading from
> .B ENOMEM
> Insufficient memory to read from
> .IR in_fd .
> +.TP
> +.B EOVERFLOW
> +.I count
> +is too large, the operation would result in exceeding the maximum size of either
> +the input file or the output file.
> +.TP
> +.B ESPIPE
> +.I offset
> +is not NULL but the input file is not
> +.BR seek (2)-able.
> .SH VERSIONS
> .BR sendfile ()
> first appeared in Linux 2.2.
>
--
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-16 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 8:03 [PATCH] sendfile.2: Document more return values Laurent Georget
[not found] ` <1449820983-17810-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
2015-12-11 18:55 ` Michael Kerrisk (man-pages)
2015-12-11 20:10 ` [PATCH v2] " Laurent Georget
[not found] ` <1449864604-32189-1-git-send-email-laurent.georget-vbcOdlJ0SulGWvitb5QawA@public.gmane.org>
2015-12-16 15:13 ` Michael Kerrisk (man-pages)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).