Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp706317img; Mon, 18 Mar 2019 12:22:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk84tdBub2QHw/A1b2Q+PLtordnwStei8rpngovI4KBLIav/RGTypIx+qoO7diSEJHfox1 X-Received: by 2002:a63:6e8d:: with SMTP id j135mr19065930pgc.160.1552936967616; Mon, 18 Mar 2019 12:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552936967; cv=none; d=google.com; s=arc-20160816; b=QcyfiopDn4h+mu128PYQSrpr6wnuRkqziWEmzyM/LH7btnYTiwWdqFnj0k/5oBbXAw 1yZUzAFw8fV5UlRCdQXNQlyTfJZJvE4srq0jSldpjtohXRHM1aaRE1eVo3bX925Myqga yx4PR0WfzveUmcnOoGcmKb80DRl4sRtmERrgU8u+d8HCI2FaB9oC8Sq01oo4SIuC60rz yPsXkE+Nwb5JPLPT/bwoVyG+0mYThgY/A5+/YbhVdXSYc/qwN4koEn5hpallN17MXzfM JR50mU05Q+8crifUUM/y8S0owCXEtRyl3fp51ZZ/LLPySE+szJQf70FkRhtK2qoHFy0k YIPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ljcdBma1paRC8+boG8zFbu0pA4uLNMO+pigxjvt1we8=; b=lUPHxAfW4qPjb5/NdS4LdQEuKfxk67lg0AS+SgcTBIBFKfQjFHdjgxTrqowZGHWcxN lEFminarjG2DbpU2UckLFy95ss/ZB5wd0H6VaPhNj+945bcIAuBlgWSJd2XwwLEtPA2H OZVDTbmIwpESwKWsOTaQQvCxyVO2LfQRT0jH69XM68BCDR/fBPtZABc+6CKRzc86Iu13 5xeZQVPTYLjZjSRfZRK7RzjbggHcQleUuzAmPxgXsOWA7mu60/8hW23lh9OJxhvoI+fJ SoY0vXBfzk2wrlpdhumWTMKPzJ5f1Xow8g87o2w/Blx3zhZ2QZ/bEzCCGPjJ54eh7gu7 453w== 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 c7si9811518plr.276.2019.03.18.12.22.31; Mon, 18 Mar 2019 12:22: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 S1727606AbfCRTVR (ORCPT + 99 others); Mon, 18 Mar 2019 15:21:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44386 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbfCRTVR (ORCPT ); Mon, 18 Mar 2019 15:21:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C694130832D8; Mon, 18 Mar 2019 19:21:16 +0000 (UTC) Received: from redhat.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FD255D704; Mon, 18 Mar 2019 19:21:15 +0000 (UTC) Date: Mon, 18 Mar 2019 15:21:13 -0400 From: Joe Lawrence To: Joao Moreira Cc: live-patching@vger.kernel.org, mbenes@suse.cz, 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 7/8] livepatch: Add sample livepatch module Message-ID: <20190318192113.GA23220@redhat.com> References: <20190301141313.15057-1-jmoreira@suse.de> <20190301141313.15057-8-jmoreira@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190301141313.15057-8-jmoreira@suse.de> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 18 Mar 2019 19:21:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 01, 2019 at 11:13:12AM -0300, Joao Moreira wrote: > From: Josh Poimboeuf > > Add a new livepatch sample in samples/livepatch/ to make use of > symbols that must be post-processed to enable load-time relocation > resolution. As the new sample is to be used as an example, it is > annotated with KLP_MODULE_RELOC and with KLP_SYMPOS macros. > > The livepatch sample updates the function cmdline_proc_show to > print the string referenced by the symbol saved_command_line > appended by the string "livepatch=1". > > Update livepatch-sample.c to remove livepatch MODULE_INFO > statement. > > [jmoreira: > * update module to use KLP_SYMPOS > * Comments on symbol resolution scheme > * Update Makefile > * Remove MODULE_INFO statement > * Changelog > ] > > Signed-off-by: Josh Poimboeuf > Signed-off-by: Joao Moreira > --- > samples/livepatch/Makefile | 2 + > samples/livepatch/livepatch-annotated-sample.c | 113 +++++++++++++++++++++++++ > 2 files changed, 115 insertions(+) > create mode 100644 samples/livepatch/livepatch-annotated-sample.c > > [ ... snip ... ] > > diff --git a/samples/livepatch/livepatch-annotated-sample.c b/samples/livepatch/livepatch-annotated-sample.c > new file mode 100644 > index 000000000000..44d9e9542db1 > --- /dev/null > +++ b/samples/livepatch/livepatch-annotated-sample.c Super small nit, but I shuffled the annotated-sample code around so it better matched the original sample. This minimized the diff when I compared the two versions to see what was added for sympos annotation: [squash] livepatch: adjust annotated sample formatting https://github.com/torvalds/linux/commit/ce49c70e85cf87e513de3bcf64953de191c3c6d7 > [ ... snip ... ] > > +static int livepatch_init(void) > +{ > + int ret; > + > + ret = klp_register_patch(&patch); > + if (ret) > + return ret; > + ret = klp_enable_patch(&patch); > + if (ret) { > + WARN_ON(klp_unregister_patch(&patch)); > + return ret; > + } > + return 0; > +} > + > +static void livepatch_exit(void) > +{ > + WARN_ON(klp_unregister_patch(&patch)); > +} v5.0 deprecates klp_register_patch(), klp_unregister_patch(), and klp_disable_patch(), so adjust the sample accordingly: [squash] livepatch: rebase the annotated sample https://github.com/torvalds/linux/commit/fc04952376cfd8281eb663bd2ce18fec27eb42b2 -- Joe