Re: [PATCH 3/6] x86-64: Put vsyscall_gtod_data at a fixed virtual address

From: Andrew Lutomirski
Date: Mon Mar 28 2011 - 14:10:10 EST


On Mon, Mar 28, 2011 at 1:49 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> On Mon, 28 Mar 2011, Andy Lutomirski wrote:
>>
>> +      /* This address must be kept in sync with arch/x86/vdso/vextern.h */
>
> This is the worst idea ever. Breakage is lurking by making something:
> Must be kept in sync ...
>
>> +     .vsyscall_gtod_data ADDR(.vsyscall_0) + 3072 + 256:
>
> And this magic constant is what ? Something which will blow up sooner
> than later.

Fair enough. The constant is pretty much arbitrary, except that it
has to be the same in both places.

Would you object less if I added a new header that just contained
offsets within the vsyscall page to clock, vgetcpu_mode, and
gtod_data? That way I could remove the entire VMAGIC mechanism,
everything gets faster, and there's nothing to be kept in sync.

I just checked and the linker will error out of any of these data
structures get too large to fit in their assigned places. It looks
like this:

ld: section .vsyscall_1 loaded at [00000000018ba400,00000000018ba43d]
overlaps section .vsyscall_gtod_data loaded at
[00000000018ba140,00000000018ba5d7]
ld: .tmp_vmlinux1: section .vsyscall_1 vma 0xffffffffff600400 overlaps
previous sections

(That's on an unmodified kernel, but the same thing would happen with
hardcoded offsets.)

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/