]> git.baikalelectronics.ru Git - kernel.git/commit
x86/gart: Exclude GART aperture from kcore
authorKairui Song <kasong@redhat.com>
Fri, 8 Mar 2019 03:05:08 +0000 (11:05 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 23 Mar 2019 11:11:49 +0000 (12:11 +0100)
commitb804904787ce2cc6a428eb649a85c6b8231fed46
tree564374b91fdfced43fbcbf2310cb05e3ca9759a4
parent8b9fd8258c9937619f435de8332282a59faa3976
x86/gart: Exclude GART aperture from kcore

On machines where the GART aperture is mapped over physical RAM,
/proc/kcore contains the GART aperture range. Accessing the GART range via
/proc/kcore results in a kernel crash.

vmcore used to have the same issue, until it was fixed with commit
625b86f75921 ("x86/gart: Exclude GART aperture from vmcore")', leveraging
existing hook infrastructure in vmcore to let /proc/vmcore return zeroes
when attempting to read the aperture region, and so it won't read from the
actual memory.

Apply the same workaround for kcore. First implement the same hook
infrastructure for kcore, then reuse the hook functions introduced in the
previous vmcore fix. Just with some minor adjustment, rename some functions
for more general usage, and simplify the hook infrastructure a bit as there
is no module usage yet.

Suggested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jiri Bohac <jbohac@suse.cz>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Dave Young <dyoung@redhat.com>
Link: https://lkml.kernel.org/r/20190308030508.13548-1-kasong@redhat.com
arch/x86/kernel/aperture_64.c
fs/proc/kcore.c
include/linux/kcore.h