x86/mm/kcore: Add vsyscall page to /proc/kcore conditionally

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:48:52 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/cd026ca2861e7f384d677626a483da797c76b9da
Commit:     cd026ca2861e7f384d677626a483da797c76b9da
Parent:     595dd46ebfc10be041a365d0a3fa99df50b6ba73
Refname:    refs/heads/master
Author:     Jia Zhang <[email protected]>
AuthorDate: Mon Feb 12 22:44:54 2018 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 13 09:15:59 2018 +0100

    x86/mm/kcore: Add vsyscall page to /proc/kcore conditionally
    
    The vsyscall page should be visible only if vsyscall=emulate/native when dumping /proc/kcore.
    
    Signed-off-by: Jia Zhang <[email protected]>
    Reviewed-by: Jiri Olsa <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/mm/init_64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 6aa33d1e198f..8ba9c3128947 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1193,7 +1193,8 @@ void __init mem_init(void)
 	register_page_bootmem_info();
 
 	/* Register memory areas for /proc/kcore */
-	kclist_add(&kcore_vsyscall, (void *)VSYSCALL_ADDR, PAGE_SIZE, KCORE_USER);
+	if (get_gate_vma(&init_mm))
+		kclist_add(&kcore_vsyscall, (void *)VSYSCALL_ADDR, PAGE_SIZE, KCORE_USER);
 
 	mem_init_print_info(NULL);
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html