Re: Why is irq_stack_union a union?

From: Brian Gerst
Date: Mon Aug 31 2015 - 17:48:16 EST

On Mon, Aug 31, 2015 at 5:00 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> Why not just a struct? Also, why is this all tangled up in gsbase initialization?

It has to do with the fact that the GCC stackprotector is hardcoded to
look for the canary at %gs:40. Since we also use %gs for the percpu
segment, we have to make sure that the canary is placed at the start
of the percpu section. Overlaying it onto the bottom of the IRQ stack
and was the most convenient way to do it, with a side benefit that
overflowing the stack will trip the canary.

Brian Gerst
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at