Re: nommu: handling anonymous mmap clearing in userspace rather than kernel



Mike Frysinger wrote:
On Wed, Apr 2, 2008 at 10:20 AM, David Howells <dhowells@xxxxxxxxxx> wrote:
Mike Frysinger <vapier.adi@xxxxxxxxx> wrote:
> a workaround: introduce a new no-mmu-only mmap flag MAP_UNINITIALIZE
> to signal to the kernel that it should skip the memset(). this way,
> userspace malloc() can do mmap(MAP_ANONYMOUS|MAP_UNINITIALIZE) to get
> large chunks of memory without affecting any other anonymous mmap()
> call.

I think that's reasonable for NOMMU. It's not like the process accessing the
uninitialised memory is prevented from accessing anything it wants to anyway.

I would vote that the memset() should only be skipped if requested as there
may be programs that call mmap(MAP_ANONYMOUS) expecting the memory they're
given to be zeroed out.

in the second proposal, the C library would be expected to do this, so
no programs would be broken. but you're right that any program that
invokes the mmap() syscall directly would not get zeroed memory ...
but is anyone doing such a crazy thing, let alone on embedded ?

It's not a guarantee we should break. What's wrong with just using the MAP_UNINITIALIZE code we have?


Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Initialization of very large blocks of memory
    ... After that, we initialize that memory: ... Is there any way to manage performance ot the initializing (not necessarily using memset)? ... Since vallocexplicitly says it doesn't initialize and is managed by ... thread within the kernel... ...
    (comp.sys.hp.hpux)
  • Re: why it is not work?
    ... you use memset() to set memory pointed to by pointer data ... If pointer data is not initialized, ... If malloccan't allocate memory, it returns NULL, and dereferencing ...
    (comp.lang.c)
  • Re: Make sure we populate the initroot filesystem late enough
    ... Clearly something is using that memory. ... the commit that you bisected to is just showing the problem indirectly. ... memset() might still make it more obvious, ... the memsethopefully catching the problem.. ...
    (Linux-Kernel)
  • Re: Middle parameter to memset that will achieve UCHAR_MAX
    ... What argument can I give memset in order to set an entire chunk of ... memory to all bits 1? ... shite I got back in the other thread. ...
    (comp.lang.c)
  • Middle parameter to memset that will achieve UCHAR_MAX
    ... What argument can I give memset in order to set an entire chunk of ... memory to all bits 1? ... consistent result across all implementations if we use it? ...
    (comp.lang.c)