[PATCH v2] kexec: fix mmap return code handling

Michael Holzheu holzheu at linux.vnet.ibm.com
Thu Nov 26 11:02:35 PST 2015


On Thu, 26 Nov 2015 19:02:28 +0100
Petr Tesarik <ptesarik at suse.cz> wrote:

> On Thu, 26 Nov 2015 18:32:31 +0100
> Michael Holzheu <holzheu at linux.vnet.ibm.com> wrote:
> 
> > Hi Simon again,
> > 
> > After a bit more thinking: In theory mmap() could also return NULL.
> > Therefore the following fix is probably the better one ...
> 
> No, if you let the kernel choose the address (i.e. call mmap with NULL
> addr), it will return at least PAGE_SIZE (and a higher limit is usually
> enforced by sys.vm.mmap_min_addr sysctl). Admittedly the limit is set
> in arch-specific code, so theoretically there can be an architecture
> which sets the limit to 0, but I doubt it, because it would break too
> many assumptions in user space (for example gcc assumes that
> dereferencing a NULL pointer terminates a process).
>
> In short, this other fix is just as good as the previous one.

Hi Petr,

Thanks for clarification! I still would vote for the second one ;-)

Michael




More information about the kexec mailing list