Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp14586img; Wed, 20 Mar 2019 12:59:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqySJaFWTIzzHUY5rS4jIi6HId2XaX8iRwTiQIZzZykz3h4B6WyjqMeOUTZomcQGSgrH2u/q X-Received: by 2002:a63:1ce:: with SMTP id 197mr9022148pgb.47.1553111994309; Wed, 20 Mar 2019 12:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553111994; cv=none; d=google.com; s=arc-20160816; b=sJAHIJM2lPEKbrvg+jOee9tsMZ5RPO8YIb5FiPObgEezMjP614WqPUQWW292Dmw5R/ 2nCtTTS/iBxlCOkxpAGGFLFId32ykQuyYgUtWZ0MNixxaZ4htdT9im/eOVZ30T2mVDyc wW/Y8qyX6Dbs8IvxWw32rk/nDULRLDrVPzFSzH++MTIj30VJygnXkWiva4UO2k+9IllE PmWehSk8X+EDV2Q+hXC0c8qPk1dXLWj6D7uDkiHFsKq3GnmbQml4R9XL3eLt5xNHzy5v R9U6o3c+oB7nuSrkMVkaI82dvHGnKfMJzGYnUaO7ZhXl7H09rM+2k8/9xuk9v755vlsV ljow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=kDpXJ0hZnhstT0YzB8L11JJ/4spr/7b61mKKXw3m9ww=; b=KfbCs55Ncm1MEugxYvaphNENIH2ZE5+mFtRt7Jy948zHj4ScPd9xZkvDDyh1Tavo+f 3lqAYVhYwht9pmdA7d35KhrxDOjbGwwQkObGoLHQv3ukMC311k9fd1oq/k2J+be+xDwT 1VRRam1tvBuu0pE23BvvAtGraDzhySNRXdHtTId2zhzFAsYlWwFV/cNAew4uXgTaVaTt Cf66mwI0tP6V2NmwU+RkTmX+yYKDoMA3XiIsLesrkz2EkTBhNHuqwQ/N0876JGyGYXxU 1pNOwpCZgywFcIJSFkmNr/+2+W8jvPenM2s1ZPGR7FoF3MHzbkbcazHlijsTXBHDst3f HJDQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24si2389709pfa.34.2019.03.20.12.59.29; Wed, 20 Mar 2019 12:59:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbfCTT6J (ORCPT + 99 others); Wed, 20 Mar 2019 15:58:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:58880 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726438AbfCTT6J (ORCPT ); Wed, 20 Mar 2019 15:58:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8F1B3ADC4; Wed, 20 Mar 2019 19:58:07 +0000 (UTC) Date: Wed, 20 Mar 2019 20:58:06 +0100 (CET) From: Miroslav Benes To: Joe Lawrence cc: Joao Moreira , live-patching@vger.kernel.org, pmladek@suse.cz, jikos@suse.cz, nstange@suse.de, jpoimboe@redhat.com, khlebnikov@yandex-team.ru, jeyu@kernel.org, matz@suse.de, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, michal.lkml@markovi.net Subject: Re: [PATCH v2 8/8] documentation: Update on livepatch elf format In-Reply-To: <20190318192127.GA23238@redhat.com> Message-ID: References: <20190301141313.15057-1-jmoreira@suse.de> <20190301141313.15057-9-jmoreira@suse.de> <20190318192127.GA23238@redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +building system, the second is done by a tool called klp-convert, which can be > > +found in "scripts/livepatch". > > + > > +When an unresolved relocation has as target a symbol whose name is also used by > > +different symbols throughout the kernel, the relocation cannot be resolved > > +automatically. In these cases, the livepatch developer must add annotations to > > +the livepatch, making it possible for the system to identify which is the > > +correct target amongst multiple homonymous symbols. Such annotations must be > > +done through a data structure as follows: > > + > > +struct KLP_MODULE_RELOC(object) data_structure_name[] = { > > + KLP_SYMPOS(symbol, pos) > > +}; > > + > > +In the above example, object refers to the object file which contains the > > +symbol, being vmlinux or a module; symbol refers to the symbol name that will > > +be relocated and pos is its position in the object. > > [ ... snip ... ] > > Should we be explicit about how position is counted? First = 1, second > = 2, etc? See the off-by-one bug I pointed out in the "livepatch: Add > klp-convert tool" patch earlier. We could, but I would add it to a general section somewhere and just add a reference here. Documentation/livepatch/livepatch.txt says "As an optional parameter, the symbol position in the kallsyms database can be used to disambiguate functions of the same name. This is not the absolute position in the database, but rather the order it has been found only for a particular object ( vmlinux or a kernel module )." We can improve it. Documentation/livepatch/module-elf-format.txt says "[D] The position of the symbol in the object (as according to kallsyms) This is used to differentiate duplicate symbols within the same object. The symbol position is expressed numerically (0, 1, 2...). The symbol position of a unique symbol is 0." It may even confuse someone. So yes, I'd be for a change here and there. Miroslav