linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: Dmitry Antipov <dmitry.antipov@linaro.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	patches@linaro.org, linaro-dev@lists.linaro.org
Subject: Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR
Date: Mon, 30 Jan 2012 10:13:13 -0800	[thread overview]
Message-ID: <20120130181313.GI3355@google.com> (raw)
In-Reply-To: <20120130180224.GH3355@google.com>

On Mon, Jan 30, 2012 at 10:02:24AM -0800, Tejun Heo wrote:
> I thought it didn't.  I rememer thinking about this and determining
> that NULL can't be allocated for dynamic addresses.  Maybe I'm
> imagining things.  Anyways, if it can return NULL for valid
> allocation, it is a bug and should be fixed.

So, the default translation is

#define __addr_to_pcpu_ptr(addr)					\
	(void __percpu *)((unsigned long)(addr) -			\
	(unsigned long)pcpu_base_addr +					\
	(unsigned long)__per_cpu_start)

It basically offsets the virtual address of the first unit against the
start of static percpu section, so if the linked percpu data address
is higher than the base address of the initial chunk, I *think*
overwrap is possible.  I don't think this can happen on x86 regardless
of first chunk allocation mode tho but there may be configurations
where __per_cpu_start is higher than pcpu_base_addr (IIRC some archs
locate vmalloc area lower than kernel image, dunno whether the used
address range actually is enough for causing overflow tho).

Anyways, yeah, it seems we should improve this part too.

Thanks.

-- 
tejun

  parent reply	other threads:[~2012-01-30 18:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30  8:37 [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR Dmitry Antipov
2012-01-30 16:15 ` Christoph Lameter
2012-01-30 17:15 ` Tejun Heo
2012-01-30 17:19   ` Tejun Heo
2012-01-30 17:22     ` Christoph Lameter
2012-01-30 17:33       ` Tejun Heo
2012-01-30 17:35         ` Christoph Lameter
2012-01-30 17:22   ` Christoph Lameter
2012-01-30 17:42     ` Tejun Heo
2012-01-30 17:52       ` Christoph Lameter
2012-01-30 17:54         ` Tejun Heo
2012-01-30 17:58           ` Christoph Lameter
2012-01-30 18:02             ` Tejun Heo
2012-01-30 18:12               ` Christoph Lameter
2012-01-30 18:16                 ` Tejun Heo
2012-01-31  4:48                   ` Rusty Russell
2012-01-30 18:13               ` Tejun Heo [this message]
2012-01-30 18:15                 ` Christoph Lameter

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=20120130181313.GI3355@google.com \
    --to=tj@kernel.org \
    --cc=cl@linux.com \
    --cc=dmitry.antipov@linaro.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=patches@linaro.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).