Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1627112yba; Thu, 25 Apr 2019 03:04:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyd51UWA+qZsKii6lHVW/VqTd6CXq7Imf2T3UOfWliLD3Gwt0ESN73k7OZDlTU5JbHHqedA X-Received: by 2002:a63:d107:: with SMTP id k7mr10867817pgg.116.1556186670177; Thu, 25 Apr 2019 03:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556186670; cv=none; d=google.com; s=arc-20160816; b=QPRKbJpM/aU61QRxKkaotyRdfAGG0vQJywosj3FF5Vs8pW8BDX0WvkMlWRwi4P+uHN XNN5uKw70jJjntDTKcUDmEECJjWDQXazoZ08LWVaOileO5taTUSxwq3BJd3koEn5BIn/ wFfs72dMucOPbMGHELIJiA1IHw1GT8szAv02+8W+lF3s19ynwBUPD3V8yqHTRR8WL7TT aTgMYj6q/pJfC1J6j1ohD6pa8GrLvxG5tUaotTo4JiUdipz0SFLUk8bMO3ze269QTMGg 1r/whyOku1oBRj8WVf3ftzmcdfLNuUtNKFZTvNkW3XQPPU1aZmjvniohvGdmTyEWTypk HIyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=1SMtjbbxe+Qbcyo0ZM5a7rnM3mrDfctaGP/p34nJGZY=; b=sYOBpZs/MI/HvqRnJHw2j7uTkA1Az/maMBnY0EFzD1HSyXcodFZZ8I4rT3BDWrcyPr pKT0G6vEQWlcca7VI2gIl2Q8P40K7LAXcAIIfFQCa4JYI3IkZ65F9Co9ma18TzR00GEl GZT572uP8MYiGXqNIBHFR77lr+Bk0520mT/DnHahX0dyhXpTGU2DdTYqFPOYs+JLqmC1 nfUrkvgcHm4EihrhnUKJlN1qRQzW2dnoyy7kSQfBXNBerm+b0VZM4rPw3GpM7CI1cZSm HtWVSb7ENdBWytGeNHJwtdQF8jzqO7oNZ/1nnjXvyxJbFnYwVtj+0qnDT/tDSOwln0wG Y1Vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si11777859pge.27.2019.04.25.03.04.11; Thu, 25 Apr 2019 03:04:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732581AbfDXVAx (ORCPT + 99 others); Wed, 24 Apr 2019 17:00:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56488 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728550AbfDXVAw (ORCPT ); Wed, 24 Apr 2019 17:00:52 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50FB33098490; Wed, 24 Apr 2019 21:00:52 +0000 (UTC) Received: from [10.18.17.208] (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E99C25D9C5; Wed, 24 Apr 2019 21:00:50 +0000 (UTC) Subject: Re: [PATCH v3 3/9] livepatch: Add klp-convert tool To: Miroslav Benes Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org, Jessica Yu , Jiri Kosina , Joao Moreira , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Nicolai Stange , Petr Mladek References: <20190410155058.9437-1-joe.lawrence@redhat.com> <20190410155058.9437-4-joe.lawrence@redhat.com> <20190423203529.GA15743@redhat.com> From: Joe Lawrence Message-ID: <4581c471-e6ac-16a8-1bee-bb03a4476bf6@redhat.com> Date: Wed, 24 Apr 2019 17:00:50 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 24 Apr 2019 21:00:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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