lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200712021404.57263.rusty@rustcorp.com.au>
Date:	Sun, 2 Dec 2007 14:04:56 +1100
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Christoph Lameter <clameter@....com>
Cc:	Andi Kleen <ak@...e.de>, Jeremy Fitzhardinge <jeremy@...p.org>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [patch 1/3] Percpu infrastructure to rebase the per cpu area to 0UL

On Friday 30 November 2007 17:43:06 Christoph Lameter wrote:
> Support an option
>
> 	CONFIG_PERCPU_ZERO_BASED
>
> that makes offsets for per cpu variables start at zero.
>
> If a percpu area starts at zero then
>
> 1. We do not need RELOC_HIDE anymore

Hi Christoph,

    Why do you think this is true?  You're still doing arithmetic on variable 
addresses beyond the bound of the variable.

> 2. Indexes off the per cpu area for each processor are small
>
> 3. The percpu area "addresses" are offsets and we can then
>    have allocpercpu/cpu_alloc in the future also use these
>    offsets so that percpu functions can take any type of
>    percpu address if it is provided by a percpu variable
>    or a pointer obtained via allocpercpu/cpu_alloc.

This last point is orthogonal to offsetting at zero though...

> +#ifdef CONFIG_PERCPU_ZERO_BASED
> +extern char __per_cpu_load[];
> +extern char ____per_cpu_size[];
> +#define __per_cpu_size ((unsigned long)&____per_cpu_size)
> +#define __per_cpu_start ((char *)0)
> +#define __per_cpu_end ((char *)__per_cpu_size)
> +#else
>  extern char __per_cpu_start[], __per_cpu_end[];
> +#define __per_cpu_load __per_cpu_start
> +#define __per_cpu_size (__per_cpu_end - __per_cpu_start)
> +#endif

Hmm, can't you just define __per_cpu_start and __per_cpu_end in the linker 
script and fold this code back together again?

>  	for_each_possible_cpu(i) {
> -		start = (unsigned long) &__per_cpu_start + per_cpu_offset(i);
> -		end   = (unsigned long) &__per_cpu_start + PERCPU_ENOUGH_ROOM
> +		start = (unsigned long) __per_cpu_start + per_cpu_offset(i);
> +		end   = (unsigned long) __per_cpu_start + PERCPU_ENOUGH_ROOM
>  					+ per_cpu_offset(i);

I found the original clearer; why change it?

Cheers,
Rusty.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ