summary refs log tree commit diff stats
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
authorShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>2018-08-29 04:23:27 -0500
committerLaurent Vivier <laurent@vivier.eu>2018-09-25 22:36:49 +0200
commit94894ff2d13c85a840f80387c573a34ed6c99063 (patch)
tree2d213369624e4e23fa8010c9bd7136b947bd8480 /hw/core/qdev.c
parent83eb6e509062b8907eb95a00170ef6dde8d264fd (diff)
downloadfocaccia-qemu-94894ff2d13c85a840f80387c573a34ed6c99063.tar.gz
focaccia-qemu-94894ff2d13c85a840f80387c573a34ed6c99063.zip
linux-user: elf: mmap all the target-pages of hostpage for data segment
If the hostpage size is greater than the TARGET_PAGESIZE, the
target-pages of size TARGET_PAGESIZE are marked valid only till the
length requested during the elfload. The glibc attempts to consume unused
space in the last page of data segment(__libc_memalign() in
elf/dl-minimal.c). If PT_LOAD p_align is greater than or
equal to hostpage size, the GLRO(dl_pagesize) is actually the host pagesize
as set in the auxillary vectors. So, there is no explicit mmap request for
the remaining target-pages on the last hostpage. The glibc assumes that
particular space as available and subsequent attempts to use
those addresses lead to crash as the target_mmap has not marked them valid
for those target-pages.

The issue is seen when trying to chroot to 16.04-x86_64 ubuntu on a PPC64
host where the fork fails to access the thread_id as it is allocated on a
page not marked valid. The recent glibc doesn't have checks for thread-id in
fork, but the issue can manifest somewhere else, none the less.

The fix here is to map all the target-pages of the hostpage during the
elfload if the p_align is greater than or equal to hostpage size, for
data segment to allow the glibc for proper consumption.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <153553435604.51992.5640085189104207249.stgit@lep8c.aus.stglabs.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/core/qdev.c')
0 files changed, 0 insertions, 0 deletions