Re: Zeroed pages returned for heap

From: Nagendra Singh Tomar (nagendra_tomar_at_adaptec.com)
Date: 06/08/05

  • Next message: Grant Grundler: "Re: [Fastboot] Re: [RFC/PATCH] Kdump: Disabling PCI interrupts in capture kernel"
    Date:	Wed, 8 Jun 2005 09:38:05 +0530 (IST)
    To: Peter Staubach <staubach@redhat.com>
    
    

    On Tue, 7 Jun 2005, Peter Staubach wrote:

    > Nagendra Singh Tomar wrote:
    >
    > >Hi all,
    > > The short version first.
    > >Is it OK for an application (a C library implementing malloc/calloc is
    > >also an application) to assume that the pages returned by the OS for heap
    > >allocation (either directly thru brk() or thru mmap(MAP_ANONYMOUS)) will
    > >be zero filled.
    > >
    >
    > An application which makes assumptions about the contents of newly allocated
    > memory would seem to be making very dangerous assumptions.

    Thats what glibc does. Ulrich confirmed that. I would say thats not a bad
    optimization on glibc's part as it does not really make sense to zero out
    a memory again in user space if we know for sure that new heap memory that
    kernel hands over to us will be zeroed. I'm not sure though whether this
    is a documented kernel ABI.

    >
    > Ignoring that, would it not be considered to be a security violation to hand
    > pieces of memory to applications without erasing the old contents of the
    > pages?

    I understand that for a desktop/server running Linux but not for an
    embedded box where all the applications that run on the box is controlled
    by you.

    Thanx,
    Tomar

    -- You have moved the mouse. Windows must be restarted for the
       changes to take effect.

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


  • Next message: Grant Grundler: "Re: [Fastboot] Re: [RFC/PATCH] Kdump: Disabling PCI interrupts in capture kernel"

    Relevant Pages

    • Re: readdir loses renamed files
      ... > slower, penalizing all other applications on your system, just because ... > memory, while the application calls readdir(). ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: large files unnecessary trashing filesystem cache?
      ... > list about very large files trashing the filesystems memory cache leading to ... > My guess was, it has something to do with mm/readahead.c, a test limiting the ... Is there a reason why those applications couldn't use O_DIRECT? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • large files unnecessary trashing filesystem cache?
      ... list about very large files trashing the filesystems memory cache leading to ... Of course one could always implement f_advise-calls in all applications, ... My guess was, it has something to do with mm/readahead.c, a test limiting the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Testing optimize-for-size suitability?
      ... >> Is there a benchmark or set of benchmarks that would allow me to test ... I haven't noticed any other improvement, but I guess that more memory ... I will also try to compile other applications, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: memory problems
      ... I would guess that there is a memory leak somewhere in your code eating up ... the heap - coincidentally I think it might be in the software package you ... > start new applications: ... > "Cannot execute 'cmd'. ...
      (microsoft.public.windowsce.platbuilder)