Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread Hugh Dickins
On Fri, 8 Apr 2005, Nick Piggin wrote:
> David Howells wrote:
> > Hugh Dickins <[EMAIL PROTECTED]> wrote:
> > 
> > > Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent
> > > (no
> > > other syscall refers to it), unnecessary (sys_mincore loops over vmas
> > > further down) and incorrect (misses user addresses in ARM's first
> > > pgd).
> > 
> > You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
> > pointers and suchlike to be weeded out before having to take the
> > semaphore.
> 
> I'm not sure whether it is worth keeping the singular special
> case here to slightly speed up what would probably be a bug in
> a userspace program.

Well put - though you're more diffident about it than I would be!

Furthermore, it only allows NULL pointers and suchlike to be weeded
out on the ARM (and ARM26) architecture, no other.  I'm not averse
to optimizing ARM and ARM26, but it's much too insignificant an
optimization to warrant reference to such an architectural detail.

And it breaks the (peculiar) sys_mincore convention of doing all the
work while returning -ENOMEM, if there were any holes in the address
range.  David's check stops it from doing any work in that case.

FIRST_USER_ADDRESS should be used in the very few places
it is necessary, and not spread around beyond them.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread Nick Piggin
David Howells wrote:
Hugh Dickins <[EMAIL PROTECTED]> wrote:

Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
other syscall refers to it), unnecessary (sys_mincore loops over vmas
further down) and incorrect (misses user addresses in ARM's first pgd).

You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
pointers and suchlike to be weeded out before having to take the semaphore.
I'm not sure whether it is worth keeping the singular special
case here to slightly speed up what would probably be a bug in
a userspace program.
--
SUSE Labs, Novell Inc.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread David Howells
Hugh Dickins <[EMAIL PROTECTED]> wrote:

> 
> Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
> other syscall refers to it), unnecessary (sys_mincore loops over vmas
> further down) and incorrect (misses user addresses in ARM's first pgd).

You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
pointers and suchlike to be weeded out before having to take the semaphore.

Also, just because no other syscall refers to such a value doesn't mean that
this one shouldn't and that others shouldn't.

David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread David Howells
Hugh Dickins [EMAIL PROTECTED] wrote:

 
 Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
 other syscall refers to it), unnecessary (sys_mincore loops over vmas
 further down) and incorrect (misses user addresses in ARM's first pgd).

You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
pointers and suchlike to be weeded out before having to take the semaphore.

Also, just because no other syscall refers to such a value doesn't mean that
this one shouldn't and that others shouldn't.

David
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread Nick Piggin
David Howells wrote:
Hugh Dickins [EMAIL PROTECTED] wrote:

Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
other syscall refers to it), unnecessary (sys_mincore loops over vmas
further down) and incorrect (misses user addresses in ARM's first pgd).

You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
pointers and suchlike to be weeded out before having to take the semaphore.
I'm not sure whether it is worth keeping the singular special
case here to slightly speed up what would probably be a bug in
a userspace program.
--
SUSE Labs, Novell Inc.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-07 Thread Hugh Dickins
On Fri, 8 Apr 2005, Nick Piggin wrote:
 David Howells wrote:
  Hugh Dickins [EMAIL PROTECTED] wrote:
  
   Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent
   (no
   other syscall refers to it), unnecessary (sys_mincore loops over vmas
   further down) and incorrect (misses user addresses in ARM's first
   pgd).
  
  You should make it use FIRST_USER_ADDRESS instead. This check allows NULL
  pointers and suchlike to be weeded out before having to take the
  semaphore.
 
 I'm not sure whether it is worth keeping the singular special
 case here to slightly speed up what would probably be a bug in
 a userspace program.

Well put - though you're more diffident about it than I would be!

Furthermore, it only allows NULL pointers and suchlike to be weeded
out on the ARM (and ARM26) architecture, no other.  I'm not averse
to optimizing ARM and ARM26, but it's much too insignificant an
optimization to warrant reference to such an architectural detail.

And it breaks the (peculiar) sys_mincore convention of doing all the
work while returning -ENOMEM, if there were any holes in the address
range.  David's check stops it from doing any work in that case.

FIRST_USER_ADDRESS should be used in the very few places
it is necessary, and not spread around beyond them.

Hugh
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-06 Thread Hugh Dickins
Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
other syscall refers to it), unnecessary (sys_mincore loops over vmas
further down) and incorrect (misses user addresses in ARM's first pgd).

Signed-off-by: Hugh Dickins <[EMAIL PROTECTED]>
---

 mm/mincore.c |3 ---
 1 files changed, 3 deletions(-)

--- 2.6.12-rc2-mm1/mm/mincore.c 2005-04-05 15:21:02.0 +0100
+++ linux/mm/mincore.c  2005-04-05 18:59:01.0 +0100
@@ -118,9 +118,6 @@ asmlinkage long sys_mincore(unsigned lon
if (start & ~PAGE_CACHE_MASK)
goto einval;
 
-   if (start < FIRST_USER_PGD_NR * PGDIR_SIZE)
-   goto enomem;
-
limit = TASK_SIZE;
if (start >= limit)
goto enomem;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] freepgt2: sys_mincore ignore FIRST_USER_PGD_NR

2005-04-06 Thread Hugh Dickins
Remove use of FIRST_USER_PGD_NR from sys_mincore: it's inconsistent (no
other syscall refers to it), unnecessary (sys_mincore loops over vmas
further down) and incorrect (misses user addresses in ARM's first pgd).

Signed-off-by: Hugh Dickins [EMAIL PROTECTED]
---

 mm/mincore.c |3 ---
 1 files changed, 3 deletions(-)

--- 2.6.12-rc2-mm1/mm/mincore.c 2005-04-05 15:21:02.0 +0100
+++ linux/mm/mincore.c  2005-04-05 18:59:01.0 +0100
@@ -118,9 +118,6 @@ asmlinkage long sys_mincore(unsigned lon
if (start  ~PAGE_CACHE_MASK)
goto einval;
 
-   if (start  FIRST_USER_PGD_NR * PGDIR_SIZE)
-   goto enomem;
-
limit = TASK_SIZE;
if (start = limit)
goto enomem;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/