selinux: place open in the common file perms
PATCH 1/2 selinux: place open in the common file perms
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
---
security/selinux/hooks.c | 24 +++--------------------- security/selinux/include/classmap.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 28 deletions(-)
security/selinux/hooks.c +3 -21
@@ -1828,27 +1828,9 @@ static inline u32 open_file_to_av(struct file *file) {u32 av =file_to_av (file); -if (selinux_policycap_openperm) { -mode_t mode = file->f_path.dentry->d_inode->i_mode; -/* -* lnk files and socks do not really have an 'open' -*/ -if (S_ISREG (mode)) - av |=FILE__OPEN ; -else if (S_ISCHR (mode)) - av |=CHR_FILE__OPEN ; -else if (S_ISBLK (mode)) - av |=BLK_FILE__OPEN ; -else if (S_ISFIFO (mode)) - av |=FIFO_FILE__OPEN ; -else if (S_ISDIR (mode)) - av |=DIR__OPEN ; -else if (S_ISSOCK (mode)) - av |=SOCK_FILE__OPEN ; -else -printk (KERN_ERR "SELinux: WARNING: inside %s with " -"unknown mode:%o\n" , __func__, mode); - } +if (selinux_policycap_openperm) + av |=FILE__OPEN ; +return av; }
security/selinux/include/classmap.h +8 -7
@@ -2,7 +2,8 @@ "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ - "rename", "execute", "swapon", "quotaon", "mounton", "audit_access" + "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ + "open"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \
@@ -43,22 +44,22 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", - "reparent", "search", "rmdir", "open", NULL } }, + "reparent", "search", "rmdir", NULL } }, { "fd", { "use", NULL } }, { "lnk_file", { COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, { "blk_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "sock_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "fifo_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } }, { "tcp_socket",
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
PATCH 2/2 SELinux: Move execmod to the common perms
execmod "could" show up on non regular files and non chr files. The current implementation would actually make these checks against non-existant bits since the code assumes the execmod permission is same for all file types. To make this line up for chr files we had to define execute_no_trans and entrypoint permissions. These permissions are unreachable and only existed to to make FILE__EXECMOD and CHR_FILE__EXECMOD the same. This patch drops those needless perms as well.
---
security/selinux/include/classmap.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
security/selinux/include/classmap.h +3 -4
@@ -3,7 +3,7 @@#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ - "open" + "open", "execmod"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \
@@ -44,7 +44,7 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", NULL } }, + "execute_no_trans", "entrypoint", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", "reparent", "search", "rmdir", NULL } },
@@ -52,8 +52,7 @@ struct security_class_mapping secclass_map[] = { {"lnk_file" , { COMMON_FILE_PERMS, NULL } }, {"chr_file" , - { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "blk_file", { COMMON_FILE_PERMS, NULL } }, { "sock_file",
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: [PATCH 2/2] SELinux: Move execmod to the common perms
Quoted 9 lines · Eric Paris
execmod "could" show up on non regular files and non chr files. The current implementation would actually make these checks against non-existant bits since the code assumes the execmod permission is same for all file types. To make this line up for chr files we had to define
execute_no_transand entrypoint permissions. These permissions are unreachable and only existed to to makeFILE__EXECMODandCHR_FILE__EXECMODthe same. This patch drops those needless perms as well.Signed-off-by Eric Paris <[email protected]>
Quoted 43 lines
---
security/selinux/include/classmap.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)security/selinux/include/classmap.h +3
-5@@ -3,7 +3,7 @@#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ - "open" + "open", "execmod"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \@@ -44,7 +44,7 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", NULL } }, + "execute_no_trans", "entrypoint", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", "reparent", "search", "rmdir", NULL } },@@ -52,8 +52,7 @@ struct security_class_mapping secclass_map[] = { {"lnk_file" , { COMMON_FILE_PERMS, NULL } }, {"chr_file" , - { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "blk_file", { COMMON_FILE_PERMS, NULL } }, { "sock_file", --This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
Quoted 91 lines
Signed-off-by Eric Paris <[email protected]>---
security/selinux/hooks.c | 24 +++--------------------- security/selinux/include/classmap.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 28 deletions(-)security/selinux/hooks.c +3
-21@@ -1828,27 +1828,9 @@ static inline u32 open_file_to_av(struct file *file) {u32 av =file_to_av (file); -if (selinux_policycap_openperm) { -mode_t mode = file->f_path.dentry->d_inode->i_mode; -/* -* lnk files and socks do not really have an 'open' -*/ -if (S_ISREG (mode)) - av |=FILE__OPEN ; -else if (S_ISCHR (mode)) - av |=CHR_FILE__OPEN ; -else if (S_ISBLK (mode)) - av |=BLK_FILE__OPEN ; -else if (S_ISFIFO (mode)) - av |=FIFO_FILE__OPEN ; -else if (S_ISDIR (mode)) - av |=DIR__OPEN ; -else if (S_ISSOCK (mode)) - av |=SOCK_FILE__OPEN ; -else -printk (KERN_ERR "SELinux: WARNING: inside %s with " -"unknown mode:%o\n" , __func__, mode); - } +if (selinux_policycap_openperm) + av |=FILE__OPEN ; +return av; }security/selinux/include/classmap.h +8
-8@@ -2,7 +2,8 @@ "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ - "rename", "execute", "swapon", "quotaon", "mounton", "audit_access" + "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ + "open"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \@@ -43,22 +44,22 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", - "reparent", "search", "rmdir", "open", NULL } }, + "reparent", "search", "rmdir", NULL } }, { "fd", { "use", NULL } }, { "lnk_file", { COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, { "blk_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "sock_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "fifo_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } }, { "tcp_socket", --This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Signature · 10 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
No, you don't have to change anything in the policy - that's the point of the dynamic class/perm discovery support in the kernel. The kernel will map its notion of open permission to the policy values at policy load time and will then map access vectors accordingly.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 5 lines · Stephen Smalley
Quoted 4 lines · Christopher J. PeBenito
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
Quoted 8 lines
Quoted 2 lines
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
No, you don't have to change anything in the policy - that's the point of the dynamic class/perm discovery support in the kernel. The kernel will map its notion of open permission to the policy values at policy load time and will then map access vectors accordingly.
So do common permissions even need to be defined in a policy?
Signature · 8 lines
James Carter <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 9 lines · James Carter
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
Quoted 7 lines
Quoted 5 lines
No, you don't have to change anything in the policy - that's the point of the dynamic class/perm discovery support in the kernel. The kernel will map its notion of open permission to the policy values at policy load time and will then map access vectors accordingly.
So do common permissions even need to be defined in a policy?
No, there does not need to be a common permissions abstraction in userspace policy. The permissions themselves must be defined though. It 'might' be a reasonable idea to get rid of the abstraction. The benefit is that noone will add a new permission to the common perms and break all pre 2.6.28 compatibility.
The drawback is that when we add something to the common perms in the kernel we have a little harder time figuring out where they need to be in userspace (as opposed to my current search on "inherits file"). The kernel does nicely spit out messages about each missing class and perm so it isn't a big deal.
Would anyone like to see a policy patch that just eliminates the userspace policy common perms stuff?
-Eric
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 24 lines · Eric Paris
Quoted 9 lines · James Carter
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
Quoted 7 lines
Quoted 5 lines
No, you don't have to change anything in the policy - that's the point of the dynamic class/perm discovery support in the kernel. The kernel will map its notion of open permission to the policy values at policy load time and will then map access vectors accordingly.
So do common permissions even need to be defined in a policy?
No, there does not need to be a common permissions abstraction in userspace policy. The permissions themselves must be defined though. It 'might' be a reasonable idea to get rid of the abstraction. The benefit is that noone will add a new permission to the common perms and break all pre 2.6.28 compatibility.
Quoted 8 lines
The drawback is that when we add something to the common perms in the kernel we have a little harder time figuring out where they need to be in userspace (as opposed to my current search on "inherits file"). The kernel does nicely spit out messages about each missing class and perm so it isn't a big deal.
Would anyone like to see a policy patch that just eliminates the userspace policy common perms stuff?
Can't do it without breaking compatibility on older kernels (which validated both common and class definitions at policy load).
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Christopher J. PeBenito
Quoted 2 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
So I need to move open into the common perms in the policy? Thats going to be a nasty compatibility problem for older systems.
I do have some policy patches in my queue, but the answer is no, you don't. Userspace and kernel no longer need to line up! The only difference this particular patch would make to userspace policy is to require we add open to lnk files (or silence the warning we get in kernel that it isn't defined)
-Eric
Quoted 88 lines
Quoted 88 lines
Signed-off-by Eric Paris <[email protected]>---
security/selinux/hooks.c | 24 +++--------------------- security/selinux/include/classmap.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 28 deletions(-)security/selinux/hooks.c +3
-21@@ -1828,27 +1828,9 @@ static inline u32 open_file_to_av(struct file *file) {u32 av =file_to_av (file); -if (selinux_policycap_openperm) { -mode_t mode = file->f_path.dentry->d_inode->i_mode; -/* -* lnk files and socks do not really have an 'open' -*/ -if (S_ISREG (mode)) - av |=FILE__OPEN ; -else if (S_ISCHR (mode)) - av |=CHR_FILE__OPEN ; -else if (S_ISBLK (mode)) - av |=BLK_FILE__OPEN ; -else if (S_ISFIFO (mode)) - av |=FIFO_FILE__OPEN ; -else if (S_ISDIR (mode)) - av |=DIR__OPEN ; -else if (S_ISSOCK (mode)) - av |=SOCK_FILE__OPEN ; -else -printk (KERN_ERR "SELinux: WARNING: inside %s with " -"unknown mode:%o\n" , __func__, mode); - } +if (selinux_policycap_openperm) + av |=FILE__OPEN ; +return av; }security/selinux/include/classmap.h +8
-7@@ -2,7 +2,8 @@ "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ - "rename", "execute", "swapon", "quotaon", "mounton", "audit_access" + "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ + "open"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \@@ -43,22 +44,22 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", - "reparent", "search", "rmdir", "open", NULL } }, + "reparent", "search", "rmdir", NULL } }, { "fd", { "use", NULL } }, { "lnk_file", { COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, { "blk_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "sock_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "fifo_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } }, { "tcp_socket",
Quoted 5 lines
Quoted 4 lines
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
Signed-off-by Eric Paris <[email protected]>
Quoted 90 lines
---
security/selinux/hooks.c | 24 +++--------------------- security/selinux/include/classmap.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 28 deletions(-)security/selinux/hooks.c +3
-21@@ -1828,27 +1828,9 @@ static inline u32 open_file_to_av(struct file *file) {u32 av =file_to_av (file); -if (selinux_policycap_openperm) { -mode_t mode = file->f_path.dentry->d_inode->i_mode; -/* -* lnk files and socks do not really have an 'open' -*/ -if (S_ISREG (mode)) - av |=FILE__OPEN ; -else if (S_ISCHR (mode)) - av |=CHR_FILE__OPEN ; -else if (S_ISBLK (mode)) - av |=BLK_FILE__OPEN ; -else if (S_ISFIFO (mode)) - av |=FIFO_FILE__OPEN ; -else if (S_ISDIR (mode)) - av |=DIR__OPEN ; -else if (S_ISSOCK (mode)) - av |=SOCK_FILE__OPEN ; -else -printk (KERN_ERR "SELinux: WARNING: inside %s with " -"unknown mode:%o\n" , __func__, mode); - } +if (selinux_policycap_openperm) + av |=FILE__OPEN ; +return av; }security/selinux/include/classmap.h +8
-8@@ -2,7 +2,8 @@ "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ - "rename", "execute", "swapon", "quotaon", "mounton", "audit_access" + "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ + "open"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \@@ -43,22 +44,22 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", - "reparent", "search", "rmdir", "open", NULL } }, + "reparent", "search", "rmdir", NULL } }, { "fd", { "use", NULL } }, { "lnk_file", { COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, { "blk_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "sock_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "fifo_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } }, { "tcp_socket", --This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Eric Paris
kernel can dynamically remap perms. Drop the open lookup table and put open in the common file perms.
Signed-off-by Eric Paris <[email protected]>
This does not apply to my tree -- looks like the audit_access patch is a pre-req.
Quoted 85 lines
---
security/selinux/hooks.c | 24 +++--------------------- security/selinux/include/classmap.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 28 deletions(-)security/selinux/hooks.c +3
-21@@ -1828,27 +1828,9 @@ static inline u32 open_file_to_av(struct file *file) {u32 av =file_to_av (file); -if (selinux_policycap_openperm) { -mode_t mode = file->f_path.dentry->d_inode->i_mode; -/* -* lnk files and socks do not really have an 'open' -*/ -if (S_ISREG (mode)) - av |=FILE__OPEN ; -else if (S_ISCHR (mode)) - av |=CHR_FILE__OPEN ; -else if (S_ISBLK (mode)) - av |=BLK_FILE__OPEN ; -else if (S_ISFIFO (mode)) - av |=FIFO_FILE__OPEN ; -else if (S_ISDIR (mode)) - av |=DIR__OPEN ; -else if (S_ISSOCK (mode)) - av |=SOCK_FILE__OPEN ; -else -printk (KERN_ERR "SELinux: WARNING: inside %s with " -"unknown mode:%o\n" , __func__, mode); - } +if (selinux_policycap_openperm) + av |=FILE__OPEN ; +return av; }security/selinux/include/classmap.h +8
-7@@ -2,7 +2,8 @@ "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"#define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ - "rename", "execute", "swapon", "quotaon", "mounton", "audit_access" + "rename", "execute", "swapon", "quotaon", "mounton", "audit_access", \ + "open"#define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \@@ -43,22 +44,22 @@ struct security_class_mapping secclass_map[] = { "quotaget", NULL } }, {"file" , { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, {"dir" , { COMMON_FILE_PERMS, "add_name", "remove_name", - "reparent", "search", "rmdir", "open", NULL } }, + "reparent", "search", "rmdir", NULL } }, { "fd", { "use", NULL } }, { "lnk_file", { COMMON_FILE_PERMS, NULL } }, { "chr_file", { COMMON_FILE_PERMS, - "execute_no_trans", "entrypoint", "execmod", "open", NULL } }, + "execute_no_trans", "entrypoint", "execmod", NULL } }, { "blk_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "sock_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "fifo_file", - { COMMON_FILE_PERMS, "open", NULL } }, + { COMMON_FILE_PERMS, NULL } }, { "socket", { COMMON_SOCK_PERMS, NULL } }, { "tcp_socket",
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.