diff options
author | Eric Paris <eparis@redhat.com> | 2007-06-28 15:55:21 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2007-07-11 22:52:29 -0400 |
commit | ed0321895182ffb6ecf210e066d87911b270d587 (patch) | |
tree | 832bb54666f73b06e55322df40f915c5e9ef64d7 /security/security.c | |
parent | 13bddc2e9d591e31bf20020dc19ea6ca85de420e (diff) |
security: Protection for exploiting null dereference using mmap
Add a new security check on mmap operations to see if the user is attempting
to mmap to low area of the address space. The amount of space protected is
indicated by the new proc tunable /proc/sys/vm/mmap_min_addr and defaults to
0, preserving existing behavior.
This patch uses a new SELinux security class "memprotect." Policy already
contains a number of allow rules like a_t self:process * (unconfined_t being
one of them) which mean that putting this check in the process class (its
best current fit) would make it useless as all user processes, which we also
want to protect against, would be allowed. By taking the memprotect name of
the new class it will also make it possible for us to move some of the other
memory protect permissions out of 'process' and into the new class next time
we bump the policy version number (which I also think is a good future idea)
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c index fc8601b2b7ac..024484fc59b0 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -24,6 +24,7 @@ extern struct security_operations dummy_security_ops; | |||
24 | extern void security_fixup_ops(struct security_operations *ops); | 24 | extern void security_fixup_ops(struct security_operations *ops); |
25 | 25 | ||
26 | struct security_operations *security_ops; /* Initialized to NULL */ | 26 | struct security_operations *security_ops; /* Initialized to NULL */ |
27 | unsigned long mmap_min_addr; /* 0 means no protection */ | ||
27 | 28 | ||
28 | static inline int verify(struct security_operations *ops) | 29 | static inline int verify(struct security_operations *ops) |
29 | { | 30 | { |
@@ -176,4 +177,5 @@ EXPORT_SYMBOL_GPL(register_security); | |||
176 | EXPORT_SYMBOL_GPL(unregister_security); | 177 | EXPORT_SYMBOL_GPL(unregister_security); |
177 | EXPORT_SYMBOL_GPL(mod_reg_security); | 178 | EXPORT_SYMBOL_GPL(mod_reg_security); |
178 | EXPORT_SYMBOL_GPL(mod_unreg_security); | 179 | EXPORT_SYMBOL_GPL(mod_unreg_security); |
180 | EXPORT_SYMBOL_GPL(mmap_min_addr); | ||
179 | EXPORT_SYMBOL(security_ops); | 181 | EXPORT_SYMBOL(security_ops); |