lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1504252243080.16113@pobox.suse.cz>
Date:	Sat, 25 Apr 2015 22:44:55 +0200 (CEST)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Minfei Huang <minfei.huang@...mail.com>
cc:	Josh Poimboeuf <jpoimboe@...hat.com>,
	Seth Jennings <sjenning@...hat.com>,
	Vojtech Pavlik <vojtech@...e.cz>,
	live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] livepatch: x86: make kASLR logic more accurate

On Sat, 25 Apr 2015, Minfei Huang wrote:

> > diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
> > index 2d29197..84a3247 100644
> > --- a/arch/x86/include/asm/livepatch.h
> > +++ b/arch/x86/include/asm/livepatch.h
> > @@ -23,8 +23,12 @@
> >  
> >  #include <linux/module.h>
> >  #include <linux/ftrace.h>
> > +#include <asm/setup.h>
> >  
> >  #ifdef CONFIG_LIVEPATCH
> > +
> > +extern unsigned long klp_vmlinux_relocation_offset(void);
> > +
> >  static inline int klp_check_compiler_support(void)
> >  {
> >  #ifndef CC_USING_FENTRY
> > diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c
> > index ff3c3101d..6df7902 100644
> > --- a/arch/x86/kernel/livepatch.c
> > +++ b/arch/x86/kernel/livepatch.c
> > @@ -88,3 +88,8 @@ int klp_write_module_reloc(struct module *mod, unsigned long type,
> >  
> >  	return ret;
> >  }
> > +
> > +unsigned long klp_vmlinux_relocation_offset(void)
> > +{
> > +	return (unsigned long)&_text - __START_KERNEL;
> > +}
> 
> Is it possible to put above function into arch/x86/include/asm/setup.h?
> It is more elegant, so that the function is re-used by other module.

Yup, makes sense. I will take that into account in v3. At least x86 module 
loader can already immediately make use of that.

> > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> > index 284e269..ff4c35c 100644
> > --- a/kernel/livepatch/core.c
> > +++ b/kernel/livepatch/core.c
> > @@ -234,8 +234,9 @@ static int klp_find_verify_func_addr(struct klp_object *obj,
> >  	int ret;
> >  
> >  #if defined(CONFIG_RANDOMIZE_BASE)
> > -	/* KASLR is enabled, disregard old_addr from user */
> > -	func->old_addr = 0;
> > +	/* If KASLR has been enabled, adjust old_addr accordingly */
> > +	if (kaslr_enabled())
> > +		func->old_addr += klp_vmlinux_relocation_offset();
> 
> Since KASLR only works for x86 arch now, it is better to put it into the
> specfied arch (x86 now), or implement a weak function to let be overwritten
> by specified arch.

I responded to Josh on this matter already.

Thanks,

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ