Skip to content

Commit

Permalink
Merge pull request #1893 from WOnder93/more-early-boot-overlay-fixes
Browse files Browse the repository at this point in the history
Allow kernel_t to manage and relabel all files
  • Loading branch information
rhatdan authored Oct 6, 2023
2 parents 74fd8bb + 2f17241 commit ce9c09a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
46 changes: 44 additions & 2 deletions policy/modules/kernel/files.if
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,12 @@ interface(`files_relabel_all_files',`
relabel_chr_files_pattern($1, { file_type $2 }, { file_type $2 })

# satisfy the assertions:
seutil_relabelto_bin_policy($1)
auth_relabelto_shadow($1)
optional_policy(`
seutil_relabelto_bin_policy($1)
')
optional_policy(`
auth_relabelto_shadow($1)
')
')

########################################
Expand Down Expand Up @@ -1835,6 +1839,44 @@ interface(`files_manage_all_files',`
')
')

########################################
## <summary>
## Manage all block device files on the filesystem.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`files_manage_all_blk_files',`
gen_require(`
attribute file_type;
')

manage_blk_files_pattern($1, file_type, file_type)
')

########################################
## <summary>
## Manage all character device files on the filesystem.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`files_manage_all_chr_files',`
gen_require(`
attribute file_type;
')

manage_chr_files_pattern($1, file_type, file_type)
')

########################################
## <summary>
## Grant execute access to all files on the filesystem,
Expand Down
3 changes: 3 additions & 0 deletions policy/modules/kernel/kernel.te
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ domain_rw_all_sockets(kernel_t)
domain_obj_id_change_exemption(kernel_t)

files_manage_all_files(kernel_t)
files_manage_all_blk_files(kernel_t)
files_manage_all_chr_files(kernel_t)
files_relabel_all_files(kernel_t)
# The 'execute' permission on lower inodes is checked against the mounter
# cred by overlayfs, so we need to grant it to allow overlay mounts created
# during early boot to work.
Expand Down

0 comments on commit ce9c09a

Please sign in to comment.