Skip to contentSkip to conversation

cache colour task_structs

PATCH Andi Kleen 3 participants 3 messages Nov 1, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 5 lines · Alan Cox

We need to perturb esp colour too. It might be the right way to do this is slab based kernel stacks, it might be that your code is cheaper than the cost of getting current the really hard way and we should just add random numbers to the initial esp of a task ?

You could do that even today (without slab task_struct) by using a random/coloured at fork time value for esp0. This could just be a static colour counter that is subtracted.

Just don't forget to teach ptrace and proc WCHAN and oops printing about it; they currently use hardcoded stack offsets. It'll also likely break kdb.

-Andi

#2 lore raw
Quoted 10 lines · Andi Kleen
Quoted 5 lines · Alan Cox

We need to perturb esp colour too. It might be the right way to do this is slab based kernel stacks, it might be that your code is cheaper than the cost of getting current the really hard way and we should just add random numbers to the initial esp of a task ?

You could do that even today (without slab task_struct) by using a random/coloured at fork time value for esp0. This could just be a static colour counter that is subtracted.

Hey, ... I do that in userspace at thread creation time with a random alloca(), ... but it's to prevent stack pointer guessing in case of buffer overflows :)

- Davide

#3 lore raw
In reply to Andi Kleen
Quoted 6 lines · Andi Kleen

You could do that even today (without slab task_struct) by using a random/coloured at fork time value for esp0. This could just be a static colour counter that is subtracted.

Just don't forget to teach ptrace and proc WCHAN and oops printing about it; they currently use hardcoded stack offsets. It'll also likely break kdb.

Should not affect kdb. It uses current->esp0 for accessing user regs. Back trace unwinds the stack until it hits a 0 return address, it just not check for esp0.