On Wed, Apr 21, 2010 at 6:02 PM, Dragos Tatulea <[email protected]>wrote:

> >> I can think of 2 things you could do if you need fixed addresses:
> >> - write a page-fault handler in a driver and do the mmap through that
> >> driver. With that handler you can control access to the mmap'ed
> >> memory.
> >>
> > I can't (and also don't want to) modify the kernel :)
> Not even with a harmless driver? :)
>
> > Why do you say I would get to use sbrk? Actually, are brk and sbrk used
> for
> > anything these days?
> >
> Not anymore. Forgot about that.
>
> >>
> >> Why do you need fixed addresses though?
> >
> > I'm implementing a distributed memory with a shared address space. Each
> node
> > has part of the address space to play with, so it has to allocate stacks
> and
> > heaps in that region. But even if I didn't need a fixed mapping, how
> would
> > that help me? MAP_GROWSDOWN doesn't seem to make the mapping
> auto-expendable
> > anyway...
> >
>
Hi,
I don't think that making mapped region as MAP_GROWSDOWN will help you in
anyway.
This is valid only for region that are being used as stack. For user mode
stack mapped region is expanded automatically.
And before expanding the region kernel make sure that the region is being
used for stack via comparing the address with stack_pointer.

http://lxr.linux.no/#linux+v2.6.33/arch/x86/mm/fault.c#L1093

So if you are not using the region as stack then kernel will not expand that
region and this will result in segmentation fault.

Correct me if i am wrong.

~cnanda


> Hmm, out of ideas. I'd implement it myself.
>
> Thanks,
> Dragos
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to [email protected]
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

Reply via email to