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


Groups > linux.kernel > #1711097 > unrolled thread

[PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE)

Started by"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
First post2017-08-14 18:00 +0200
Last post2017-08-14 18:40 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-08-14 18:00 +0200
    Re: [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) Cyrill Gorcunov <gorcunov@gmail.com> - 2017-08-14 18:20 +0200
      Re: [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-14 18:30 +0200
      Re: [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-14 18:30 +0200
      Re: [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) Oleg Nesterov <oleg@redhat.com> - 2017-08-14 18:30 +0200
        Re: [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE) Cyrill Gorcunov <gorcunov@gmail.com> - 2017-08-14 18:40 +0200

#1711097 — [PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE)

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2017-08-14 18:00 +0200
Subject[PATCH] x86/mm: Fix personality(ADDR_NO_RANDOMIZE)
Message-ID<uepWA-60G-65@gated-at.bofh.it>
In v4.12, during rework of infrastructure around mmap_base, disable-ASLR
personality flag got accidentally broken.

Let's make it work again.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: 1b028f784e8c ("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
Cc: stable <stable@vger.kernel.org> [4.12+]
---
 arch/x86/mm/mmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 229d04a83f85..779bdbe5e424 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -127,6 +127,8 @@ static unsigned long mmap_legacy_base(unsigned long rnd,
 static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base,
 		unsigned long random_factor, unsigned long task_size)
 {
+	if (!(current->flags & PF_RANDOMIZE))
+		random_factor = 0;
 	*legacy_base = mmap_legacy_base(random_factor, task_size);
 	if (mmap_is_legacy())
 		*base = *legacy_base;
-- 
2.14.1

[toc] | [next] | [standalone]


#1711136

FromCyrill Gorcunov <gorcunov@gmail.com>
Date2017-08-14 18:20 +0200
Message-ID<ueqfU-6mT-23@gated-at.bofh.it>
In reply to#1711097
On Mon, Aug 14, 2017 at 06:57:19PM +0300, Kirill A. Shutemov wrote:
> In v4.12, during rework of infrastructure around mmap_base, disable-ASLR
> personality flag got accidentally broken.
> 
> Let's make it work again.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Fixes: 1b028f784e8c ("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
> Cc: stable <stable@vger.kernel.org> [4.12+]
> ---
>  arch/x86/mm/mmap.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> index 229d04a83f85..779bdbe5e424 100644
> --- a/arch/x86/mm/mmap.c
> +++ b/arch/x86/mm/mmap.c
> @@ -127,6 +127,8 @@ static unsigned long mmap_legacy_base(unsigned long rnd,
>  static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base,
>  		unsigned long random_factor, unsigned long task_size)
>  {
> +	if (!(current->flags & PF_RANDOMIZE))
> +		random_factor = 0;
>  	*legacy_base = mmap_legacy_base(random_factor, task_size);
>  	if (mmap_is_legacy())
>  		*base = *legacy_base;

Didn't Oleg's patch does the same?

https://patchwork.kernel.org/patch/9832697/

for some reason it's not yet merged.

[toc] | [prev] | [next] | [standalone]


#1711154

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-08-14 18:30 +0200
Message-ID<ueqpA-6qC-23@gated-at.bofh.it>
In reply to#1711136
On Mon, Aug 14, 2017 at 06:20:02PM +0200, Oleg Nesterov wrote:
> On 08/14, Cyrill Gorcunov wrote:
> >
> > On Mon, Aug 14, 2017 at 06:57:19PM +0300, Kirill A. Shutemov wrote:
> > > In v4.12, during rework of infrastructure around mmap_base, disable-ASLR
> > > personality flag got accidentally broken.
> > >
> > > Let's make it work again.
> > > 
> > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Fixes: 1b028f784e8c ("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
> > > Cc: stable <stable@vger.kernel.org> [4.12+]
> > > ---
> > >  arch/x86/mm/mmap.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> > > index 229d04a83f85..779bdbe5e424 100644
> > > --- a/arch/x86/mm/mmap.c
> > > +++ b/arch/x86/mm/mmap.c
> > > @@ -127,6 +127,8 @@ static unsigned long mmap_legacy_base(unsigned long rnd,
> > >  static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base,
> > >  		unsigned long random_factor, unsigned long task_size)
> > >  {
> > > +	if (!(current->flags & PF_RANDOMIZE))
> > > +		random_factor = 0;
> > >  	*legacy_base = mmap_legacy_base(random_factor, task_size);
> > >  	if (mmap_is_legacy())
> > >  		*base = *legacy_base;
> >
> > Didn't Oleg's patch does the same?
> >
> > https://patchwork.kernel.org/patch/9832697/
> 
> at first glance yes, thanks Cyrill. And note that we do not need another
> PF_RANDOMIZE check.
> 
> > for some reason it's not yet merged.
> 
> because nobody cares ;)

Well, I do. :)

It took me few days to track down where huge variablity in micro benchmark
results comes from. :/

-- 
 Kirill A. Shutemov

[toc] | [prev] | [next] | [standalone]


#1711172

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2017-08-14 18:30 +0200
Message-ID<ueqpC-6qC-63@gated-at.bofh.it>
In reply to#1711136
On Mon, Aug 14, 2017 at 07:13:47PM +0300, Cyrill Gorcunov wrote:
> On Mon, Aug 14, 2017 at 06:57:19PM +0300, Kirill A. Shutemov wrote:
> > In v4.12, during rework of infrastructure around mmap_base, disable-ASLR
> > personality flag got accidentally broken.
> > 
> > Let's make it work again.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Fixes: 1b028f784e8c ("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
> > Cc: stable <stable@vger.kernel.org> [4.12+]
> > ---
> >  arch/x86/mm/mmap.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> > index 229d04a83f85..779bdbe5e424 100644
> > --- a/arch/x86/mm/mmap.c
> > +++ b/arch/x86/mm/mmap.c
> > @@ -127,6 +127,8 @@ static unsigned long mmap_legacy_base(unsigned long rnd,
> >  static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base,
> >  		unsigned long random_factor, unsigned long task_size)
> >  {
> > +	if (!(current->flags & PF_RANDOMIZE))
> > +		random_factor = 0;
> >  	*legacy_base = mmap_legacy_base(random_factor, task_size);
> >  	if (mmap_is_legacy())
> >  		*base = *legacy_base;
> 
> Didn't Oleg's patch does the same?

Yes, it does. And it looks cleaner than my attempt.

> https://patchwork.kernel.org/patch/9832697/
> 
> for some reason it's not yet merged.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [next] | [standalone]


#1711185

FromOleg Nesterov <oleg@redhat.com>
Date2017-08-14 18:30 +0200
Message-ID<ueqpA-6qC-25@gated-at.bofh.it>
In reply to#1711136
On 08/14, Cyrill Gorcunov wrote:
>
> On Mon, Aug 14, 2017 at 06:57:19PM +0300, Kirill A. Shutemov wrote:
> > In v4.12, during rework of infrastructure around mmap_base, disable-ASLR
> > personality flag got accidentally broken.
> >
> > Let's make it work again.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Fixes: 1b028f784e8c ("x86/mm: Introduce mmap_compat_base() for 32-bit mmap()")
> > Cc: stable <stable@vger.kernel.org> [4.12+]
> > ---
> >  arch/x86/mm/mmap.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> > index 229d04a83f85..779bdbe5e424 100644
> > --- a/arch/x86/mm/mmap.c
> > +++ b/arch/x86/mm/mmap.c
> > @@ -127,6 +127,8 @@ static unsigned long mmap_legacy_base(unsigned long rnd,
> >  static void arch_pick_mmap_base(unsigned long *base, unsigned long *legacy_base,
> >  		unsigned long random_factor, unsigned long task_size)
> >  {
> > +	if (!(current->flags & PF_RANDOMIZE))
> > +		random_factor = 0;
> >  	*legacy_base = mmap_legacy_base(random_factor, task_size);
> >  	if (mmap_is_legacy())
> >  		*base = *legacy_base;
>
> Didn't Oleg's patch does the same?
>
> https://patchwork.kernel.org/patch/9832697/

at first glance yes, thanks Cyrill. And note that we do not need another
PF_RANDOMIZE check.

> for some reason it's not yet merged.

because nobody cares ;)

Oleg.

[toc] | [prev] | [next] | [standalone]


#1711210

FromCyrill Gorcunov <gorcunov@gmail.com>
Date2017-08-14 18:40 +0200
Message-ID<ueqzj-6tX-59@gated-at.bofh.it>
In reply to#1711185
On Mon, Aug 14, 2017 at 06:20:02PM +0200, Oleg Nesterov wrote:
...
> >
> > Didn't Oleg's patch does the same?
> >
> > https://patchwork.kernel.org/patch/9832697/
> 
> at first glance yes, thanks Cyrill. And note that we do not need another
> PF_RANDOMIZE check.
> 
> > for some reason it's not yet merged.
> 
> because nobody cares ;)

We all care but people are busy ;) Anyway hopefully it get merged soon.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web