[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181221145643.GA6143@dwarf.suse.cz>
Date: Fri, 21 Dec 2018 15:56:43 +0100
From: Jiri Bohac <jbohac@...e.cz>
To: Kairui Song <kasong@...hat.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de, bp@...en8.de,
mingo@...hat.com, hpa@...or.com, adobriyan@...il.com,
akpm@...ux-foundation.org, osandov@...com, bhsharma@...hat.com,
bhe@...hat.com, dyoung@...hat.com
Subject: Re: [PATCH 1/1] x86/gart/kcore: Exclude GART aperture from kcore
On Fri, Dec 21, 2018 at 09:38:12AM +0800, Kairui Song wrote:
> On machines where the GART aperture is mapped over physical RAM,
> /proc/kcore contains the GART aperture range and reading it may lead
> to kernel panic.
>
> In 'commit 2a3e83c6f96c ("x86/gart: Exclude GART aperture from vmcore")',
> a special workaround is applied for vmcore to let /proc/vmcore return
> zeroes when attempting to read the aperture region, as vmcore and kcore
> have the same issue, and after 'commit 707d4eefbdb3 ("Revert "[PATCH]
> Insert GART region into resource map"")', userspace tools can't detect and
> exclude GART region.
>
> This patch applies the same workaround for kcore. Let /proc/kcore return
> zeroes too when trying to read the aperture region to fix the issue that
> reading GART region may raise unexpected exceptions.
>
> This applies to both first and second kernels as GART may get
> initialized in the first and second kernels.
>
> To get the same workaround work for kcore, this patch implement a hook
> infrastructure for kcore which is same as the hook infrastructure for
> vmcore introduced in 'commit 997c136f518c ("fs/proc/vmcore.c: add hook
> to read_from_oldmem() to check for non-ram pages")'', and reuses the
> checking function gart_oldmem_pfn_is_ram introduced in
> 'commit 2a3e83c6f96c ("x86/gart: Exclude GART aperture from vmcore"),'
> as the hook function, but rename to gart_mem_pfn_is_ram as now it's
> for a more generic use.
>
> Suggested-by: Baoquan He <bhe@...hat.com>
> Signed-off-by: Kairui Song <kasong@...hat.com>
Reviewed-by: Jiri Bohac <jbohac@...e.cz>
> ---
> arch/x86/kernel/aperture_64.c | 6 ++++--
> fs/proc/kcore.c | 34 ++++++++++++++++++++++++++++++++++
> include/linux/kcore.h | 3 +++
> 3 files changed, 41 insertions(+), 2 deletions(-)
--
Jiri Bohac <jbohac@...e.cz>
SUSE Labs, Prague, Czechia
Powered by blists - more mailing lists