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:   Wed, 24 Apr 2019 17:00:50 -0400
From:   Joe Lawrence <joe.lawrence@...hat.com>
To:     Miroslav Benes <mbenes@...e.cz>
Cc:     linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
        linux-kbuild@...r.kernel.org, Jessica Yu <jeyu@...nel.org>,
        Jiri Kosina <jikos@...nel.org>,
        Joao Moreira <jmoreira@...e.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michael Matz <matz@...e.de>, Nicolai Stange <nstange@...e.de>,
        Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH v3 3/9] livepatch: Add klp-convert tool

On 4/24/19 1:47 PM, Miroslav Benes wrote:
> On Tue, 23 Apr 2019, Joe Lawrence wrote:
>> diff --git a/scripts/livepatch/klp-convert.c b/scripts/livepatch/klp-convert.c
>> index 82c27d219372..126395f1c0cd 100644
>> --- a/scripts/livepatch/klp-convert.c
>> +++ b/scripts/livepatch/klp-convert.c
>> @@ -517,6 +517,7 @@ static bool convert_rela(struct section *oldsec, struct rela *r,
>>   		if (r1->sym->name == r->sym->name) {
>>   			list_del(&r1->list);
>>   			list_add(&r1->list, &sec->relas);
>> +			break;
>>   		}
>>   	}
>>   	return true;
> 
> Couldn't we remove the loop all together instead of breaking it?
> 
> 	list_del(&r->list);
> 	list_add(&r->list, &sec->relas);
> 
> could be sufficient.

Ah yea, good point.

> 
>> @@ -549,8 +550,8 @@ static bool is_converted(char *sname)
>>   }
>>   
>>   /*
>> - * Checks if symbol must be converted (conditions):
>> - * not resolved, not already converted or isn't an exported symbol
>> + * Checks if symbol must be or was already converted (conditions):
>> + * not resolved or isn't an exported symbol
>>    */
>>   static bool must_convert(struct symbol *sym)
>>   {
>> @@ -566,7 +567,7 @@ static bool must_convert(struct symbol *sym)
>>   	if (strcmp(sym->name, ".TOC.") == 0)
>>   		return false;
>>   
>> -	return (!(is_converted(sym->name) || is_exported(sym->name)));
>> +	return (!is_exported(sym->name));
>>   }
>>   
>>   /* Checks if a section is a klp rela section */
>> @@ -640,7 +641,8 @@ int main(int argc, const char **argv)
>>   			if (!must_convert(rela->sym))
>>   				continue;
>>   
>> -			if (!find_missing_position(rela->sym, &sp)) {
>> +			if (!is_converted(rela->sym->name) &&
>> +			    !find_missing_position(rela->sym, &sp)) {
>>   				WARN("Unable to find missing symbol: %s",
>>   						rela->sym->name);
>>   				return -1;
> 
> Looks good.

There were a few additional spots I needed to update (like main's 
section walk doesn't need to re-convert klp_rela_sections, and likewise, 
convert_rela doesn't need to re-convert_klp_symbol), but I will include 
with v4 for a real review.

Thanks,

-- Joe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ