[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120130181313.GI3355@google.com>
Date: Mon, 30 Jan 2012 10:13:13 -0800
From: Tejun Heo <tj@...nel.org>
To: Christoph Lameter <cl@...ux.com>
Cc: Dmitry Antipov <dmitry.antipov@...aro.org>,
Rusty Russell <rusty@...tcorp.com.au>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, patches@...aro.org,
linaro-dev@...ts.linaro.org
Subject: Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists