Skip to content

Commit 6a7d4fc

Browse files
committed
hard-wire legacy checkreqprot option to 0
The userspace API is left intact for compatibility.
1 parent 69af890 commit 6a7d4fc

File tree

4 files changed

+3
-43
lines changed

4 files changed

+3
-43
lines changed

Documentation/admin-guide/kernel-parameters.txt

-10
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,6 @@
490490
nosocket -- Disable socket memory accounting.
491491
nokmem -- Disable kernel memory accounting.
492492

493-
checkreqprot [SELINUX] Set initial checkreqprot flag value.
494-
Format: { "0" | "1" }
495-
See security/selinux/Kconfig help text.
496-
0 -- check protection applied by kernel (includes
497-
any implied execute protection).
498-
1 -- check protection requested by application.
499-
Default value is set via a kernel config option.
500-
Value can be changed at runtime via
501-
/selinux/checkreqprot.
502-
503493
cio_ignore= [S390]
504494
See Documentation/s390/CommonIO for details.
505495
clk_ignore_unused

security/selinux/Kconfig

-20
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,3 @@ config SECURITY_SELINUX_AVC_STATS
7979
This option collects access vector cache statistics to
8080
/selinux/avc/cache_stats, which may be monitored via
8181
tools such as avcstat.
82-
83-
config SECURITY_SELINUX_CHECKREQPROT_VALUE
84-
int "NSA SELinux checkreqprot default value"
85-
depends on SECURITY_SELINUX
86-
range 0 1
87-
default 0
88-
help
89-
This option sets the default value for the 'checkreqprot' flag
90-
that determines whether SELinux checks the protection requested
91-
by the application or the protection that will be applied by the
92-
kernel (including any implied execute for read-implies-exec) for
93-
mmap and mprotect calls. If this option is set to 0 (zero),
94-
SELinux will default to checking the protection that will be applied
95-
by the kernel. If this option is set to 1 (one), SELinux will
96-
default to checking the protection requested by the application.
97-
The checkreqprot flag may be changed from the default via the
98-
'checkreqprot=' boot parameter. It may also be changed at runtime
99-
via /selinux/checkreqprot if authorized by policy.
100-
101-
If you are unsure how to answer this question, answer 0.

security/selinux/include/objsec.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,6 @@ struct pkey_security_struct {
150150
u32 sid; /* SID of pkey */
151151
};
152152

153-
extern unsigned int selinux_checkreqprot;
153+
extern const unsigned int selinux_checkreqprot;
154154

155155
#endif /* _SELINUX_OBJSEC_H_ */

security/selinux/selinuxfs.c

+2-12
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,7 @@
4141
#include "objsec.h"
4242
#include "conditional.h"
4343

44-
unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE;
45-
46-
static int __init checkreqprot_setup(char *str)
47-
{
48-
unsigned long checkreqprot;
49-
if (!kstrtoul(str, 0, &checkreqprot))
50-
selinux_checkreqprot = checkreqprot ? 1 : 0;
51-
return 1;
52-
}
53-
__setup("checkreqprot=", checkreqprot_setup);
44+
const unsigned int selinux_checkreqprot;
5445

5546
static DEFINE_MUTEX(sel_mutex);
5647

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

612603
length = -EINVAL;
613-
if (sscanf(page, "%u", &new_value) != 1)
604+
if (sscanf(page, "%u", &new_value) != 1 || new_value)
614605
goto out;
615606

616-
selinux_checkreqprot = new_value ? 1 : 0;
617607
length = count;
618608
out:
619609
kfree(page);

0 commit comments

Comments
 (0)