Signed-off-by: shiyunli <shiyunli@huawei.com>
This commit is contained in:
shiyunli
2024-10-15 16:12:51 +08:00
parent 9a3bb44771
commit 05e1fad4ed
2 changed files with 17 additions and 8 deletions
+9 -2
View File
@@ -309,14 +309,21 @@ static int xpm_check_prot(struct vm_area_struct *vma, unsigned long prot)
/* check for xpm region vma prot */
if (vma->vm_flags & VM_XPM) {
if (is_anon || (prot & PROT_EXEC)) {
xpm_log_error("xpm region mmap not allow anonymous or exec permission");
if (is_anon) {
vma->vm_flags &= ~VM_XPM;
goto next_check;
}
if ((prot & PROT_WRITE) || (prot & PROT_EXEC)) {
xpm_log_error("xpm region mmap not allow write or exec permission");
report_mmap_event("xpm_check", TYPE_ABC, vma, prot);
return -EPERM;
}
return 0;
}
next_check:
/* check for anonymous vma prot, anonymous executable permission need
* controled by selinux
*/
+8 -6
View File
@@ -486,13 +486,15 @@ static void insert_new_signature_info(struct inode *file_node, int type,
RB_CLEAR_NODE(&new_info->rb_node);
if ((*old_info) != NULL) {
write_lock(verity->lock);
rb_erase_node(verity->root, verity->node_count, *old_info);
(*old_info)->type |= FILE_SIGNATURE_DELETE;
write_unlock(verity->lock);
if (atomic_sub_return(1, &(*old_info)->reference) <= 0) {
kfree(*old_info);
*old_info = NULL;
if ((*old_info) != NULL) {
if (atomic_sub_return(1, &(*old_info)->reference) <= 0) {
rb_erase_node(verity->root, verity->node_count, *old_info);
(*old_info)->type |= FILE_SIGNATURE_DELETE;
kfree(*old_info);
*old_info = NULL;
}
}
write_unlock(verity->lock);
}
write_lock(verity->lock);