Skip to content

Commit

Permalink
hard-wire legacy checkreqprot option to 0
Browse files Browse the repository at this point in the history
The userspace API is left intact for compatibility.
  • Loading branch information
thestinger committed Mar 9, 2018
1 parent 2611d8c commit 3a55b87
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 43 deletions.
10 changes: 0 additions & 10 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,6 @@
nosocket -- Disable socket memory accounting.
nokmem -- Disable kernel memory accounting.

checkreqprot [SELINUX] Set initial checkreqprot flag value.
Format: { "0" | "1" }
See security/selinux/Kconfig help text.
0 -- check protection applied by kernel (includes
any implied execute protection).
1 -- check protection requested by application.
Default value is set via a kernel config option.
Value can be changed at runtime via
/selinux/checkreqprot.

cio_ignore= [S390]
See Documentation/s390/CommonIO for details.
clk_ignore_unused
Expand Down
20 changes: 0 additions & 20 deletions security/selinux/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,3 @@ config SECURITY_SELINUX_AVC_STATS
This option collects access vector cache statistics to
/selinux/avc/cache_stats, which may be monitored via
tools such as avcstat.

config SECURITY_SELINUX_CHECKREQPROT_VALUE
int "NSA SELinux checkreqprot default value"
depends on SECURITY_SELINUX
range 0 1
default 0
help
This option sets the default value for the 'checkreqprot' flag
that determines whether SELinux checks the protection requested
by the application or the protection that will be applied by the
kernel (including any implied execute for read-implies-exec) for
mmap and mprotect calls. If this option is set to 0 (zero),
SELinux will default to checking the protection that will be applied
by the kernel. If this option is set to 1 (one), SELinux will
default to checking the protection requested by the application.
The checkreqprot flag may be changed from the default via the
'checkreqprot=' boot parameter. It may also be changed at runtime
via /selinux/checkreqprot if authorized by policy.

If you are unsure how to answer this question, answer 0.
2 changes: 1 addition & 1 deletion security/selinux/include/objsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ struct bpf_security_struct {
u32 sid; /*SID of bpf obj creater*/
};

extern unsigned int selinux_checkreqprot;
extern const unsigned int selinux_checkreqprot;

#endif /* _SELINUX_OBJSEC_H_ */
14 changes: 2 additions & 12 deletions security/selinux/selinuxfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,7 @@
#include "objsec.h"
#include "conditional.h"

unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE;

static int __init checkreqprot_setup(char *str)
{
unsigned long checkreqprot;
if (!kstrtoul(str, 0, &checkreqprot))
selinux_checkreqprot = checkreqprot ? 1 : 0;
return 1;
}
__setup("checkreqprot=", checkreqprot_setup);
const unsigned int selinux_checkreqprot;

static DEFINE_MUTEX(sel_mutex);

Expand Down Expand Up @@ -610,10 +601,9 @@ static ssize_t sel_write_checkreqprot(struct file *file, const char __user *buf,
return PTR_ERR(page);

length = -EINVAL;
if (sscanf(page, "%u", &new_value) != 1)
if (sscanf(page, "%u", &new_value) != 1 || new_value)
goto out;

selinux_checkreqprot = new_value ? 1 : 0;
length = count;
out:
kfree(page);
Expand Down

0 comments on commit 3a55b87

Please sign in to comment.