Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751357AbbFXH2t (ORCPT ); Wed, 24 Jun 2015 03:28:49 -0400 Received: from mail-db3on0057.outbound.protection.outlook.com ([157.55.234.57]:19260 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750868AbbFXH2m convert rfc822-to-8bit (ORCPT ); Wed, 24 Jun 2015 03:28:42 -0400 From: Noam Camus To: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "vgupta@synopsys.com" , Gilad Ben Yossef , Chris Metcalf , Andreas Dilger Subject: Re: [PATCH] fs: heap/bss calculation ignore special section. Thread-Topic: [PATCH] fs: heap/bss calculation ignore special section. Thread-Index: AQHQorBXIqdmneoOzEuEhAEQ/vkY7527VuVr Date: Wed, 24 Jun 2015 07:28:38 +0000 Message-ID: References: <1433853139-28554-1-git-send-email-noamc@ezchip.com> In-Reply-To: <1433853139-28554-1-git-send-email-noamc@ezchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: synopsys.com; dkim=none (message not signed) header.d=none; x-originating-ip: [85.64.58.22] x-microsoft-exchange-diagnostics: 1;DB4PR02MB0431;5:ofJY0b6hokTbeghCXO7G8sIxZgU9xcWx85XDTTeioNGgZY137F9R6th8ZOCws5UYTRAIkCwqZl6TKYW5Rt4kvLaaOgWk274yQ/lWRZmJdL5K0tVkucTd8Se6fmNJax92T2uEcXc2WJpFZDFvNh8j7Q==;24:hzu29LkUHGb7ec001ZbCSncHXHXRauYO9c3vEfO+Pto42KBXmdFkmCTgdLE4V917W0wF+mShgpHDgWj19dEztyQHoLJa/bB+BYLtbICgQ1g=;20:oytByS87dFLR4F2XuOLEKzFawdSc4q3Zl7cvSFNFLSDrVRclbfVVXswAaDP7he2obJpiT1oqvC2XFnXhW3aP+A== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB4PR02MB0431; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:DB4PR02MB0431;BCL:0;PCL:0;RULEID:;SRVR:DB4PR02MB0431; x-forefront-prvs: 061725F016 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(377454003)(5001770100001)(5002640100001)(62966003)(77156002)(92566002)(5003600100002)(2656002)(87936001)(46102003)(2900100001)(2950100001)(76576001)(5001960100002)(2501003)(189998001)(122556002)(77096005)(66066001)(102836002)(33656002)(86362001)(106116001)(40100003)(50986999)(76176999)(19580405001)(19580395003)(54356999)(74316001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB4PR02MB0431;H:DB4PR02MB272.eurprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT MIME-Version: 1.0 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2015 07:28:38.7060 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR02MB0431 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1823 Lines: 52 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 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 --- 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 -- 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/