Messages in this thread | | | Date | Fri, 16 Oct 2009 11:01:38 -0400 | Subject | Re: [PATCH] mm/nommu.c: Fix improperly call of security API in mmap | From | Eric Paris <> |
| |
On Wed, Oct 14, 2009 at 10:08 AM, David Howells <dhowells@redhat.com> wrote: > <graff.yang@gmail.com> wrote: > >> The original code calling security_file_mmap() use user's hint address >> as it's 5th argument(addr). This is improper, as the hint address may be >> NULL. >> In this case, the security_file_mmap() may incorrectly return -EPERM. >> >> This patch moved the calling of security_file_mmap() out of >> validate_mmap_request() to do_mmap_pgoff(), and call this >> security API with the address that attempting to mmap. > > I think this is the wrong approach. Firstly, the hint is cleared in NOMMU > mode, and secondly, I think that the check against the minimum LSM address is > pointless in NOMMU mode too.
I really don't like seeing such irrelevant (that's not the right word, but I can't think what is) ifdefs creeping down into the security layer as LSM authors are likely to mess them up in the future. I'd probably rather see the addr_only argument changed into a flags field. One for addr_only and one flag for not_addr. The nommu case could just set the not_addr flag and it's obvious how the LSMs (or capabilities if !CONFIG_SECURITY) should handle it, also works if some other future need arises...
-Eric -- 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/
| |