From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: julien.grall@arm.com, sstabellini@kernel.org,
xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com
Subject: Re: [PATCH v2 3/5] xen/livepatch/ARM32: Don't load and crash on livepatches loaded with wrong alignment.
Date: Mon, 18 Sep 2017 15:37:57 -0400 [thread overview]
Message-ID: <20170918193757.GB32401@char.us.oracle.com> (raw)
In-Reply-To: <59B7BD800200007800179DB3@prv-mh.provo.novell.com>
On Tue, Sep 12, 2017 at 02:57:04AM -0600, Jan Beulich wrote:
> >>> On 12.09.17 at 02:22, <konrad@kernel.org> wrote:
> > On Mon, Sep 11, 2017 at 03:01:15AM -0600, Jan Beulich wrote:
> >> Hmm, as long as the relocation isn't required to be against aligned
> >> fields only (mandated by the processor ABI) I think the code doing
> >> the relocations would instead need to split the access, rather than
> >> calling the section misaligned or increasing alignment beyond what
> >> the ELF section headers say.
> >
> > Maybe the serial log would explain this better:
> >
> > xend_config_format : 4
> > Executing: '(set -e;cd /root/test/livepatch;xen-livepatch load
> > xen_bye_world.livepatch)' ..(XEN) livepatch.c:413: livepatch: xen_bye_world: Loaded .note.gnu.build-id at 00a08000
> > (XEN) livepatch.c:413: livepatch: xen_bye_world: Loaded .text at 00a06000
> > (XEN) livepatch.c:413: livepatch: xen_bye_world: Loaded .rodata at 00a08024
> > (XEN) livepatch.c:413: livepatch: xen_bye_world: Loaded .rodata.str1.4 at 00a08038
> > (XEN) livepatch.c:413: livepatch: xen_bye_world: Loaded .livepatch.depends at 00a08043
> >[...]
> > Keep in mind that this only happens if I cross-compile ARM32 under x86.
>
> That would suggest a build environment / build tools issue then:
> Cross builds aren't supposed to produce binaries different from
> native builds.
Hm, the gcc parameters on both native and cross compiler have same args:
konrad@osstest:/srv/cubietruck/source$ diff native.invocation /tmp/cross.invocation
1c1
< gcc -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O1 -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /source/xen.orig.git/xen/include/xen/config.h '-D__OBJECT_FILE__="xen_bye_world.o"' -Wa,--strip-local-absolute -fno-omit-frame-pointer -MMD -MF ./.xen_bye_world.o.d -msoft-float -mcpu=cortex-a15 -I/source/xen.orig.git/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -c xen_bye_world.c -o xen_bye_world.o
---
> arm-linux-gnu-gcc -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O1 -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/konrad/A20/xen.git/xen/include/xen/config.h '-D__OBJECT_FILE__="xen_bye_world.o"' -Wa,--strip-local-absolute -fno-omit-frame-pointer -MMD -MF ./.xen_bye_world.o.d -msoft-float -mcpu=cortex-a15 -I/home/konrad/A20/xen.git/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -c xen_bye_world.c -o xen_bye_world.o
>
> > 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...
(The cross compiler is 7.0.1, while native is 4.9.2).
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-19 14:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 19:47 [PATCH v2] Livepatch fixes for v4.10 (v2) Konrad Rzeszutek Wilk
2017-07-26 19:47 ` [PATCH v2 1/5] livepatch: Tighten alignment checks Konrad Rzeszutek Wilk
2017-07-31 13:46 ` Jan Beulich
2017-07-26 19:47 ` [PATCH v2 2/5] livepatch: Include sizes when an mismatch occurs Konrad Rzeszutek Wilk
2017-07-31 13:51 ` Jan Beulich
2017-07-26 19:47 ` [PATCH v2 3/5] xen/livepatch/ARM32: Don't load and crash on livepatches loaded with wrong alignment Konrad Rzeszutek Wilk
2017-07-26 22:27 ` Andrew Cooper
2017-07-31 13:55 ` Jan Beulich
2017-07-31 16:04 ` Konrad Rzeszutek Wilk
2017-08-02 9:20 ` Jan Beulich
2017-09-07 17:36 ` Konrad Rzeszutek Wilk
2017-09-08 9:30 ` Jan Beulich
2017-09-09 12:05 ` Konrad Rzeszutek Wilk
2017-09-11 9:01 ` Jan Beulich
2017-09-12 0:22 ` Konrad Rzeszutek Wilk
2017-09-12 8:57 ` Jan Beulich
2017-09-18 19:37 ` Konrad Rzeszutek Wilk [this message]
2017-09-19 15:04 ` Jan Beulich
2017-09-20 15:12 ` Konrad Rzeszutek Wilk
2017-09-20 15:51 ` Jan Beulich
2017-07-26 19:47 ` [PATCH v2 4/5] alternative/x86/arm32: Align altinstructions (and altinstr_replacement) sections Konrad Rzeszutek Wilk
2017-07-31 14:01 ` Jan Beulich
2017-09-11 18:59 ` Konrad Rzeszutek Wilk
2017-07-26 19:47 ` [PATCH v2 5/5] livepatch: Declare live patching as a supported feature Konrad Rzeszutek Wilk
2017-07-31 14:03 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170918193757.GB32401@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).