selinux/checkpolicy
Jeff Vander Stoep 80bc7ee8fa Add support for ioctl command whitelisting
Adds support for new policy statements whitelisting individual ioctl
commands. Ioctls provide many of the operations necessary for driver control.
The typical driver supports a device specific set of operations accessible
by the ioctl system call and specified by the command argument. SELinux
provides per operation access control to many system operations e.g. chown,
kill, setuid, ipc_lock, etc. Ioclts on the other hand are granted on a per
file descriptor basis using the ioctl permission, meaning that the set of
operations provided by the driver are granted on an all-or-nothing basis.
In some cases this may be acceptable, but often the same driver provides a
large and diverse set of operations such as benign and necessary functionality
as well as dangerous capabilities or access to system information that should
be restricted.

Example policy:
allow <source> <target>:<class> { 0x8900-0x8905 0x8910 }
auditallow <source> <target>:<class> 0x8901

The ioctl permission is still required in order to make an ioctl call. If no
individual ioctl commands are specified, only the ioctl permission is
checked by the kernel - i.e. status quo. This allows ioctl whitelisting to
done in a targeted manner, protecting desired drivers without requiring every
ioctl command to be known and specified before use and otherwise allowing
existing policy to be used as-is.

This only implements ioctl whitelisting support for monolithic kernel policies
built via checkpolicy. Support for modules and CIL remains to be done.

Bug: 19419509
Change-Id: I198e8c9279b94d8ce4ae5625018daa99577ee970
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
2015-04-23 08:30:33 -04:00
..
test checkpolicy: fgets function warnings fix for dismod and dispol 2015-02-26 15:00:27 -05:00
.gitignore Repo: update .gitignore 2011-08-02 13:31:51 -04:00
Android.mk Global C++11 compatibility. 2015-01-21 14:00:01 -05:00
ChangeLog Update ChangeLogs. 2015-04-02 10:52:25 -04:00
checkmodule.8 checkpolicy: Add support for generating CIL 2015-04-01 13:09:26 -04:00
checkmodule.c checkpolicy: Add support for generating CIL 2015-04-01 13:09:26 -04:00
checkpolicy.8 checkpolicy: Add support for generating CIL 2015-04-01 13:09:26 -04:00
checkpolicy.c checkpolicy: Add support for generating CIL 2015-04-01 13:09:26 -04:00
checkpolicy.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
COPYING initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
module_compiler.c checkpolicy: fix gcc -Wunused-variable warnings 2014-10-02 09:56:41 -04:00
module_compiler.h checkpolicy: Separate tunable from boolean during compile. 2011-09-16 11:54:01 -04:00
parse_util.c initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
parse_util.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
policy_define.c Add support for ioctl command whitelisting 2015-04-23 08:30:33 -04:00
policy_define.h Add support for ioctl command whitelisting 2015-04-23 08:30:33 -04:00
policy_parse.y Add support for ioctl command whitelisting 2015-04-23 08:30:33 -04:00
policy_scan.l libsepol, checkpolicy: add device tree ocontext nodes to Xen policy 2015-03-18 08:16:44 -04:00
queue.c initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
queue.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
VERSION Bump to final release 2015-02-02 09:38:10 -05:00