Re: [uClinux-dev] SLOB and binfmt_flat/do_mremap

2007-05-09 Thread Greg Ungerer


Hi John,

John Williams wrote:
With the SLOB allocator enabled, kobjsize() doesn't seem to match 
ksize().  This triggers a bug with binfmt_flat, where the do_mremap call 
is used to take up slack space in the allocated text/data segments.


binfmt_flat calls ksize to get the allocated region size, but do_mremap 
calls kobjsize.


I've got a system where these are reporting two different values, and 
it's causing mremap to fail:


do_mremap(0x13f4, 0x0001b4be, 0x0002, 0x0002,0x13f4)
new_len is 0x0002
kobjsize is 0x1000
ksize is 0x0002
Unable to allocate RAM for process text/data, errno 12

ksize() is reporting 0x2 (and that's what binfmt_flat passed in), 
but kobjsize() is reporting 0x1000.  This trigggers the test in 
do_mremap and the application fails with -ENOMEM.


With SLAB it's fine.

Inspired by this patch from last year

http://mailman.uclinux.org/pipermail/uclinux-dev/2006-July/039232.html

I've got the following that seems to work OK:

Index: nommu.c
===
--- nommu.c (revision 2640)
+++ nommu.c (working copy)
@@ -112,13 +112,7 @@
if (!objp || !((page = virt_to_page(objp
return 0;

-   if (PageSlab(page))
-   return ksize(objp);
-
-   BUG_ON(page-index  0);
-   BUG_ON(page-index = MAX_ORDER);
-
-   return (PAGE_SIZE  page-index);
+   return ksize(objp);
 }

Any thoughts?  It seems that this is a known issue with SLOB.


It seems reasonable to me. Though I'd like get input from others
on lkml...

Regards
Greg



Greg Ungerer  --  Chief Software Dude   EMAIL: [EMAIL PROTECTED]
SnapGear -- a Secure Computing Company  PHONE:   +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


[uClinux-dev] SLOB and binfmt_flat/do_mremap

2007-05-03 Thread John Williams

Hi,

With the SLOB allocator enabled, kobjsize() doesn't seem to match 
ksize().  This triggers a bug with binfmt_flat, where the do_mremap call 
is used to take up slack space in the allocated text/data segments.


binfmt_flat calls ksize to get the allocated region size, but do_mremap 
calls kobjsize.


I've got a system where these are reporting two different values, and 
it's causing mremap to fail:


do_mremap(0x13f4, 0x0001b4be, 0x0002, 0x0002,0x13f4)
new_len is 0x0002
kobjsize is 0x1000
ksize is 0x0002
Unable to allocate RAM for process text/data, errno 12

ksize() is reporting 0x2 (and that's what binfmt_flat passed in), 
but kobjsize() is reporting 0x1000.  This trigggers the test in 
do_mremap and the application fails with -ENOMEM.


With SLAB it's fine.

Inspired by this patch from last year

http://mailman.uclinux.org/pipermail/uclinux-dev/2006-July/039232.html

I've got the following that seems to work OK:

Index: nommu.c
===
--- nommu.c (revision 2640)
+++ nommu.c (working copy)
@@ -112,13 +112,7 @@
if (!objp || !((page = virt_to_page(objp
return 0;

-   if (PageSlab(page))
-   return ksize(objp);
-
-   BUG_ON(page-index  0);
-   BUG_ON(page-index = MAX_ORDER);
-
-   return (PAGE_SIZE  page-index);
+   return ksize(objp);
 }

Any thoughts?  It seems that this is a known issue with SLOB.

Thanks,

John

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev