Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1459847yba; Wed, 24 Apr 2019 23:29:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyowTjuojVi5gmaKaVzucpKujnGXJDxUh3zuWNFLeVWnm9WEdrKLY7+ZXOgtcMJM2Eg460l X-Received: by 2002:a63:8f49:: with SMTP id r9mr28684790pgn.306.1556173787067; Wed, 24 Apr 2019 23:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556173787; cv=none; d=google.com; s=arc-20160816; b=TaUPmSfTVwbHl3hqOdI7BEaRImaHz9Vf2ZJi59LgzlHurpbhQZ/YZ3HpQZpRltz2si P3v1Ipx4geRWOEa2itrCvCwqUhS7Tk5Up2DMzxqjLBQ5jIwUaBaPRqdXZVuGBxipnCfQ e58DyVH99FbzqGsms6dNl+jCIXO0KfNkiR/mQ3GYh7H+9eOFZ1JJU6HO2zBoHuSGf2o3 kMtZ3wHvd1lDKAQZIlOQndswkKK+J+qT4vb04aAq18SIELnWHWhBiY5fl8m1wMTOfu+O gDMbhEsq0b7E06z7X6W+5X8gV27srk6/wo5dEI4G0ioZ4JcLF7U5CwmZWMsBiJ9K9/Jq +7hg== 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=KuYto5EwQ0EJf+tY5uFSu5qqbPY3cIJtqZH1CPkSRwc=; b=UI41DNkF+GFQWYMeI08W5YkL9eCg/oWf/abgY385JI/K6Kx5juS/RQak0OUP9z4YX7 2P3HTeLzyjihMEYPeBKQ2qOsUIPncHygjOggEWKYI/z+/ZpN/XNBDUyB08BaqDex9vA6 I/iVLM/qFd5eIKMOMe/rQ1/sSMlAe4D3Z4184i+znb3LgWRrCChIlg4ZHomjKSCKnP5i lWJCRgIaMyn7KMeWzb7JgudmMJaT6rtWn5b0mP0U8J+BBRYVcbq3JATXEssneRNAVm3T XYrfY/De0jp3lzraC91QjaerSp2dvN6nZEBbAYOpqHUPKz5zEs6Tag9D70cXe5fO2f7h NzZw== 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 e36si5027679pgb.286.2019.04.24.23.29.31; Wed, 24 Apr 2019 23:29:47 -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 S1729072AbfDXTbY (ORCPT + 99 others); Wed, 24 Apr 2019 15:31:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45464 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfDXTbY (ORCPT ); Wed, 24 Apr 2019 15:31:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3B9430BC75B; Wed, 24 Apr 2019 19:31:23 +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 A083B1A267; Wed, 24 Apr 2019 19:31:22 +0000 (UTC) Subject: Re: [PATCH v3 0/9] klp-convert livepatch build tooling To: Joao Moreira , Miroslav Benes Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org, Jessica Yu , Jiri Kosina , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Nicolai Stange , Petr Mladek References: <20190410155058.9437-1-joe.lawrence@redhat.com> <20190417201316.GA690@redhat.com> From: Joe Lawrence Message-ID: <97990f04-9c4c-17ad-901c-5285901d5a7f@redhat.com> Date: Wed, 24 Apr 2019 15:31:21 -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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 24 Apr 2019 19:31:23 +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 3:13 PM, Joao Moreira wrote: >>> Future Work >>> ----------- >>> >>> I don't see an easy way to support multiple homonym >>> symbols with unique values in the current livepatch module >>> Elf format. The only solutions that come to mind right now include >>> renaming homonym symbols somehow to retain the relocation->symbol >>> relationship when separate object files are combined. Perhaps an >>> intermediate linker step could make annotated symbols unique in some way >>> to achieve this. /thinking out loud >> I'd set this aside for now and we can return to it later. I think it could >> be quite rare in practice. I agree, especially since we can detect this corner case and abort the translation. >> I was thinking about renaming the symbol too. We can extend the symbol >> naming convention we have now and deal with it in klp_resolve_symbols(), >> but maybe Josh will come up with something clever and cleaner. > I think this could work well, but (sorry if I understood Joe's idea > wrongly) not as a linker step. Instead of modifying the linker, I think > we could create another tool and plug it into the kbuild pipeline prior > to the livepatch module linking. This way, we would parse the .o elf > files, check for homonyms and rename them based on a convention that is > later understood by klp-convert, as suggested. My knowledge of the build tools is limited, so there was a bunch of hand-waving you couldn't see when I wrote that paragraph :) But yes, that is basically the idea: plugging into the kbuild pipeline to give these some kinda of .o-unique prefix that klp-convert would interpret and strip accordingly. > If I am not missing something, this would fix the case where we have > homonyms pointing to the same or different positions, without additional > user intervention other then adding the SYMPOS annotations. > > If you consider this to be useful I can start experiencing. > It's not the highest priority, but even a prototype of how to insert a script into the pipeline to achieve this would be massively time saving for myself. If renaming looks easy, we could try to work into the initial klp-convert patchset... if not, save it for a follow up enhancement. Thanks, -- Joe