All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmap.2: Add EOVERFLOW
@ 2012-11-12 10:56 chrubis-AlSwsSmVLrQ
       [not found] ` <20121112105632.GB6764-J5syqNJeCN7twjQa/ONI9g@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: chrubis-AlSwsSmVLrQ @ 2012-11-12 10:56 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

This patch adds EOVERFLOW and conditions needed to
trigger it into mmap.2 man page.

-- 
Cyril Hrubis
chrubis-AlSwsSmVLrQ@public.gmane.org

[-- Attachment #2: 0001-mmap.2-Add-EOVERFLOW-to-ERRORS.patch --]
[-- Type: text/plain, Size: 1489 bytes --]

>From e656978560e317b95a8315b9556690e8c03917f2 Mon Sep 17 00:00:00 2001
From: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
Date: Wed, 7 Nov 2012 11:52:55 +0100
Subject: [PATCH 1/2] mmap.2: Add EOVERFLOW to ERRORS.

The overflow could be triggered on 32 bit arch
with large file extension (i.e. 64 bit off_t)
if number of pages used for len plus number of
pages used for offset would overflow 32 bit
unsigned long.

In this case we would hit this line from do_mmap_pgoff:

...
	/* offset overflow? */
	if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
		return -EOVERFLOW;
...

Note that if the offset is too big (would overflow
unsigned long in number of pages itself) you would hit
EINVAL first.

The code to trigger this condition could be
seen in LTP git repo in:

open_posix_testsuite/conformance/interfaces/mmap/31-1.c

Signed-off-by: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
---
 man2/mmap.2 |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/man2/mmap.2 b/man2/mmap.2
index 042b833..29fcc3d 100644
--- a/man2/mmap.2
+++ b/man2/mmap.2
@@ -470,6 +470,11 @@ was mounted no-exec.
 was set but the object specified by
 .I fd
 is open for writing.
+.TP
+.B EOVERFLOW
+happens on 32 bit architecture together with large file extension (i.e. using
+64 bit off_t) when number of pages used for length plus number of pages used
+for offset would overflow unsigned long (32 bits)
 .LP
 Use of a mapped region can result in these signals:
 .TP
-- 
1.7.8.6


[-- Attachment #3: 0001-mmap.2-Add-EOVERFLOW-to-ERRORS.patch --]
[-- Type: text/plain, Size: 1489 bytes --]

>From e656978560e317b95a8315b9556690e8c03917f2 Mon Sep 17 00:00:00 2001
From: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
Date: Wed, 7 Nov 2012 11:52:55 +0100
Subject: [PATCH 1/2] mmap.2: Add EOVERFLOW to ERRORS.

The overflow could be triggered on 32 bit arch
with large file extension (i.e. 64 bit off_t)
if number of pages used for len plus number of
pages used for offset would overflow 32 bit
unsigned long.

In this case we would hit this line from do_mmap_pgoff:

...
	/* offset overflow? */
	if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
		return -EOVERFLOW;
...

Note that if the offset is too big (would overflow
unsigned long in number of pages itself) you would hit
EINVAL first.

The code to trigger this condition could be
seen in LTP git repo in:

open_posix_testsuite/conformance/interfaces/mmap/31-1.c

Signed-off-by: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
---
 man2/mmap.2 |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/man2/mmap.2 b/man2/mmap.2
index 042b833..29fcc3d 100644
--- a/man2/mmap.2
+++ b/man2/mmap.2
@@ -470,6 +470,11 @@ was mounted no-exec.
 was set but the object specified by
 .I fd
 is open for writing.
+.TP
+.B EOVERFLOW
+happens on 32 bit architecture together with large file extension (i.e. using
+64 bit off_t) when number of pages used for length plus number of pages used
+for offset would overflow unsigned long (32 bits)
 .LP
 Use of a mapped region can result in these signals:
 .TP
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmap.2: Add EOVERFLOW
       [not found] ` <20121112105632.GB6764-J5syqNJeCN7twjQa/ONI9g@public.gmane.org>
@ 2013-02-25  7:46   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2013-02-25  7:46 UTC (permalink / raw)
  To: chrubis-AlSwsSmVLrQ; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Cyril,

On Mon, Nov 12, 2012 at 11:56 AM,  <chrubis-AlSwsSmVLrQ@public.gmane.org> wrote:
> This patch adds EOVERFLOW and conditions needed to
> trigger it into mmap.2 man page.

Thanks. Applied.

Cheers,

Michael


> --
> Cyril Hrubis
> chrubis-AlSwsSmVLrQ@public.gmane.org
>
> From e656978560e317b95a8315b9556690e8c03917f2 Mon Sep 17 00:00:00 2001
> From: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
> Date: Wed, 7 Nov 2012 11:52:55 +0100
> Subject: [PATCH 1/2] mmap.2: Add EOVERFLOW to ERRORS.
>
> The overflow could be triggered on 32 bit arch
> with large file extension (i.e. 64 bit off_t)
> if number of pages used for len plus number of
> pages used for offset would overflow 32 bit
> unsigned long.
>
> In this case we would hit this line from do_mmap_pgoff:
>
> ...
>         /* offset overflow? */
>         if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
>                 return -EOVERFLOW;
> ...
>
> Note that if the offset is too big (would overflow
> unsigned long in number of pages itself) you would hit
> EINVAL first.
>
> The code to trigger this condition could be
> seen in LTP git repo in:
>
> open_posix_testsuite/conformance/interfaces/mmap/31-1.c
>
> Signed-off-by: Cyril Hrubis <chrubis-AlSwsSmVLrQ@public.gmane.org>
> ---
>  man2/mmap.2 |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/man2/mmap.2 b/man2/mmap.2
> index 042b833..29fcc3d 100644
> --- a/man2/mmap.2
> +++ b/man2/mmap.2
> @@ -470,6 +470,11 @@ was mounted no-exec.
>  was set but the object specified by
>  .I fd
>  is open for writing.
> +.TP
> +.B EOVERFLOW
> +happens on 32 bit architecture together with large file extension (i.e. using
> +64 bit off_t) when number of pages used for length plus number of pages used
> +for offset would overflow unsigned long (32 bits)
>  .LP
>  Use of a mapped region can result in these signals:
>  .TP
> --
> 1.7.8.6
>
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
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] 2+ messages in thread

end of thread, other threads:[~2013-02-25  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 10:56 [PATCH] mmap.2: Add EOVERFLOW chrubis-AlSwsSmVLrQ
     [not found] ` <20121112105632.GB6764-J5syqNJeCN7twjQa/ONI9g@public.gmane.org>
2013-02-25  7:46   ` Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.