mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: heap/bss calculation ignore section above STACK_TOP.
@ 2015-07-26  6:21 Noam Camus
  2015-07-26  6:27 ` Noam Camus
  0 siblings, 1 reply; 2+ messages in thread
From: Noam Camus @ 2015-07-26  6:21 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, viro
  Cc: Alexey.Brodkin, vgupta, adilger, giladb, Noam Camus

From: Noam Camus <noamc@ezchip.com>

Today bss/heap is placed above last loaded sections.
Current check is only against TASK_SIZE, maybe since most architectures do:

But this is not true for all of them and a gap between TASK_SIZE
and STACK_TOP is possible and may be used for variant purposes.
For example we use it for a special physical memory mapping.

In such case of section in this gap we skip it for matter of
heap/bss calculation.
set_brk will never work for such case anyway.

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 6b65996..e445886 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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-26  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-26  6:21 [PATCH] fs: heap/bss calculation ignore section above STACK_TOP Noam Camus
2015-07-26  6:27 ` Noam Camus

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®