All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Cc: Jiri Kosina <jkosina@suse.cz>, Andi Kleen <ak@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, x86@kernel.org
Subject: Re: [RFC PATCH] mmap, aslr: do not enforce legacy mmap on unlimited stacks
Date: Fri, 23 Jun 2017 10:46:19 +0200	[thread overview]
Message-ID: <20170623084619.GI5308@dhcp22.suse.cz> (raw)
In-Reply-To: <20170614082218.12450-1-mhocko@kernel.org>

ping?

On Wed 14-06-17 10:22:18, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> Since cc503c1b43e0 ("x86: PIE executable randomization") we treat
> applications with RLIMIT_STACK configured to unlimited as legacy
> and so we a) set the mmap_base to 1/3 of address space + randomization
> and b) mmap from bottom to top. This makes some sense as it allows the
> stack to grow really large. On the other hand it reduces the address
> space usable for default mmaps (wihout address hint) quite a lot. We
> have received a bug report that SAP HANA workload has hit into this
> limitation.
> 
> We could argue that the user just got what he asked for when setting
> up the unlimited stack but to be realistic growing stack up to 1/6
> TASK_SIZE (allowed by mmap_base) is pretty much unimited in the real
> life. This would give mmap 20TB of additional address space which is
> quite nice. Especially when it is much more likely to use that address
> space than the reserved stack.
> 
> Digging into the history the original implementation of the
> randomization 8817210d4d96 ("[PATCH] x86_64: Flexmap for 32bit and
> randomized mappings for 64bit") didn't have this restriction.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> 
> Hi,
> I am sending this as a RFC because I am not really sure how to deal with
> this. We might as well ignore the reported issue and claim "do not use
> unlimited stacks" and be done with it. I just stroke me as an unexpected
> behavior.
> 
>  arch/x86/mm/mmap.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> index 19ad095b41df..797295e792b2 100644
> --- a/arch/x86/mm/mmap.c
> +++ b/arch/x86/mm/mmap.c
> @@ -74,9 +74,6 @@ static int mmap_is_legacy(void)
>  	if (current->personality & ADDR_COMPAT_LAYOUT)
>  		return 1;
>  
> -	if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
> -		return 1;
> -
>  	return sysctl_legacy_va_layout;
>  }
>  
> -- 
> 2.11.0
> 

-- 
Michal Hocko
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Cc: Jiri Kosina <jkosina@suse.cz>, Andi Kleen <ak@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, x86@kernel.org
Subject: Re: [RFC PATCH] mmap, aslr: do not enforce legacy mmap on unlimited stacks
Date: Fri, 23 Jun 2017 10:46:19 +0200	[thread overview]
Message-ID: <20170623084619.GI5308@dhcp22.suse.cz> (raw)
In-Reply-To: <20170614082218.12450-1-mhocko@kernel.org>

ping?

On Wed 14-06-17 10:22:18, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> Since cc503c1b43e0 ("x86: PIE executable randomization") we treat
> applications with RLIMIT_STACK configured to unlimited as legacy
> and so we a) set the mmap_base to 1/3 of address space + randomization
> and b) mmap from bottom to top. This makes some sense as it allows the
> stack to grow really large. On the other hand it reduces the address
> space usable for default mmaps (wihout address hint) quite a lot. We
> have received a bug report that SAP HANA workload has hit into this
> limitation.
> 
> We could argue that the user just got what he asked for when setting
> up the unlimited stack but to be realistic growing stack up to 1/6
> TASK_SIZE (allowed by mmap_base) is pretty much unimited in the real
> life. This would give mmap 20TB of additional address space which is
> quite nice. Especially when it is much more likely to use that address
> space than the reserved stack.
> 
> Digging into the history the original implementation of the
> randomization 8817210d4d96 ("[PATCH] x86_64: Flexmap for 32bit and
> randomized mappings for 64bit") didn't have this restriction.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> 
> Hi,
> I am sending this as a RFC because I am not really sure how to deal with
> this. We might as well ignore the reported issue and claim "do not use
> unlimited stacks" and be done with it. I just stroke me as an unexpected
> behavior.
> 
>  arch/x86/mm/mmap.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> index 19ad095b41df..797295e792b2 100644
> --- a/arch/x86/mm/mmap.c
> +++ b/arch/x86/mm/mmap.c
> @@ -74,9 +74,6 @@ static int mmap_is_legacy(void)
>  	if (current->personality & ADDR_COMPAT_LAYOUT)
>  		return 1;
>  
> -	if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
> -		return 1;
> -
>  	return sysctl_legacy_va_layout;
>  }
>  
> -- 
> 2.11.0
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-06-23  8:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  8:22 [RFC PATCH] mmap, aslr: do not enforce legacy mmap on unlimited stacks Michal Hocko
2017-06-14  8:22 ` Michal Hocko
2017-06-23  8:46 ` Michal Hocko [this message]
2017-06-23  8:46   ` Michal Hocko
2017-06-23 14:02 ` [tip:x86/mm] x86/mmap, ASLR: Do not treat unlimited-stack tasks as legacy mmap tip-bot for Michal Hocko
2017-06-23 14:54   ` Oleg Nesterov
2017-06-27  8:00     ` Jiri Kosina
2017-06-27 14:22       ` Oleg Nesterov
2017-06-28  9:40         ` Jiri Kosina
2017-06-23 20:35   ` Jiri Kosina
2017-06-24  6:43   ` tip-bot for Michal Hocko

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=20170623084619.GI5308@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.