[lkml]   [2009]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 16/17] x86-64: Remove the PDA
On Sat, Jan 17, 2009 at 11:52 PM, Tejun Heo <> wrote:
> Hello,
> Brian Gerst wrote:
>> Now that the PDA is empty except for the stack canary, it can be removed.
>> The irqstack is moved to the start of the per-cpu section. If the stack
>> protector is enabled, the canary overlaps the bottom 48 bytes of the irqstack
>> on SMP. On UP it is a seperate variable, since it is the only thing referenced
>> via %gs.
> Eh... I don't know. Locating stack canary at hard 40byte offset is a
> dirty thing to do one way or another. I kind of like doing it
> directly in the linker script as it makes the dirty nature more
> obvious and doesn't require hunting down the definition in the first
> section.
> How about something like the following?
> #define CANARY_OFFSET 40
> #define CANARY_SIZE 8
> DECLARE_PER_CPU(unsigned long, stack_canary);
> and in linker script,
> per_cpu__stack_canary = __per_cpu_start + CANARY_OFFSET;

The thing I don't like about the prealloc method is that it puts the
page-aligned variables at the end. This leaves a gap which is
unavailable for dynamic allocations. Stealing 48 bytes from the
bottom of the irqstack (which is 16k) keeps the page-aligned section
at the start. It's really no different than how the thread_info
structure sits at the bottom of the process stack.

How about something like:
union irq_stack_union {
char irq_stack[IRQSTACKSIZE];
struct {
char pad[40];
unsigned long stack_canary;

That documents the overlay better, and avoids having to touch the linker script.

Brian Gerst

 \ /
  Last update: 2009-01-18 08:49    [W:0.112 / U:4.824 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site