From: Jeff Dike <jdike@addtoit.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] UML - fix binary layout assumption
Date: Fri, 10 Sep 2004 14:28:14 -0400 [thread overview]
Message-ID: <200409101828.i8AISE0O003433@ccure.user-mode-linux.org> (raw)
This patch calculates section boundaries differently so as to not get tripped
up by holes in the binary such as are introduced by exec-shield.
Jeff
Index: 2.6.9-rc1/arch/um/kernel/tt/process_kern.c
===================================================================
--- 2.6.9-rc1.orig/arch/um/kernel/tt/process_kern.c 2004-09-10 12:59:10.000000000 -0400
+++ 2.6.9-rc1/arch/um/kernel/tt/process_kern.c 2004-09-10 13:07:19.000000000 -0400
@@ -423,7 +423,7 @@
protect_memory(start, end - start, 1, w, 1, 1);
start = (unsigned long) UML_ROUND_DOWN(&__bss_start);
- end = (unsigned long) UML_ROUND_UP(&_end);
+ end = (unsigned long) UML_ROUND_UP(brk_start);
protect_memory(start, end - start, 1, w, 1, 1);
mprotect_kernel_vm(w);
Index: 2.6.9-rc1/arch/um/kernel/um_arch.c
===================================================================
--- 2.6.9-rc1.orig/arch/um/kernel/um_arch.c 2004-09-10 12:52:44.000000000 -0400
+++ 2.6.9-rc1/arch/um/kernel/um_arch.c 2004-09-10 13:07:44.000000000 -0400
@@ -306,7 +306,7 @@
int linux_main(int argc, char **argv)
{
- unsigned long avail;
+ unsigned long avail, diff;
unsigned long virtmem_size, max_physmem;
unsigned int i, add;
@@ -324,6 +324,16 @@
brk_start = (unsigned long) sbrk(0);
CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start);
+ /* Increase physical memory size for exec-shield users
+ so they actually get what they asked for. This should
+ add zero for non-exec shield users */
+
+ diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
+ if(diff > 1024 * 1024){
+ printf("Adding %ld bytes to physical memory to account for "
+ "exec-shield gap\n", diff);
+ physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
+ }
uml_physmem = uml_start;
reply other threads:[~2004-09-10 17:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200409101828.i8AISE0O003433@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®