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

[Xen-devel] pv-grub will cause page fault if build with flag -fstack-protector



Hi, List,

In checking the page fault problem when using pv-grub to start domU in opensuse12.3[1], found that the problem is caused by '-fstack-protector' flag which is introduced in rpm build:
export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS"
export EXTRA_CFLAGS_QEMU_TRADITIONAL="$RPM_OPT_FLAGS"
export EXTRA_CFLAGS_QEMU_XEN="$RPM_OPT_FLAGS"
with '-fstack-protector', pv-grub will cause page fault when start domU; without the flag, pv-grub has no problem.

We asked for Jan's opinion whether we can remove the flag or there isn't a problem with stubdom overwriting something on the stack . Jan viewed it as a mistake use of flag:
> I generally view it as a mistake enforce certain kinds of (intrusive) flags onto builds of code that may assume to have full control of everything (e.g. kernel like, which stubdom clearly is).

I wonder if there is other opinion? If it is a flag use problem, then we can simply remove the flag from rpm build.

I checked the objdump of problem pv-grub, the page fault place is in xc_interface_open_common, the detail line is a line inserted by -fstack-protector (see 0x404bb in following):
00000000000404b0 <xc_interface_open_common>:
ÂÂ 404b0:ÂÂÂÂÂÂ 55ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ pushÂÂ %rbp
ÂÂ 404b1:ÂÂÂÂÂÂ 48 89 e5ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %rsp,%rbp
ÂÂ 404b4:ÂÂÂÂÂÂ 48 81 ec 00 05 00 00ÂÂÂ subÂÂÂ $0x500,%rsp
ÂÂ 404bb:ÂÂÂÂÂÂ 64 48 8b 04 25 28 00ÂÂÂ movÂÂÂ %fs:0x28,%rax
ÂÂ 404c2:ÂÂÂÂÂÂ 00 00
ÂÂ 404c4:ÂÂÂÂÂÂ 48 89 45 c8ÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %rax,-0x38(%rbp)
ÂÂ 404c8:ÂÂÂÂÂÂ 31 c0ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ xorÂÂÂ %eax,%eax
ÂÂ 404ca:ÂÂÂÂÂÂ 48 85 ffÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ testÂÂ %rdi,%rdi
ÂÂ 404cd:ÂÂÂÂÂÂ 4c 89 6d e8ÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %r13,-0x18(%rbp)
ÂÂ 404d1:ÂÂÂÂÂÂ 4c 89 75 f0ÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %r14,-0x10(%rbp)
ÂÂ 404d5:ÂÂÂÂÂÂ 48 89 5d d8ÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %rbx,-0x28(%rbp)
ÂÂ 404d9:ÂÂÂÂÂÂ 4c 89 65 e0ÂÂÂÂÂÂÂÂÂÂÂÂ movÂÂÂ %r12,-0x20(%rbp)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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