Skip to content
Snippets Groups Projects
  • Stephen Smalley's avatar
    fea6e66f
    Allow kernel domain, not init domain, to set SELinux enforcing mode. · fea6e66f
    Stephen Smalley authored
    As per the discussion in:
    https://android-review.googlesource.com/#/c/71184/
    
    
    
    init sets the enforcing mode in its code prior to switching to
    the init domain via a setcon command in the init.rc file.  Hence,
    the setenforce permission is checked while still running in the
    kernel domain.  Further, as init has no reason to ever set the
    enforcing mode again, we do not need to allow setenforce to the
    init domain and this prevents reverting to permissive
    mode via an errant write by init later.  We could technically
    dontaudit the kernel setenforce access instead since the first
    call to setenforce happens while still permissive (and thus we
    never need to allow it in policy) but we allow it to more accurately
    represent what is possible.
    
    Change-Id: I70b5e6d8c99e0566145b9c8df863cc8a34019284
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    fea6e66f
    History
    Allow kernel domain, not init domain, to set SELinux enforcing mode.
    Stephen Smalley authored
    As per the discussion in:
    https://android-review.googlesource.com/#/c/71184/
    
    
    
    init sets the enforcing mode in its code prior to switching to
    the init domain via a setcon command in the init.rc file.  Hence,
    the setenforce permission is checked while still running in the
    kernel domain.  Further, as init has no reason to ever set the
    enforcing mode again, we do not need to allow setenforce to the
    init domain and this prevents reverting to permissive
    mode via an errant write by init later.  We could technically
    dontaudit the kernel setenforce access instead since the first
    call to setenforce happens while still permissive (and thus we
    never need to allow it in policy) but we allow it to more accurately
    represent what is possible.
    
    Change-Id: I70b5e6d8c99e0566145b9c8df863cc8a34019284
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>