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

Re: [Xen-devel] [PATCH v2 3/5] xen/livepatch/ARM32: Don't load and crash on livepatches loaded with wrong alignment.



>>> On 20.09.17 at 17:12, <konrad@xxxxxxxxxx> wrote:
> On Tue, Sep 19, 2017 at 09:04:44AM -0600, Jan Beulich wrote:
>> >>> On 18.09.17 at 21:37, <konrad.wilk@xxxxxxxxxx> wrote:
>> > On Tue, Sep 12, 2017 at 02:57:04AM -0600, Jan Beulich wrote:
>> >> >>> On 12.09.17 at 02:22, <konrad@xxxxxxxxxx> wrote:
>> >> > If I compile the test-case under ARM32 it works OK (as the
>> >> > .livepatch.depends ends up being aligned to four bytes).
>> >> 
>> >> So why is that? What entity is creating this section (or the
>> >> directive(s) to create it)?
>> > 
>> > gcc
>> > 
>> > Looking at the xen_bye_world.o produced by cross-compiler:
>> > 
>> > xen_bye_world.o:     file format elf32-littlearm
>> > 
>> > Contents of section .rodata:
>> >  0000 78656e5f 65787472 615f7665 7273696f  xen_extra_versio
>> >  0010 6e00                                 n. 
>> > 
>> > And native:
>> > 
>> > xen_bye_world.o:     file format elf32-littlearm
>> > 
>> > Contents of section .rodata:
>> >  0000 78656e5f 65787472 615f7665 7273696f  xen_extra_versio
>> >  0010 6e000000                             n...      
>> 
>> This may rather be a gas than a gcc behavioral difference. What's
>> the alignment of .rodata in both cases?
> 
> Cross:
> 
> * on the livepatch:
> ..snip..
>   [ 4] .rodata           PROGBITS        00000000 000074 000012 00   A  0   0 
>  4
>   [ 5] .rodata.str1.4    PROGBITS        00000000 000088 00000b 01 AMS  0   0 
>  4
>   [ 6] .livepatch.depend PROGBITS        00000000 000093 000024 00   A  0   0 
>  1
> 
> * on the .o file:
> Section Headers:
>   [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf 
> Al
> .. snip..
>   [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0 
>  1
>   [ 2] .data             PROGBITS        00000000 000034 000000 00  WA  0   0 
>  1
>   [ 3] .bss              NOBITS          00000000 000034 000000 00  WA  0   0 
>  1
>   [ 4] .rodata           PROGBITS        00000000 000034 000014 00   A  0   0 
>  4
>   [ 5] .livepatch.funcs  PROGBITS        00000000 000048 000034 00  WA  0   0 
>  4

Hard to believe - a 0x14 bytes section gets shrunk to 0x12 bytes
by (presumably) ld -r?

> Native:
> 
>  * on the livepatch:
> ..snip..
>   [ 4] .rodata           PROGBITS        00000000 000074 000014 00   A  0   0 
>  4
>   [ 5] .rodata.str1.4    PROGBITS        00000000 000088 00000c 01 AMS  0   0 
>  4
>   [ 6] .livepatch.depend PROGBITS        00000000 000094 000024 00   A  0   0 
>  1
> 
> * on the .o file:
> ..snip..
>   [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0 
>  1
>   [ 2] .data             PROGBITS        00000000 000034 000000 00  WA  0   0 
>  1
>   [ 3] .bss              NOBITS          00000000 000034 000000 00  WA  0   0 
>  1
>   [ 4] .rodata           PROGBITS        00000000 000034 000012 00   A  0   0 
>  4
>   [ 5] .livepatch.funcs  PROGBITS        00000000 000048 000034 00  WA  0   0 
>  4

With things being the other way around here - did you perhaps mix
up files?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.