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] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 30 Nov 2015 19:17:16 -0600
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Chris J Arges <chris.j.arges@...onical.com>
Cc:	Miroslav Benes <mbenes@...e.cz>, live-patching@...r.kernel.org,
	linux-kernel@...r.kernel.org, jikos@...nel.org, pmladek@...e.com,
	jeyu@...hat.com, Seth Jennings <sjenning@...hat.com>,
	Vojtech Pavlik <vojtech@...e.com>
Subject: Re: [PATCH 2/3 v8] livepatch: add sympos as disambiguator field to
 klp_reloc

On Mon, Nov 30, 2015 at 02:46:18PM -0600, Chris J Arges wrote:
> On Mon, Nov 23, 2015 at 10:52:23AM +0100, Miroslav Benes wrote:
> > On Fri, 20 Nov 2015, Chris J Arges wrote:
> > 
> > [...]
> > 
> > > @@ -272,6 +233,7 @@ static int klp_write_object_relocations(struct module *pmod,
> > >  					struct klp_object *obj)
> > >  {
> > >  	int ret;
> > > +	unsigned long val;
> > >  	struct klp_reloc *reloc;
> > >  
> > >  	if (WARN_ON(!klp_is_object_loaded(obj)))
> > > @@ -281,29 +243,26 @@ static int klp_write_object_relocations(struct module *pmod,
> > >  		return -EINVAL;
> > >  
> > >  	for (reloc = obj->relocs; reloc->name; reloc++) {
> > > -		if (!klp_is_module(obj)) {
> > > -			ret = klp_verify_vmlinux_symbol(reloc->name,
> > > -							reloc->val);
> > > -			if (ret)
> > > -				return ret;
> > > -		} else {
> > > -			/* module, reloc->val needs to be discovered */
> > > -			if (reloc->external)
> > > -				ret = klp_find_external_symbol(pmod,
> > > -							       reloc->name,
> > > -							       &reloc->val);
> > > -			else
> > > -				ret = klp_find_object_symbol(obj->mod->name,
> > > -							     reloc->name,
> > > -							     0, &reloc->val);
> > > -			if (ret)
> > > -				return ret;
> > > -		}
> > > +		/* discover the address of the referenced symbol */
> > > +		if (reloc->external) {
> > > +			if (reloc->sympos > 0) {
> > > +				pr_err("non-zero sympos for external reloc symbol '%s' is not supported\n",
> > > +				       reloc->name);
> > > +				return -EINVAL;
> > > +			}
> > > +			ret = klp_find_external_symbol(pmod, reloc->name, &val);
> > > +		} else
> > > +			ret = klp_find_object_symbol(obj->mod->name,
> > > +						     reloc->name,
> > > +						     reloc->sympos,
> > > +						     &val);
> > 
> > I think this will cause an unwanted effect if a relocation is for vmlinux 
> > symbol. obj->mod is NULL in that case. So obj->name should be there. Can 
> > you test it with kpatch, Chris, please? If that is possible.
> > 
> > Thanks,
> > Miroslav
> >
> 
> Yes I need to fix this, an option would be to use:
> 	ret = klp_find_object_symbol(obj->name ? obj->name : obj->mod->name,
> 				     reloc->name, 0, &reloc->val);

Instead of

  'obj->name ? obj->name : obj->mod->name'
  
I think it can just be 'obj->name'.

If it's patching a module, obj->name will be the module name, otherwise
it will be NULL (for patching vmlinux).  klp_find_object_symbol() is
equipped to handle it either way.

-- 
Josh
--
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