Skip to content
Snippets Groups Projects
  • Stephen Smalley's avatar
    4397f082
    sepolicy: Define and allow map permission · 4397f082
    Stephen Smalley authored
    
    Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for mmap")
    added a map permission check on mmap so that we can
    distinguish memory mapped access (since it has different implications
    for revocation).  The purpose of a separate map permission check on
    mmap(2) is to permit policy to prohibit memory mapping of specific files
    for which we need to ensure that every access is revalidated, particularly
    useful for scenarios where we expect the file to be relabeled at runtime
    in order to reflect state changes (e.g. cross-domain solution, assured
    pipeline without data copying).  The kernel commit is anticipated to
    be included in Linux 4.13.
    
    This change defines map permission for the Android policy.  It mirrors
    the definition in the kernel classmap by adding it to the common
    definitions for files and sockets.  This will break compatibility for
    kernels that predate the dynamic class/perm mapping support (< 2.6.33);
    on such kernels, one would instead need to add map permission
    to the end of each file and socket access vector.
    
    This change also adds map permission to the global macro definitions for
    file permissions, thereby allowing it in any allow rule that uses these
    macros, and to specific rules allowing mapping of files from /system
    and executable types. This should cover most cases where it is needed,
    although it may still need to be added to specific allow rules when the
    global macros are not used.
    
    Test: Policy builds
    
    Change-Id: Iab3ccd2b6587618e68ecab58218838749fe5e7f5
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    4397f082
    History
    sepolicy: Define and allow map permission
    Stephen Smalley authored
    
    Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for mmap")
    added a map permission check on mmap so that we can
    distinguish memory mapped access (since it has different implications
    for revocation).  The purpose of a separate map permission check on
    mmap(2) is to permit policy to prohibit memory mapping of specific files
    for which we need to ensure that every access is revalidated, particularly
    useful for scenarios where we expect the file to be relabeled at runtime
    in order to reflect state changes (e.g. cross-domain solution, assured
    pipeline without data copying).  The kernel commit is anticipated to
    be included in Linux 4.13.
    
    This change defines map permission for the Android policy.  It mirrors
    the definition in the kernel classmap by adding it to the common
    definitions for files and sockets.  This will break compatibility for
    kernels that predate the dynamic class/perm mapping support (< 2.6.33);
    on such kernels, one would instead need to add map permission
    to the end of each file and socket access vector.
    
    This change also adds map permission to the global macro definitions for
    file permissions, thereby allowing it in any allow rule that uses these
    macros, and to specific rules allowing mapping of files from /system
    and executable types. This should cover most cases where it is needed,
    although it may still need to be added to specific allow rules when the
    global macros are not used.
    
    Test: Policy builds
    
    Change-Id: Iab3ccd2b6587618e68ecab58218838749fe5e7f5
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>