Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1192469 > unrolled thread

[PATCH] fs: heap/bss calculation ignore section above STACK_TOP.

Started byNoam Camus <noamc@ezchip.com>
First post2015-07-26 08:30 +0200
Last post2015-07-26 08:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] fs: heap/bss calculation ignore section above STACK_TOP. Noam Camus <noamc@ezchip.com> - 2015-07-26 08:30 +0200

#1192469 — [PATCH] fs: heap/bss calculation ignore section above STACK_TOP.

FromNoam Camus <noamc@ezchip.com>
Date2015-07-26 08:30 +0200
Subject[PATCH] fs: heap/bss calculation ignore section above STACK_TOP.
Message-ID<pQnBE-3lz-3@gated-at.bofh.it>
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:
 #define STACK_TOP       TASK_SIZE
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web