From: Jon Tollefson <kniht@us.ibm.com>
To: linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: Nick Piggin <npiggin@suse.de>,
Nishanth Aravamudan <nacc@us.ibm.com>,
Andi Kleen <andi@firstfloor.org>,
Paul Mackerras <paulus@samba.org>
Subject: [PATCH 5/6 v2] check for overflow
Date: Tue, 13 May 2008 12:23:59 -0500 [thread overview]
Message-ID: <4829CEAF.9020806@us.ibm.com> (raw)
In-Reply-To: <4829CAC3.30900@us.ibm.com>
Adds a check for an overflow in the filesystem size so if someone is
checking with statfs() on a 16G hugetlbfs in a 32bit binary that it
will report back EOVERFLOW instead of a size of 0.
Are other places that need a similar check? I had tried a similar
check in put_compat_statfs64 too but it didn't seem to generate an
EOVERFLOW in my test case.
Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
---
fs/compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..6eb6aad 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -196,8 +196,8 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
{
if (sizeof ubuf->f_blocks == 4) {
- if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) &
- 0xffffffff00000000ULL)
+ if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail |
+ kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL)
return -EOVERFLOW;
/* f_files and f_ffree may be -1; it's okay
* to stuff that into 32 bits */
WARNING: multiple messages have this Message-ID (diff)
From: Jon Tollefson <kniht@us.ibm.com>
To: linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: Paul Mackerras <paulus@samba.org>, Nick Piggin <npiggin@suse.de>,
Nishanth Aravamudan <nacc@us.ibm.com>,
Andi Kleen <andi@firstfloor.org>, Adam Litke <agl@us.ibm.com>
Subject: [PATCH 5/6 v2] check for overflow
Date: Tue, 13 May 2008 12:23:59 -0500 [thread overview]
Message-ID: <4829CEAF.9020806@us.ibm.com> (raw)
In-Reply-To: <4829CAC3.30900@us.ibm.com>
Adds a check for an overflow in the filesystem size so if someone is
checking with statfs() on a 16G hugetlbfs in a 32bit binary that it
will report back EOVERFLOW instead of a size of 0.
Are other places that need a similar check? I had tried a similar
check in put_compat_statfs64 too but it didn't seem to generate an
EOVERFLOW in my test case.
Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
---
fs/compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..6eb6aad 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -196,8 +196,8 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
{
if (sizeof ubuf->f_blocks == 4) {
- if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) &
- 0xffffffff00000000ULL)
+ if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail |
+ kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL)
return -EOVERFLOW;
/* f_files and f_ffree may be -1; it's okay
* to stuff that into 32 bits */
WARNING: multiple messages have this Message-ID (diff)
From: Jon Tollefson <kniht@us.ibm.com>
To: linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Cc: Paul Mackerras <paulus@samba.org>, Nick Piggin <npiggin@suse.de>,
Nishanth Aravamudan <nacc@us.ibm.com>,
Andi Kleen <andi@firstfloor.org>, Adam Litke <agl@us.ibm.com>
Subject: [PATCH 5/6 v2] check for overflow
Date: Tue, 13 May 2008 12:23:59 -0500 [thread overview]
Message-ID: <4829CEAF.9020806@us.ibm.com> (raw)
In-Reply-To: <4829CAC3.30900@us.ibm.com>
Adds a check for an overflow in the filesystem size so if someone is
checking with statfs() on a 16G hugetlbfs in a 32bit binary that it
will report back EOVERFLOW instead of a size of 0.
Are other places that need a similar check? I had tried a similar
check in put_compat_statfs64 too but it didn't seem to generate an
EOVERFLOW in my test case.
Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
---
fs/compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..6eb6aad 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -196,8 +196,8 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
{
if (sizeof ubuf->f_blocks == 4) {
- if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) &
- 0xffffffff00000000ULL)
+ if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail |
+ kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL)
return -EOVERFLOW;
/* f_files and f_ffree may be -1; it's okay
* to stuff that into 32 bits */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-05-13 17:24 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-13 17:07 [PATCH 0/6] 16G and multi size hugetlb page support on powerpc Jon Tollefson
2008-05-13 17:07 ` Jon Tollefson
2008-05-13 17:07 ` Jon Tollefson
2008-05-13 17:19 ` [PATCH 1/6 v2] allow arch specific function for allocating gigantic pages Jon Tollefson
2008-05-13 17:19 ` Jon Tollefson
2008-05-13 17:19 ` Jon Tollefson
2008-05-23 6:25 ` Nick Piggin
2008-05-23 6:25 ` Nick Piggin
2008-05-23 6:25 ` Nick Piggin
2008-05-13 17:21 ` [PATCH 2/6 v2] powerpc: " Jon Tollefson
2008-05-13 17:21 ` Jon Tollefson
2008-05-13 17:21 ` Jon Tollefson
2008-05-13 17:22 ` [PATCH 3/6 v2] powerpc: scan device tree and save gigantic page locations Jon Tollefson
2008-05-13 17:22 ` Jon Tollefson
2008-05-13 17:22 ` Jon Tollefson
2008-05-13 17:23 ` [PATCH 4/6 v2] powerpc: define page support for 16G pages Jon Tollefson
2008-05-13 17:23 ` Jon Tollefson
2008-05-13 17:23 ` Jon Tollefson
2008-05-13 17:23 ` Jon Tollefson [this message]
2008-05-13 17:23 ` [PATCH 5/6 v2] check for overflow Jon Tollefson
2008-05-13 17:23 ` Jon Tollefson
2008-05-13 17:25 ` [PATCH 6/6] powerpc: support multiple huge page sizes Jon Tollefson
2008-05-13 17:25 ` Jon Tollefson
2008-05-13 17:25 ` Jon Tollefson
2008-06-24 2:54 ` Nick Piggin
2008-06-24 2:54 ` Nick Piggin
2008-06-24 2:54 ` Nick Piggin
2008-06-24 17:17 ` Jon Tollefson
2008-06-24 17:17 ` Jon Tollefson
2008-06-24 17:17 ` Jon Tollefson
2008-05-14 4:25 ` [PATCH 0/6] 16G and multi size hugetlb page support on powerpc Nick Piggin
2008-05-14 4:25 ` Nick Piggin
2008-05-14 4:25 ` Nick Piggin
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=4829CEAF.9020806@us.ibm.com \
--to=kniht@us.ibm.com \
--cc=andi@firstfloor.org \
--cc=kniht@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=nacc@us.ibm.com \
--cc=npiggin@suse.de \
--cc=paulus@samba.org \
/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 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.