• Stephen Smalley's avatar
    selinux: dynamic class/perm discovery · c6d3aaa4
    Stephen Smalley authored
    Modify SELinux to dynamically discover class and permission values
    upon policy load, based on the dynamic object class/perm discovery
    logic from libselinux.  A mapping is created between kernel-private
    class and permission indices used outside the security server and the
    policy values used within the security server.
    
    The mappings are only applied upon kernel-internal computations;
    similar mappings for the private indices of userspace object managers
    is handled on a per-object manager basis by the userspace AVC.  The
    interfaces for compute_av and transition_sid are split for kernel
    vs. userspace; the userspace functions are distinguished by a _user
    suffix.
    
    The kernel-private class indices are no longer tied to the policy
    values and thus do not need to skip indices for userspace classes;
    thus the kernel class index values are compressed.  The flask.h
    definitions were regenerated by deleting the userspace classes from
    refpolicy's definitions and then regenerating the headers.  Going
    forward, we can just maintain the flask.h, av_permissions.h, and
    classmap.h definitions separately from policy as they are no longer
    tied to the policy values.  The next patch introduces a utility to
    automate generation of flask.h and av_permissions.h from the
    classmap.h definitions.
    
    The older kernel class and permission string tables are removed and
    replaced by a single security class mapping table that is walked at
    policy load to generate the mapping.  The old kernel class validation
    logic is completely replaced by the mapping logic.
    
    The handle unknown logic is reworked.  reject_unknown=1 is handled
    when the mappings are computed at policy load time, similar to the old
    handling by the class validation logic.  allow_unknown=1 is handled
    when computing and mapping decisions - if the permission was not able
    to be mapped (i.e. undefined, mapped to zero), then it is
    automatically added to the allowed vector.  If the class was not able
    to be mapped (i.e. undefined, mapped to zero), then all permissions
    are allowed for it if allow_unknown=1.
    
    avc_audit leverages the new security class mapping table to lookup the
    class and permission names from the kernel-private indices.
    
    The mdp program is updated to use the new table when generating the
    class definitions and allow rules for a minimal boot policy for the
    kernel.  It should be noted that this policy will not include any
    userspace classes, nor will its policy index values for the kernel
    classes correspond with the ones in refpolicy (they will instead match
    the kernel-private indices).
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    Signed-off-by: default avatarJames Morris <jmorris@namei.org>
    c6d3aaa4
Name
Last commit
Last update
..
basic Loading commit data...
dtc Loading commit data...
genksyms Loading commit data...
kconfig Loading commit data...
ksymoops Loading commit data...
mod Loading commit data...
package Loading commit data...
rt-tester Loading commit data...
selinux Loading commit data...
tracing Loading commit data...
.gitignore Loading commit data...
Kbuild.include Loading commit data...
Lindent Loading commit data...
Makefile Loading commit data...
Makefile.build Loading commit data...
Makefile.clean Loading commit data...
Makefile.fwinst Loading commit data...
Makefile.headersinst Loading commit data...
Makefile.host Loading commit data...
Makefile.lib Loading commit data...
Makefile.modinst Loading commit data...
Makefile.modpost Loading commit data...
bin2c.c Loading commit data...
binoffset.c Loading commit data...
bloat-o-meter Loading commit data...
bootgraph.pl Loading commit data...
checkincludes.pl Loading commit data...
checkkconfigsymbols.sh Loading commit data...
checkpatch.pl Loading commit data...
checkstack.pl Loading commit data...
checksyscalls.sh Loading commit data...
checkversion.pl Loading commit data...
cleanfile Loading commit data...
cleanpatch Loading commit data...
config Loading commit data...
conmakehash.c Loading commit data...
decodecode Loading commit data...
diffconfig Loading commit data...
export_report.pl Loading commit data...
extract-ikconfig Loading commit data...
gcc-version.sh Loading commit data...
gcc-x86_32-has-stack-protector.sh Loading commit data...
gcc-x86_64-has-stack-protector.sh Loading commit data...
gen_initramfs_list.sh Loading commit data...
get_maintainer.pl Loading commit data...
gfp-translate Loading commit data...
headerdep.pl Loading commit data...
headers.sh Loading commit data...
headers_check.pl Loading commit data...
headers_install.pl Loading commit data...
kallsyms.c Loading commit data...
kernel-doc Loading commit data...
makelst Loading commit data...
markup_oops.pl Loading commit data...
mkcompile_h Loading commit data...
mkmakefile Loading commit data...
mksysmap Loading commit data...
mkuboot.sh Loading commit data...
mkversion Loading commit data...
module-common.lds Loading commit data...
namespace.pl Loading commit data...
patch-kernel Loading commit data...
pnmtologo.c Loading commit data...
profile2linkerlist.pl Loading commit data...
recordmcount.pl Loading commit data...
setlocalversion Loading commit data...
show_delta Loading commit data...
tags.sh Loading commit data...
unifdef.c Loading commit data...
ver_linux Loading commit data...