Skip to contentSkip to conversation

x86/vsyscall/64: Use proper accessor to update p4d entry

PATCH In review Boris Ostrovsky 4 participants 5 messages Mar 19, 2018 – Mar 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vsyscall/64: Use proper accessor to update p4d entry

Writing to it directly does not work for Xen PV guests.

---
 arch/x86/entry/vsyscall/vsyscall_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/vsyscall/vsyscall_64.c +1 -1
index 8560ef68a9d6..317be365bce3 100644
@@ -347,7 +347,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
 	set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
 	p4d = p4d_offset(pgd, VSYSCALL_ADDR);
 #if CONFIG_PGTABLE_LEVELS >= 5
-	p4d->p4d |= _PAGE_USER;
+	set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
 #endif
 	pud = pud_offset(p4d, VSYSCALL_ADDR);
 	set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));
Signature · 1 line
2.14.3
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Boris Ostrovsky
Quoted 1 line · Boris Ostrovsky

Writing to it directly does not work for Xen PV guests.

Whoops, my bad.

Quoted 22 lines
---
 arch/x86/entry/vsyscall/vsyscall_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/vsyscall/vsyscall_64.c +1 -2
index 8560ef68a9d6..317be365bce3 100644
@@ -347,7 +347,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
        set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
        p4d = p4d_offset(pgd, VSYSCALL_ADDR);
 #if CONFIG_PGTABLE_LEVELS >= 5
-       p4d->p4d |= _PAGE_USER;
+       set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
 #endif
        pud = pud_offset(p4d, VSYSCALL_ADDR);
        set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));
--

2.14.3

#3 lore raw
In reply to Boris Ostrovsky
x86/vsyscall/64: Use proper accessor to update p4d entry
Commit-ID:  f9ee6990bd505ecefa014f5e699b3c4d25860d80
Gitweb:     https://git.kernel.org/tip/f9ee6990bd505ecefa014f5e699b3c4d25860d80
Author:     Boris Ostrovsky <[email protected]>
AuthorDate: Mon, 19 Mar 2018 10:31:54 -0400
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 20 Mar 2018 09:04:51 +0100

x86/vsyscall/64: Use proper accessor to update p4d entry

Writing to it directly does not work for Xen PV guests.

Fixes 49275fef986a ("x86/vsyscall/64: Explicitly set _PAGE_USER in the pagetable hierarchy")
---
 arch/x86/entry/vsyscall/vsyscall_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/vsyscall/vsyscall_64.c +1 -1
index 8560ef68a9d6..317be365bce3 100644
@@ -347,7 +347,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
 	set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
 	p4d = p4d_offset(pgd, VSYSCALL_ADDR);
 #if CONFIG_PGTABLE_LEVELS >= 5
-	p4d->p4d |= _PAGE_USER;
+	set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
 #endif
 	pud = pud_offset(p4d, VSYSCALL_ADDR);
 	set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));
#4 lore raw

[tip:x86/pti] x86/vsyscall/64: Use proper accessor to update P4D entry

In reply to Boris Ostrovsky
x86/vsyscall/64: Use proper accessor to update P4D entry
Commit-ID:  31ad7f8e7dc94d3b85ccf9b6141ce6dfd35a1781
Gitweb:     https://git.kernel.org/tip/31ad7f8e7dc94d3b85ccf9b6141ce6dfd35a1781
Author:     Boris Ostrovsky <[email protected]>
AuthorDate: Mon, 19 Mar 2018 10:31:54 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 20 Mar 2018 12:00:53 +0100

x86/vsyscall/64: Use proper accessor to update P4D entry

Writing to it directly does not work for Xen PV guests.

Fixes 49275fef986a ("x86/vsyscall/64: Explicitly set _PAGE_USER in the pagetable hierarchy")
---
 arch/x86/entry/vsyscall/vsyscall_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/vsyscall/vsyscall_64.c +1 -1
index 8560ef68a9d6..317be365bce3 100644
@@ -347,7 +347,7 @@ void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
 	set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
 	p4d = p4d_offset(pgd, VSYSCALL_ADDR);
 #if CONFIG_PGTABLE_LEVELS >= 5
-	p4d->p4d |= _PAGE_USER;
+	set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
 #endif
 	pud = pud_offset(p4d, VSYSCALL_ADDR);
 	set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));