public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: Kairui Song <kasong@redhat.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de,
	mingo@redhat.com, hpa@zytor.com, adobriyan@gmail.com,
	akpm@linux-foundation.org, osandov@fb.com, bhsharma@redhat.com,
	bhe@redhat.com, dyoung@redhat.com
Subject: Re: [PATCH 1/1] x86/gart/kcore: Exclude GART aperture from kcore
Date: Fri, 21 Dec 2018 15:56:43 +0100	[thread overview]
Message-ID: <20181221145643.GA6143@dwarf.suse.cz> (raw)
In-Reply-To: <20181221013812.22790-1-kasong@redhat.com>

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@redhat.com>
> Signed-off-by: Kairui Song <kasong@redhat.com>

Reviewed-by: Jiri Bohac <jbohac@suse.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@suse.cz>
SUSE Labs, Prague, Czechia


  reply	other threads:[~2018-12-21 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21  1:38 [PATCH 1/1] x86/gart/kcore: Exclude GART aperture from kcore Kairui Song
2018-12-21 14:56 ` Jiri Bohac [this message]
2018-12-29 19:43 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181221145643.GA6143@dwarf.suse.cz \
    --to=jbohac@suse.cz \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kasong@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=osandov@fb.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox