Re: [PATCH] mm/nommu.c: Fix improperly call of security API in mmap

From: David Howells
Date: Thu Oct 15 2009 - 03:10:50 EST


graff yang <graff.yang@xxxxxxxxx> wrote:

> Your patch works both with SELINUX enabled or disabled.

Thanks.

> But, how to prevent the address that attempting to be mapped to be lower
> than CONFIG_LSM_MMAP_MIN_ADDR/CONFIG_DEFAULT_MMAP_MIN_ADDR?
> This is what the security_file_mmap() is doing and mmu's
> do_mmap_pgoff() has implemented.

You need to ask yourself two questions:

(1) Does the test make any sense in the NOMMU context? Given that the
userspace program _cannot_ specify that something should be mapped below
that address (since MAP_FIXED gives an error and the hint is ignored),
I'd say not.

(2) Is it likely that LSM security would be used with NOMMU anyway, given
that there is nothing stopping userspace programs editing the kernel
directly?

You need to show that it makes sense to do the test in a NOMMU context.
Remember, if there is no physical medium at address 0 (RAM, flash, whatever),
you can't map anything there. This might best be left to the arch to not
provide page 0 of RAM to the page allocator during memory initialisation.

David
--
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/