--- v9
+++ v22
@@ -1,38 +1,29 @@
-Update alloc_set_pte() for the zero-page case. A special mapping can also
-use a zero page for read. One use case is the Indirect Branch Tracking
-legacy code page (introduced next).
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Add ENDBR32 to __kernel_vsyscall entry point.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
+Acked-by: Andy Lutomirski <luto@kernel.org>
+Reviewed-by: Kees Cook <keescook@chromium.org>
---
- mm/memory.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
+ arch/x86/entry/vdso/vdso32/system_call.S | 3 +++
+ 1 file changed, 3 insertions(+)
-diff --git a/mm/memory.c b/mm/memory.c
-index 6daa28614327..58c1e4b60991 100644
---- a/mm/memory.c
-+++ b/mm/memory.c
-@@ -3447,6 +3447,12 @@ vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
-
- flush_icache_page(vma, page);
- entry = mk_pte(page, vma->vm_page_prot);
-+
-+ if (is_zero_pfn(pte_pfn(entry))) {
-+ entry = pte_mkspecial(entry);
-+ goto alloc_set_pte_out;
-+ }
-+
- if (write)
- entry = maybe_mkwrite(pte_mkdirty(entry), vma);
- /* copy-on-write page */
-@@ -3459,6 +3465,8 @@ vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
- inc_mm_counter_fast(vma->vm_mm, mm_counter_file(page));
- page_add_file_rmap(page, false);
- }
-+
-+alloc_set_pte_out:
- set_pte_at(vma->vm_mm, vmf->address, vmf->pte, entry);
-
- /* no need to invalidate: a not-present page won't be cached */
+diff --git a/arch/x86/entry/vdso/vdso32/system_call.S b/arch/x86/entry/vdso/vdso32/system_call.S
+index de1fff7188aa..f19eaec3de3b 100644
+--- a/arch/x86/entry/vdso/vdso32/system_call.S
++++ b/arch/x86/entry/vdso/vdso32/system_call.S
+@@ -14,6 +14,9 @@
+ ALIGN
+ __kernel_vsyscall:
+ CFI_STARTPROC
++#ifdef CONFIG_X86_CET
++ endbr32
++#endif
+ /*
+ * Reshuffle regs so that all of any of the entry instructions
+ * will preserve enough state.
--
2.21.0