public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] nommu: fix ksize() abuse
@ 2008-05-22 16:11 Pekka J Enberg
  2008-05-22 16:49 ` Christoph Lameter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Pekka J Enberg @ 2008-05-22 16:11 UTC (permalink / raw)
  To: dhowells; +Cc: clameter, mpm, lethal, linux-kernel

From: Pekka Enberg <penberg@cs.helsinki.fi>

The nommu binfmt code uses ksize() for pointers returned from do_mmap() 
which is wrong. This converts the call-sites to use the nommu specific 
kobjsize() function which works as expected.

Cc: Christoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 fs/binfmt_elf_fdpic.c |    2 +-
 fs/binfmt_flat.c      |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index ddd35d8..d051a32 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -390,7 +390,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
 	}
 
 	/* expand the stack mapping to use up the entire allocation granule */
-	fullsize = ksize((char *) current->mm->start_brk);
+	fullsize = kobjsize((char *) current->mm->start_brk);
 	if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size,
 				    fullsize, 0, 0)))
 		stack_size = fullsize;
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 3b40d45..2cb1acd 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -548,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 			PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
 		/* Remap to use all availabe slack region space */
 		if (realdatastart && (realdatastart < (unsigned long)-4096)) {
-			reallen = ksize((void *)realdatastart);
+			reallen = kobjsize((void *)realdatastart);
 			if (reallen > len) {
 				realdatastart = do_mremap(realdatastart, len,
 					reallen, MREMAP_FIXED, realdatastart);
@@ -600,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 			PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
 		/* Remap to use all availabe slack region space */
 		if (textpos && (textpos < (unsigned long) -4096)) {
-			reallen = ksize((void *)textpos);
+			reallen = kobjsize((void *)textpos);
 			if (reallen > len) {
 				textpos = do_mremap(textpos, len, reallen,
 					MREMAP_FIXED, textpos);
@@ -683,7 +683,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 		 */
 		current->mm->start_brk = datapos + data_len + bss_len;
 		current->mm->brk = (current->mm->start_brk + 3) & ~3;
-		current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len;
+		current->mm->context.end_brk = memp + kobjsize((void *) memp) - stack_len;
 	}
 
 	if (flags & FLAT_FLAG_KTRACE)
@@ -790,7 +790,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 
 	/* zero the BSS,  BRK and stack areas */
 	memset((void*)(datapos + data_len), 0, bss_len + 
-			(memp + ksize((void *) memp) - stack_len -	/* end brk */
+			(memp + kobjsize((void *) memp) - stack_len -	/* end brk */
 			libinfo->lib_list[id].start_brk) +		/* start brk */
 			stack_len);
 
-- 
1.5.2.5


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

* Re: [RFC/PATCH] nommu: fix ksize() abuse
  2008-05-22 16:49 ` Christoph Lameter
@ 2008-05-22 16:48   ` Pekka Enberg
  0 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2008-05-22 16:48 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: dhowells, mpm, lethal, linux-kernel

Christoph Lameter wrote:
> Does kobjsize exisst for !nommu?

No, it doesn't. The abusers here are #ifdef NOMMU, though.

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

* Re: [RFC/PATCH] nommu: fix ksize() abuse
  2008-05-22 16:11 [RFC/PATCH] nommu: fix ksize() abuse Pekka J Enberg
@ 2008-05-22 16:49 ` Christoph Lameter
  2008-05-22 16:48   ` Pekka Enberg
  2008-05-23  0:30 ` Paul Mundt
  2008-05-28 13:12 ` David Howells
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2008-05-22 16:49 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: dhowells, mpm, lethal, linux-kernel

Does kobjsize exisst for !nommu?



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

* Re: [RFC/PATCH] nommu: fix ksize() abuse
  2008-05-22 16:11 [RFC/PATCH] nommu: fix ksize() abuse Pekka J Enberg
  2008-05-22 16:49 ` Christoph Lameter
@ 2008-05-23  0:30 ` Paul Mundt
  2008-05-28 13:12 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2008-05-23  0:30 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: dhowells, clameter, mpm, linux-kernel

On Thu, May 22, 2008 at 07:11:40PM +0300, Pekka J Enberg wrote:
> The nommu binfmt code uses ksize() for pointers returned from do_mmap() 
> which is wrong. This converts the call-sites to use the nommu specific 
> kobjsize() function which works as expected.
> 
Acked-by: Paul Mundt <lethal@linux-sh.org>

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

* Re: [RFC/PATCH] nommu: fix ksize() abuse
  2008-05-22 16:11 [RFC/PATCH] nommu: fix ksize() abuse Pekka J Enberg
  2008-05-22 16:49 ` Christoph Lameter
  2008-05-23  0:30 ` Paul Mundt
@ 2008-05-28 13:12 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2008-05-28 13:12 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: dhowells, clameter, mpm, lethal, linux-kernel

Pekka J Enberg <penberg@cs.helsinki.fi> wrote:

> From: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> The nommu binfmt code uses ksize() for pointers returned from do_mmap() 
> which is wrong. This converts the call-sites to use the nommu specific 
> kobjsize() function which works as expected.
> 
> Cc: Christoph Lameter <clameter@sgi.com>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: David Howells <dhowells@redhat.com>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

Acked-by: David Howells <dhowells@redhat.com>

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

end of thread, other threads:[~2008-05-28 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 16:11 [RFC/PATCH] nommu: fix ksize() abuse Pekka J Enberg
2008-05-22 16:49 ` Christoph Lameter
2008-05-22 16:48   ` Pekka Enberg
2008-05-23  0:30 ` Paul Mundt
2008-05-28 13:12 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox