Should mprotect(..., PROT_EXEC) be checked by IMA?

Igor Zhbanov i.zhbanov at
Fri Mar 29 12:50:43 UTC 2019

On 29.03.2019 15:28, Stephen Smalley wrote:
> On 3/29/19 6:59 AM, Mimi Zohar wrote:
>> [Cc'ing the LSM mailing list and others]
>> On Fri, 2019-03-29 at 13:00 +0300, Igor Zhbanov wrote:
>>> Hi Mimi,On 28.03.2019 20:17, Mimi Zohar wrote:
>>>> I just came across the grsecurity article on mprotect.[1]
>>>>   Has anyone looked at it? Would it make sense to make it a minor LSM?
>>>> [1]
>>> Interesting article. It is almost exactly of what I wanted to be
>>> implemented.
>>> If this minor LSM would be stackable to allow combining with e.g. SELinux
>>> then why not.
>> Stacking shouldn't be a problem.  Other LSMs are already on the
>> mprotect hook.  Let's hear what others think.
> SELinux already provides a set of controls over executable mappings;
> see selinux_mmap_file and selinux_file_mprotect. Other major security
> modules may do likewise but I can't speak to that. Is there some gap
> you are trying to address that isn't already covered, or are you just
> trying to provide such restrictions without requiring one of the
> major modules?

I want to be sure that no unsigned code page could be executed. So exploits
could only be of ROP kind and not being able to download any extra code
from their servers. That's why I found that disabling of anonymous executable
pages could be useful for that (as well as disabling of making executable
pages writable to modify already mapped code). In conjunction with IMA it
should guarantee that no untrusted code could be executed.

As for SELinux abilities I need to check what can it do and what can't. Don't
ready to comment on that now. Will check.

As for modular approach I think that having this feature separately is
beneficial for distros do not using SELinux.

More information about the Linux-security-module-archive mailing list