linux/fs/proc
Kairui Song ffc8599aa9 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
2a3e83c6f9 ("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
2019-03-23 12:11:49 +01:00
..
Kconfig
Makefile
array.c proc: use seq_puts() everywhere 2019-03-05 21:07:22 -08:00
base.c pidfd patches for v5.1-rc1 2019-03-16 13:47:14 -07:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c
inode.c
internal.h Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-03-12 14:08:19 -07:00
interrupts.c
kcore.c x86/gart: Exclude GART aperture from kcore 2019-03-23 12:11:49 +01:00
kmsg.c
loadavg.c
meminfo.c
namespaces.c
nommu.c
page.c mm: convert PG_balloon to PG_offline 2019-03-05 21:07:14 -08:00
proc_net.c
proc_sysctl.c
proc_tty.c
root.c Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-03-12 14:08:19 -07:00
self.c fs/proc/self.c: code cleanup for proc_setup_self() 2019-03-05 21:07:21 -08:00
softirqs.c
stat.c Merge branch 'akpm' (patches from Andrew) 2019-03-06 10:31:36 -08:00
task_mmu.c 5.1 Merge Window Pull Request 2019-03-09 15:53:03 -08:00
task_nommu.c Merge branch 'akpm' (patches from Andrew) 2019-03-06 10:31:36 -08:00
thread_self.c fs/proc/thread_self.c: code cleanup for proc_setup_thread_self() 2019-03-05 21:07:21 -08:00
uptime.c
util.c
version.c
vmcore.c