linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: heap/bss calculation ignore special section.
@ 2015-06-09 12:32 Noam Camus
  2015-06-24  7:28 ` Noam Camus
  0 siblings, 1 reply; 2+ messages in thread
From: Noam Camus @ 2015-06-09 12:32 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel; +Cc: vgupta, giladb, cmetcalf, Noam Camus

From: Noam Camus <noamc@ezchip.com>

Today bss/heap is placed above last loaded sections.
However if STACK_TOP is not equal to TASK_SIZE we wish to ignore
such sections mapped to this gap between STACK_TOP and TASK_SIZE.
set_brk will never work for such case.

So at the moment this addition is just a sanity check.

An alternative (more complex):
Linux would make use of LMA field in ELF, then we can set VMA below
STACK_TOP and set LMA to be between STACK_TOP and TASK_SIZE to match
such special memory mapping.

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 fs/binfmt_elf.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 241ef68..09f9483 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -962,6 +962,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
 
 		k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
 
+		if (k >= STACK_TOP)
+			continue;
+
 		if (k > elf_bss)
 			elf_bss = k;
 		if ((elf_ppnt->p_flags & PF_X) && end_code < k)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-24  7:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-09 12:32 [PATCH] fs: heap/bss calculation ignore special section Noam Camus
2015-06-24  7:28 ` Noam Camus

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).