public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disable kaslr in kdump kernel
@ 2014-02-11 10:08 Dave Young
  2014-02-11 13:16 ` Vivek Goyal
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Young @ 2014-02-11 10:08 UTC (permalink / raw)
  To: keescook, hpa, vgoyal, linux-kernel


KASLR does not work in kdump kernel because it's too early that mem=exactmap
has not been parsed.

Since KASLR does not make much sense for kdump kernel thus let's disable it
for kdump kernel. To check if it is a kdump kernel I just check the cmdline
param elfcorehdr just like is_kdump_kernel.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 linux-2.6/arch/x86/boot/compressed/aslr.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: dyoung/git/linux-2.6/arch/x86/boot/compressed/aslr.c
===================================================================
--- linux-2.6/arch/x86/boot/compressed/aslr.c
+++ linux-2.6/arch/x86/boot/compressed/aslr.c
@@ -293,6 +293,11 @@ unsigned char *choose_kernel_location(un
 		goto out;
 	}
 
+	if (cmdline_find_option("elfcorehdr", NULL, 0) != -1) {
+		debug_putstr("KASLR disabled...\n");
+		goto out;
+	}
+
 	/* Record the various known unsafe memory ranges. */
 	mem_avoid_init((unsigned long)input, input_size,
 		       (unsigned long)output, output_size);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] disable kaslr in kdump kernel
  2014-02-11 10:08 [PATCH] disable kaslr in kdump kernel Dave Young
@ 2014-02-11 13:16 ` Vivek Goyal
  2014-02-12  1:37   ` Dave Young
  0 siblings, 1 reply; 4+ messages in thread
From: Vivek Goyal @ 2014-02-11 13:16 UTC (permalink / raw)
  To: Dave Young; +Cc: keescook, hpa, linux-kernel

On Tue, Feb 11, 2014 at 06:08:38PM +0800, Dave Young wrote:
> 
> KASLR does not work in kdump kernel because it's too early that mem=exactmap
> has not been parsed.
> 
> Since KASLR does not make much sense for kdump kernel thus let's disable it
> for kdump kernel. To check if it is a kdump kernel I just check the cmdline
> param elfcorehdr just like is_kdump_kernel.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>

I don't think it is a good idea. I don't like hardcoding second kernel's
behavior. I rather vary second kernel's behavior based on command line
parameters or based on values passed in bootparams.

So I am more than happy to pass command line option "nokaslr" instead
of hardcoding this in kernel.

Thanks
Vivek

> ---
>  linux-2.6/arch/x86/boot/compressed/aslr.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> Index: dyoung/git/linux-2.6/arch/x86/boot/compressed/aslr.c
> ===================================================================
> --- linux-2.6/arch/x86/boot/compressed/aslr.c
> +++ linux-2.6/arch/x86/boot/compressed/aslr.c
> @@ -293,6 +293,11 @@ unsigned char *choose_kernel_location(un
>  		goto out;
>  	}
>  
> +	if (cmdline_find_option("elfcorehdr", NULL, 0) != -1) {
> +		debug_putstr("KASLR disabled...\n");
> +		goto out;
> +	}
> +
>  	/* Record the various known unsafe memory ranges. */
>  	mem_avoid_init((unsigned long)input, input_size,
>  		       (unsigned long)output, output_size);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] disable kaslr in kdump kernel
  2014-02-11 13:16 ` Vivek Goyal
@ 2014-02-12  1:37   ` Dave Young
  2014-02-12 14:05     ` Vivek Goyal
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Young @ 2014-02-12  1:37 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: keescook, hpa, linux-kernel

On 02/11/14 at 08:16am, Vivek Goyal wrote:
> On Tue, Feb 11, 2014 at 06:08:38PM +0800, Dave Young wrote:
> > 
> > KASLR does not work in kdump kernel because it's too early that mem=exactmap
> > has not been parsed.
> > 
> > Since KASLR does not make much sense for kdump kernel thus let's disable it
> > for kdump kernel. To check if it is a kdump kernel I just check the cmdline
> > param elfcorehdr just like is_kdump_kernel.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> 
> I don't think it is a good idea. I don't like hardcoding second kernel's
> behavior. I rather vary second kernel's behavior based on command line
> parameters or based on values passed in bootparams.
> 
> So I am more than happy to pass command line option "nokaslr" instead
> of hardcoding this in kernel.

That's also fine to me, but I think we'd better add it to documentation?

> 
> Thanks
> Vivek
> 
> > ---
> >  linux-2.6/arch/x86/boot/compressed/aslr.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > Index: dyoung/git/linux-2.6/arch/x86/boot/compressed/aslr.c
> > ===================================================================
> > --- linux-2.6/arch/x86/boot/compressed/aslr.c
> > +++ linux-2.6/arch/x86/boot/compressed/aslr.c
> > @@ -293,6 +293,11 @@ unsigned char *choose_kernel_location(un
> >  		goto out;
> >  	}
> >  
> > +	if (cmdline_find_option("elfcorehdr", NULL, 0) != -1) {
> > +		debug_putstr("KASLR disabled...\n");
> > +		goto out;
> > +	}
> > +
> >  	/* Record the various known unsafe memory ranges. */
> >  	mem_avoid_init((unsigned long)input, input_size,
> >  		       (unsigned long)output, output_size);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] disable kaslr in kdump kernel
  2014-02-12  1:37   ` Dave Young
@ 2014-02-12 14:05     ` Vivek Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Vivek Goyal @ 2014-02-12 14:05 UTC (permalink / raw)
  To: Dave Young; +Cc: keescook, hpa, linux-kernel

On Wed, Feb 12, 2014 at 09:37:34AM +0800, Dave Young wrote:
> On 02/11/14 at 08:16am, Vivek Goyal wrote:
> > On Tue, Feb 11, 2014 at 06:08:38PM +0800, Dave Young wrote:
> > > 
> > > KASLR does not work in kdump kernel because it's too early that mem=exactmap
> > > has not been parsed.
> > > 
> > > Since KASLR does not make much sense for kdump kernel thus let's disable it
> > > for kdump kernel. To check if it is a kdump kernel I just check the cmdline
> > > param elfcorehdr just like is_kdump_kernel.
> > > 
> > > Signed-off-by: Dave Young <dyoung@redhat.com>
> > 
> > I don't think it is a good idea. I don't like hardcoding second kernel's
> > behavior. I rather vary second kernel's behavior based on command line
> > parameters or based on values passed in bootparams.
> > 
> > So I am more than happy to pass command line option "nokaslr" instead
> > of hardcoding this in kernel.
> 
> That's also fine to me, but I think we'd better add it to documentation?

Adding documentation is fine. May be Documentation/kdump/kdump.txt. Create
a section where we mention some of the preferred command line settings
for kdump to work.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-12 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 10:08 [PATCH] disable kaslr in kdump kernel Dave Young
2014-02-11 13:16 ` Vivek Goyal
2014-02-12  1:37   ` Dave Young
2014-02-12 14:05     ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox