From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 5/5] linux-user: Handle brk() attempts with very large sizes
Date: Thu, 4 Aug 2016 17:15:05 +0300 [thread overview]
Message-ID: <ef4330c23bb47b97a859dbdbae1c784fd2ca402f.1470319929.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1470319929.git.riku.voipio@linaro.org>
From: Peter Maydell <peter.maydell@linaro.org>
In do_brk(), we were inadvertently truncating the size
of a requested brk() from the guest by putting it into an
'int' variable. This meant that we would incorrectly report
success back to the guest rather than a failed allocation,
typically resulting in the guest then segfaulting. Use
abi_ulong instead.
This fixes a crash in the '31370.cc' test in the gcc libstdc++ test
suite (the test case starts by trying to allocate a very large
size and reduces the size until the allocation succeeds).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/syscall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index df6f2a9..833f853 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -839,7 +839,7 @@ void target_set_brk(abi_ulong new_brk)
abi_long do_brk(abi_ulong new_brk)
{
abi_long mapped_addr;
- int new_alloc_size;
+ abi_ulong new_alloc_size;
DEBUGF_BRK("do_brk(" TARGET_ABI_FMT_lx ") -> ", new_brk);
--
2.1.4
next prev parent reply other threads:[~2016-08-04 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 14:15 [Qemu-devel] [PULL 0/5] linux-user fixes for 2.7 riku.voipio
2016-08-04 14:15 ` [Qemu-devel] [PULL 1/5] linux-user: Use correct alignment for long long on i386 guests riku.voipio
2016-08-04 14:15 ` [Qemu-devel] [PULL 2/5] linux-user: Fix memchr() argument in open_self_cmdline() riku.voipio
2016-08-04 14:15 ` [Qemu-devel] [PULL 3/5] linux-user: Don't write off end of new_utsname buffer riku.voipio
2016-08-04 14:15 ` [Qemu-devel] [PULL 4/5] linux-user: Fix target_semid_ds structure definition riku.voipio
2016-08-04 14:15 ` riku.voipio [this message]
2016-08-05 9:21 ` [Qemu-devel] [PULL 0/5] linux-user fixes for 2.7 Peter Maydell
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=ef4330c23bb47b97a859dbdbae1c784fd2ca402f.1470319929.git.riku.voipio@linaro.org \
--to=riku.voipio@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).