提交 790b46fa 编写于 作者: Z ZhangPeng 提交者: Ma Wupeng

userswap: check read and write permissions for swap-out pages

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6CAIM

--------------------------------

Check the VM_READ and VM_WRITE flags of vma->vm_flags to determine
whether the read and write permissions of the swap-out page VA are
consistent with those of the swap-out buffer VA. If they are
inconsistent, the swap operation will fail.
Signed-off-by: NZhangPeng <zhangpeng362@huawei.com>
上级 62d6e76a
......@@ -311,8 +311,8 @@ static unsigned long do_user_swap(struct mm_struct *mm,
goto out_recover;
ret = -EACCES;
if (pgprot_val(old_vma->vm_page_prot) !=
pgprot_val(new_vma->vm_page_prot))
if (!(old_vma->vm_flags & VM_WRITE) &&
(new_vma->vm_flags & VM_WRITE))
goto out_recover;
ret = -ENXIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册