Re: [PATCH] allow placing exception table in .rodata (and do so on x86)

From: Geert Uytterhoeven
Date: Thu Apr 28 2011 - 07:47:46 EST


On Thu, Apr 28, 2011 at 13:40, Jan Beulich <JBeulich@xxxxxxxxxx> wrote:
>>>> On 28.04.11 at 12:43, Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote:
>> On Wed, Apr 27, 2011 at 04:36:04PM +0100, Jan Beulich wrote:
>>> This is since the table is really a set of pointers, i.e. misplaced in
>>> .text.
>>>
>>> Quite likely other architectures would want to follow.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
>>>
>>
>> [...]
>>
>>> --- 2.6.39-rc5/include/asm-generic/vmlinux.lds.h
>>> +++ 2.6.39-rc5-extable-in-rodata/include/asm-generic/vmlinux.lds.h
>>> @@ -226,6 +226,7 @@
>>> Â Â Â Â Â Â Â*(.rodata1) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
>>> Â Â Â} Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
>>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
>>> + Â ÂEXCEPTION_TABLE_RO Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
>>
>> That's odd. The kernel actually writes to it (sort_main_extable()), so
>> it shouldn't be in the ro data section, but the data section.
>
> This area does get written, but only at boot time, before read-only
> data gets set to r/o (on x86 at least). With this in mind, it's better
> to place it in .rodata, as that way run-time protection will be in place
> (and I think you agree that it was misplaced in .text in any case).

Which means it may be in ROM (which is really read-only) on some embedded
devices, so it cannot be sorted?

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
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/