Commit 03565d2
committed
mm/hugetlb: make detecting shared pte more reliable
jira VULN-46929
cve-bf CVE-2024-57883
commit-author Miaohe Lin <linmiaohe@huawei.com>
commit 3aa4ed8
upstream-diff Accounted for e95a985 not
being backported to ciqlts9_2 - dropped the unnecessary braces in a
one-statement `if' conditional.
If the pagetables are shared, we shouldn't copy or take references. Since
src could have unshared and dst shares with another vma, huge_pte_none()
is thus used to determine whether dst_pte is shared. But this check isn't
reliable. A shared pte could have pte none in pagetable in fact. The
page count of ptep page should be checked here in order to reliably
determine whether pte is shared.
[lukas.bulwahn@gmail.com: remove unused local variable dst_entry in copy_hugetlb_page_range()]
Link: https://lkml.kernel.org/r/20220822082525.26071-1-lukas.bulwahn@gmail.com
Link: https://lkml.kernel.org/r/20220816130553.31406-7-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 3aa4ed8)
Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>1 parent cf25739 commit 03565d2
1 file changed
+8
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4769 | 4769 | | |
4770 | 4770 | | |
4771 | 4771 | | |
4772 | | - | |
| 4772 | + | |
4773 | 4773 | | |
4774 | 4774 | | |
4775 | 4775 | | |
| |||
4810 | 4810 | | |
4811 | 4811 | | |
4812 | 4812 | | |
4813 | | - | |
4814 | 4813 | | |
| 4814 | + | |
4815 | 4815 | | |
4816 | | - | |
4817 | | - | |
4818 | | - | |
| 4816 | + | |
| 4817 | + | |
4819 | 4818 | | |
4820 | | - | |
4821 | | - | |
| 4819 | + | |
4822 | 4820 | | |
4823 | 4821 | | |
4824 | 4822 | | |
4825 | 4823 | | |
4826 | 4824 | | |
4827 | 4825 | | |
4828 | | - | |
4829 | 4826 | | |
4830 | | - | |
| 4827 | + | |
4831 | 4828 | | |
4832 | | - | |
4833 | | - | |
4834 | | - | |
| 4829 | + | |
4835 | 4830 | | |
4836 | 4831 | | |
4837 | 4832 | | |
| |||
4911 | 4906 | | |
4912 | 4907 | | |
4913 | 4908 | | |
4914 | | - | |
| 4909 | + | |
4915 | 4910 | | |
4916 | 4911 | | |
4917 | 4912 | | |
| |||
0 commit comments