This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix relro when COMMONPAGESIZE < MAXPAGESIZE


On Sun, Sep 19, 2004 at 05:00:58PM +0200, Jakub Jelinek wrote:
> With older binutils, I get:
>   [14] .eh_frame         PROGBITS        0000000000000f78 000f78 000034 00   A  0   0  8
>   [15] .ctors            PROGBITS        0000000000100e28 100e28 000010 00  WA  0   0  8
>   [16] .dtors            PROGBITS        0000000000100e38 100e38 000010 00  WA  0   0  8
>   [17] .jcr              PROGBITS        0000000000100e48 100e48 000008 00  WA  0   0  8
>   [18] .dynamic          DYNAMIC         0000000000100e50 100e50 000180 10  WA  3   0  8
>   [19] .got              PROGBITS        0000000000100fd0 100fd0 000018 08  WA  0   0  8
>   [20] .got.plt          PROGBITS        0000000000100fe8 100fe8 000020 08  WA  0   0  8
>   [21] .data             PROGBITS        0000000000101020 101020 000c38 00  WA  0   0 32
> (end of PT_GNU_RELRO, which is .got.plt+24, is aligned to 4K and
> for all sections (sh_addr & 0xfffff) == (sh_offset & 0xfffff).
> 
> Current CVS binutils (that includes your 2004-09-07 patch):
>   [14] .eh_frame         PROGBITS        0000000000000f78 000f78 000034 00   A  0   0  8
>   [15] .ctors            PROGBITS        0000000000101dd0 001dd0 000010 00  WA  0   0  8
>   [16] .dtors            PROGBITS        0000000000101de0 001de0 000010 00  WA  0   0  8
>   [17] .jcr              PROGBITS        0000000000101df0 001df0 000008 00  WA  0   0  8
>   [18] .dynamic          DYNAMIC         0000000000101df8 001df8 000180 10  WA  3   0  8
>   [19] .got              PROGBITS        0000000000101f78 001f78 000018 08  WA  0   0  8
>   [20] .got.plt          PROGBITS        0000000000101f90 001f90 000020 08  WA  0   0  8
>   [21] .data             PROGBITS        0000000000101fc0 001fc0 000c38 00  WA  0   0 32
> Here, .got.plt+24 is not 4K aligned (so relro is useless) and also
> (sh_addr & 0xfffff) != (sh_offset & 0xfffff) for sections in read-write
> segment, which means x86-64 ELF ABI is violated; particularly you can use
> such binaries solely on machines with at most 4K page size (sure, all
> currently are using such page size), but MAXPAGESIZE is 1MB on x86-64 so
> that bigger page sizes could be used in the future (otherwise I don't
> understand why MAXPAGESIZE 4K was not used).

Let me ask this again... you say there is a section there for which
addr and offset do not have the same lower twenty bits.  But the
numbers don't agree with you.  For instance .data has sh_addr =
0x101fc0 and sh_offset = 0x001fc0, that's the same to within 0x0fffff.
That's 1MB.

Are you sure you're counting the digits right?

> Current CVS binutils + your 2004-09-09 patch is better, but only partially:
>   [14] .eh_frame         PROGBITS        0000000000000f78 000f78 000034 00   A  0   0  8
>   [15] .ctors            PROGBITS        0000000000101e28 001e28 000010 00  WA  0   0  8
>   [16] .dtors            PROGBITS        0000000000101e38 001e38 000010 00  WA  0   0  8
>   [17] .jcr              PROGBITS        0000000000101e48 001e48 000008 00  WA  0   0  8
>   [18] .dynamic          DYNAMIC         0000000000101e50 001e50 000180 10  WA  3   0  8
>   [19] .got              PROGBITS        0000000000101fd0 001fd0 000018 08  WA  0   0  8
>   [20] .got.plt          PROGBITS        0000000000101fe8 001fe8 000020 08  WA  0   0  8
>   [21] .data             PROGBITS        0000000000102020 002020 000c38 00  WA  0   0 32
> .got.plt+24 is 4K aligned again, so relro works again, but the other
> constraint is violated.  If you think 1MB page size is excessive and
> you think it is possible to change the ABI, it should change MAXPAGESIZE
> to 4K rather than changing the relro mechanism.

So this should work just fine.

-- 
Daniel Jacobowitz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]