From: Martin Jansa <martin.jansa@gmail.com>
To: qemu-devel@nongnu.org
Cc: Martin Jansa <Martin.Jansa@gmail.com>
Subject: [Qemu-devel] [PATCH] linux-user: use default mmap_min_addr 65536 when /proc/sys/vm/mmap_min_addr cannot be read
Date: Thu, 13 May 2010 15:17:25 +0200 [thread overview]
Message-ID: <1273756645-11149-1-git-send-email-Martin.Jansa@gmail.com> (raw)
* 65536 is default at least for ubuntu and fedora.
* after http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e1a6ef2dea88101b056b6d9984f3325c5efced3
it's not readable by normal user on many systems
* there is patch to enable read-only access again
http://git.kernel.org/?p=linux/kernel/git/jmorris/security-testing-2.6.git;a=commitdiff;h=822cceec7248013821d655545ea45d1c6a9d15b3
but that's not applied in many distributions
* please consider this workaround
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
linux-user/main.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 18b52c0..94b6465 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2891,6 +2891,7 @@ int main(int argc, char **argv, char **envp)
* When loading the ELF image to determine whether guest_base
* is needed. It is also used in mmap_find_vma.
*/
+#define MMAP_MIN_ADDR_DEFAULT 65536
{
FILE *fp;
@@ -2899,8 +2900,14 @@ int main(int argc, char **argv, char **envp)
if (fscanf(fp, "%lu", &tmp) == 1) {
mmap_min_addr = tmp;
qemu_log("host mmap_min_addr=0x%lx\n", mmap_min_addr);
+ } else {
+ qemu_log("cannot read value from /proc/sys/vm/mmap_min_addr, assuming %d\n", MMAP_MIN_ADDR_DEFAULT);
+ mmap_min_addr = MMAP_MIN_ADDR_DEFAULT;
}
fclose(fp);
+ } else {
+ qemu_log("cannot open /proc/sys/vm/mmap_min_addr for reading, assuming %d\n", MMAP_MIN_ADDR_DEFAULT);
+ mmap_min_addr = MMAP_MIN_ADDR_DEFAULT;
}
}
--
1.7.1
next reply other threads:[~2010-05-13 13:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 13:17 Martin Jansa [this message]
2010-05-13 16:59 ` [Qemu-devel] [PATCH] linux-user: use default mmap_min_addr 65536 when /proc/sys/vm/mmap_min_addr cannot be read Richard Henderson
2010-05-13 19:26 ` Martin Jansa
2010-05-14 13:11 ` Richard Henderson
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=1273756645-11149-1-git-send-email-Martin.Jansa@gmail.com \
--to=martin.jansa@gmail.com \
--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).