Re: [PATCH] MIPS: Implement __read_mostly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 20, 2010 at 21:05, Ralf Baechle <ralf@xxxxxxxxxxxxxx> wrote:
> On Sat, Oct 16, 2010 at 10:04:59AM +0200, Geert Uytterhoeven wrote:
>> > -const unsigned long mips_io_port_base __read_mostly = -1;
>> > +const unsigned long mips_io_port_base = -1;
>> > ÂEXPORT_SYMBOL(mips_io_port_base);
>>
>> Ugh. So as soon as someone implements MMU protection for the read-only data
>> section, it'll break silently?
>
> That's not the only failure mode. ÂA const might be replicated by a compiler
> for example into multiple small data sections or by loading the rodata
> into multiple NUMA nodes. ÂThe later hits IP27 but that one got potencially

Didn't think about that. Ough...

> many PCI busses anyway, so mips_io_port_base was always problematic. ÂFrom
> the time I put this optimization hack in it was clear that I was gaming
> GCC and sooner or later it was going to blow up. ÂIt's held for like a
> decade so I got my money's worth :)

Or it may fool "smart" debuggers, who read the data from the original image
instead of from memory. Once we had a buffer overflow corrupting subsequent
read-only data on a VxWorks platform, but the debugger didn't see it
as it refused to
look at the actual data in RAM...

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



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux