Commit 0794c66d authored by Stephen Smalley's avatar Stephen Smalley Committed by James Morris

selinux: handle files opened with flags 3 by checking ioctl permission

Handle files opened with flags 3 by checking ioctl permission.

Default to returning FILE__IOCTL from file_to_av() if the f_mode has neither
FMODE_READ nor FMODE_WRITE, and thus check ioctl permission on exec or
transfer, thereby validating such descriptors early as with normal r/w
descriptors and catching leaks of them prior to attempted usage.
Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Acked-by: default avatarEric Paris <eparis@redhat.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 0e81a8ae
...@@ -1630,6 +1630,12 @@ static inline u32 file_to_av(struct file *file) ...@@ -1630,6 +1630,12 @@ static inline u32 file_to_av(struct file *file)
else else
av |= FILE__WRITE; av |= FILE__WRITE;
} }
if (!av) {
/*
* Special file opened with flags 3 for ioctl-only use.
*/
av = FILE__IOCTL;
}
return av; return av;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment