mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "PaX Team" <pageexec@freemail.hu>
To: linux-tip-commits@vger.kernel.org, torvalds@linux-foundation.org,
	izumi.taku@jp.fujitsu.com, mingo@kernel.org,
	linux-kernel@vger.kernel.org, spender@grsecurity.net,
	y14sg1@comcast.net, akpm@linux-foundation.org, hpa@zytor.com,
	tglx@linutronix.de, laijs@cn.fujitsu.com,
	tangchen@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
	wency@cn.fujitsu.com, zhangyanfei@cn.fujitsu.com,
	imtangchen@gmail.com
Cc: izumi.taku@jp.fujitsu.com, mingo@kernel.org,
	isimatu.yasuaki@jp.fujitsu.com, spender@grsecurity.net,
	wency@cn.fujitsu.com, tangchen@cn.fujitsu.com,
	laijs@cn.fujitsu.com, torvalds@linux-foundation.org,
	imtangchen@gmail.com, tglx@linutronix.de, hpa@zytor.com,
	y14sg1@comcast.net, akpm@linux-foundation.org,
	zhangyanfei@cn.fujitsu.com
Subject: Re: [tip:x86/mm] x86/mm/numa: Fix memory corruption on 32-bit NUMA kernels
Date: Mon, 08 Feb 2016 11:33:06 +0100	[thread overview]
Message-ID: <56B86EE2.12451.11ACA8BE@pageexec.freemail.hu> (raw)
In-Reply-To: <tip-2b54ab3c66d48a5887c9ba209a342d0b13cdefa8@git.kernel.org>

On 8 Feb 2016 at 1:42, tip-bot for Ingo Molnar wrote:

> y14sg1 <y14sg1@comcast.net> reported that when running 32-bit NUMA kernels,
> the grsecurity/PAX kernel patch flagged a size overflow in this function:
> 
>   PAX: size overflow detected in function x86_numa_init arch/x86/mm/numa.c:691 [...]
> 
> ... the reason for the overflow is that memblock_set_node() takes physical
> addresses as arguments, while the start/end variables used by
> numa_clear_kernel_node_hotplug() are 'unsigned long', which is 32-bit on PAE
> kernels, but which has 64-bit physical addresses. So we truncate a 64-bit
> physical range to 32 bits and pass it to memblock_set_node(), which corrupts
> memory on systems with physical addresses above 4GB.

i think the truncated values go into memblock_clear_hotplug, not memblock_set_node.
also the sideeffects are unclear to me, from a quick look these values seem to be
used to look up some range in memblock, i don't know if that can lead to memory
corruption per se or 'only' some logical bug later.

> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index c3b3f65..d04f809 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -469,7 +469,7 @@ static void __init numa_clear_kernel_node_hotplug(void)
>  {
>   int i, nid;
>   nodemask_t numa_kernel_nodes = NODE_MASK_NONE;
> -	unsigned long start, end;
> +	phys_addr_t start, end;
>   struct memblock_region *r;
> 
>   /*
> 

       reply	other threads:[~2016-02-08 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-2b54ab3c66d48a5887c9ba209a342d0b13cdefa8@git.kernel.org>
2016-02-08 10:33 ` PaX Team [this message]
2016-02-08 11:09   ` Ingo Molnar

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=56B86EE2.12451.11ACA8BE@pageexec.freemail.hu \
    --to=pageexec@freemail.hu \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=imtangchen@gmail.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=spender@grsecurity.net \
    --cc=tangchen@cn.fujitsu.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wency@cn.fujitsu.com \
    --cc=y14sg1@comcast.net \
    --cc=zhangyanfei@cn.fujitsu.com \
    /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

all inboxes | Powered by JetHome®