From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759737AbYHRTjq (ORCPT ); Mon, 18 Aug 2008 15:39:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933437AbYHRThF (ORCPT ); Mon, 18 Aug 2008 15:37:05 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41635 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933434AbYHRThC (ORCPT ); Mon, 18 Aug 2008 15:37:02 -0400 Date: Mon, 18 Aug 2008 12:20:21 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, uml-devel , "Christopher S. Aker" , Jeff Dike , WANG Cong Subject: [patch 29/49] uml: physical memory shouldnt include initial stack Message-ID: <20080818192021.GD10350@suse.de> References: <20080818191012.663450219@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="uml-physical-memory-shouldn-t-include-initial-stack.patch" In-Reply-To: <20080818191834.GA10350@suse.de> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.25-stable review patch. If anyone has any objections, please let us know. ------------------ From: Jeff Dike commit 60a2988aea701a6424809a5432bf068667aac177 upstream The top of physical memory should be below the initial process stack, not the top of the address space, at least for as long as the stack isn't known to the kernel VM system and appropriately reserved. Cc: "Christopher S. Aker" Signed-off-by: Jeff Dike Cc: WANG Cong Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/um/kernel/um_arch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -259,6 +259,7 @@ int __init linux_main(int argc, char **a unsigned long avail, diff; unsigned long virtmem_size, max_physmem; unsigned int i, add; + unsigned long stack; char * mode; for (i = 1; i < argc; i++) { @@ -347,7 +348,9 @@ int __init linux_main(int argc, char **a } virtmem_size = physmem_size; - avail = TASK_SIZE - start_vm; + stack = (unsigned long) argv; + stack &= ~(1024 * 1024 - 1); + avail = stack - start_vm; if (physmem_size > avail) virtmem_size = avail; end_vm = start_vm + virtmem_size; --