Re: _proxy_pda still makes linking modules fail

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andi Kleen <andi@...>
Cc: Jeremy Fitzhardinge <jeremy@...>, Marcin 'Qrczak' Kowalczyk <qrczak@...>, <linux-kernel@...>
Date: Tuesday, March 13, 2007 - 2:23 am

On Tue, 2007-03-13 at 08:59 +1100, Rusty Russell wrote:

No, I don't think I will.  The PDA concept has gone too far in x86-64 to
be undone.  In particular, it's been put in GCC 4.1 for
CONFIG_CC_STACKPROTECTOR, which assumes %gs:40 will give the stack
canary.

For the record: the PDA should never have existed, that's what percpu
vars were supposed to be for.  Something went wrong here 8(

%gs is best set to the offset of the local cpu's area from the "master"
per-cpu area, not set to the local cpu area's address.  In the former
case, booting with %gs at offset 0 works naturally, in the latter case,
hoops need to be jumped through to make it work.  See how much nicer the
x86 code is post pda->percpu conversion.

So, even if we leave the PDA and place the per-cpu area immediately
after it, we still can't use "%gs:var" to access a per-cpu variable: we
need to do a subtract, so why bother using the segment reg?

The ideal solution has always been to use __thread, but no architecture
has yet managed it (I tried for i386, and it quickly caused unbearable
pain).  On x86-64 that uses "%fs" on x86-64, not "%gs" as the kernel
does, but I might try that if I feel particularly masochistic soon...

In summary, containing the PDA infection to x86-64 is possible, but
curing that patient is non-trivial 8)

Rusty.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
_proxy_pda still makes linking modules fail, Marcin 'Qrczak' Kowalczyk..., (Wed Mar 7, 8:57 pm)
Re: _proxy_pda still makes linking modules fail, Andi Kleen, (Sun Mar 11, 9:19 pm)
Re: _proxy_pda still makes linking modules fail, Marcin 'Qrczak' Kowalczyk..., (Mon Mar 12, 2:47 pm)
Re: _proxy_pda still makes linking modules fail, Jeremy Fitzhardinge, (Sun Mar 11, 8:25 pm)
Re: _proxy_pda still makes linking modules fail, Andi Kleen, (Mon Mar 12, 5:48 am)
Re: _proxy_pda still makes linking modules fail, Rusty Russell, (Mon Mar 12, 5:58 pm)
Re: _proxy_pda still makes linking modules fail, Rusty Russell, (Tue Mar 13, 2:23 am)
Re: _proxy_pda still makes linking modules fail, Andi Kleen, (Tue Mar 13, 11:57 am)
Re: _proxy_pda still makes linking modules fail, Rusty Russell, (Tue Mar 13, 10:17 pm)
Re: _proxy_pda still makes linking modules fail, Paul Mackerras, (Tue Mar 13, 5:04 am)
Re: _proxy_pda still makes linking modules fail, Jeremy Fitzhardinge, (Tue Mar 13, 11:31 am)
Re: _proxy_pda still makes linking modules fail, Rusty Russell, (Tue Mar 13, 9:12 pm)
Re: _proxy_pda still makes linking modules fail, Paul Mackerras, (Tue Mar 13, 7:50 pm)
Re: _proxy_pda still makes linking modules fail, Jeremy Fitzhardinge, (Mon Mar 12, 10:45 am)
Re: _proxy_pda still makes linking modules fail, Andi Kleen, (Mon Mar 12, 11:45 am)
Re: _proxy_pda still makes linking modules fail, Adrian Bunk, (Sat Mar 10, 11:03 am)
Re: _proxy_pda still makes linking modules fail, Marcin 'Qrczak' Kowalczyk..., (Sun Mar 11, 10:06 am)