mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Noam Camus <noamc@ezchip.com>
To: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "vgupta@synopsys.com" <vgupta@synopsys.com>,
	Gilad Ben Yossef <giladb@ezchip.com>,
	Chris Metcalf <cmetcalf@ezchip.com>,
	Andreas Dilger <adilger@dilger.ca>
Subject: Re: [PATCH] fs: heap/bss calculation ignore special section.
Date: Wed, 24 Jun 2015 07:28:38 +0000	[thread overview]
Message-ID: <DB4PR02MB2729B8E783A3B6A4449F06CD6AF0@DB4PR02MB272.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <1433853139-28554-1-git-send-email-noamc@ezchip.com>

Andreas Dilger suggested that my previous email may be discarded due to my Sender Policy Framework (SPF) .
So I email this from different location, just in case.

Noam
________________________________________
From: Noam Camus
Sent: Tuesday, June 9, 2015 3:32 PM
To: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org
Cc: vgupta@synopsys.com; Gilad Ben Yossef; Chris Metcalf; Noam Camus
Subject: [PATCH] fs: heap/bss calculation ignore special section.

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


      reply	other threads:[~2015-06-24  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:32 Noam Camus
2015-06-24  7:28 ` Noam Camus [this message]

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=DB4PR02MB2729B8E783A3B6A4449F06CD6AF0@DB4PR02MB272.eurprd02.prod.outlook.com \
    --to=noamc@ezchip.com \
    --cc=adilger@dilger.ca \
    --cc=cmetcalf@ezchip.com \
    --cc=giladb@ezchip.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgupta@synopsys.com \
    /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®