Re: [PATCH 1/3] percpu: use ZERO_SIZE_PTR / ZERO_OR_NULL_PTR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]