Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp849417imu; Sat, 15 Dec 2018 08:27:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXKVUAFGXqFg0B8YyNNVaReCdNyDVY32OUOsxH5CKqepI20oiQ4tsEuIcRk0nFXrsG0kQm X-Received: by 2002:a63:3d1:: with SMTP id 200mr6638144pgd.68.1544891252886; Sat, 15 Dec 2018 08:27:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544891252; cv=none; d=google.com; s=arc-20160816; b=mZdh6u/Auj/1Tqd53qzppz5nn6xd95EXL5ZSgv4Dm2sh6Fw3+MQfXRGCXmW71DMDRy FfKaebWJGKATbuzQGC/7VN0jsjZ+C1hdmOZYZNyjxq5zKdojZ3E8T5FgFIBekorvjMQY 37Dlfus1rSiUd7gjX90zD4Wyvp8A0UAyufI1NdiImN0Gn7rycu/2mS0Zh1rxWf7dvVU/ Rk9yYgmYAGhfjhYrDBJFC3CiUTW4db3rKbMOD5KvH41vOosxE1JkeIfxvEp6BlyBgm/Y QGU2E/IM8Rks6X6+DVC+7KkNq12mjlADzD45h+EyUTB+l6+tLG3RJtIxyNkjVdKoVBo2 14jA== 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=WGj+7mrJ4o+q4xz2YM4cOjsXmdRLuPo0DdWVbknwFb4=; b=pCDvF6RqxPhUZNPZfEfbZDG++PuSRGpJ/fcPdzsbBkcg2BjTEqqW0PhUAagwMALFeC EfhuXEnMf3Gick3FTaBMc1PySZ8zM1UTomWA2BjSY4Fstx1gFHwd2M3+Ajb9tmK562Py ywkmUC0xXJvoR0/jfZxlirEHO5G0g7J18+M4F+djrj1ZdL+U0eIX9qjlgbFfGwaIwC4K LkS2vn9etO3YQ4p1cOW49ckAdYCYnx/WZDgT9Pn/aBXxHFW4W3t8ADIcqF5OTowBO6eE 925Lyzsw42oBM54NKq4Kvuf8Og019IoY/Jew87n/WsYSZtZYS8Sl+JbHa0BVlO0ocB4l TPNw== 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 w27si4196195pge.182.2018.12.15.08.26.37; Sat, 15 Dec 2018 08:27:32 -0800 (PST) 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 S1730481AbeLOQXn (ORCPT + 99 others); Sat, 15 Dec 2018 11:23:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39516 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730075AbeLOQXm (ORCPT ); Sat, 15 Dec 2018 11:23:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 756ABC058CB0; Sat, 15 Dec 2018 16:23:41 +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 6ED3860F87; Sat, 15 Dec 2018 16:23:40 +0000 (UTC) Date: Sat, 15 Dec 2018 11:23:39 -0500 From: Joe Lawrence To: Nicholas Mc Guire Cc: Nicholas Mc Guire , Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes , Petr Mladek , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: fix non-static warnings Message-ID: <20181215162339.rmjcyg5gqxjvp7pg@redhat.com> References: <1544806570-21299-1-git-send-email-hofrat@osadl.org> <72b8f2a4-9070-23d3-4e75-66e10b2d94b5@redhat.com> <20181215085052.GA3426@osadl.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181215085052.GA3426@osadl.at> User-Agent: Mutt/1.6.2-neo (2016-08-08) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 15 Dec 2018 16:23:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 15, 2018 at 09:50:52AM +0100, Nicholas Mc Guire wrote: > On Fri, Dec 14, 2018 at 04:34:23PM -0500, Joe Lawrence wrote: > > On 12/14/2018 11:56 AM, Nicholas Mc Guire wrote: > > > Sparse reported warnings about non-static symbols. For the variables a > > > simple static attribute is fine - for those symbols referenced by > > > livepatch via klp_func the symbol-names must be unmodified in the > > > relocation table - to resolve this the __noclone attribute (as > > ^^^^^^^^^^ > > nit: symbol table > > that should have been relocation section as described in > Documentation/livepatch/module-elf-format.txt - atleast that is how > I currently undderstand the livepatch mechanism and its seperate > relocation section. > Hi Nicholas, Jessica can explain module-elf-format.txt in more detail, but the highlight is that it outlines the format for _livepatch_ modules, in this case livepatch-shadow-fix{1,2}.ko. The special relocations detailed in that file are needed when livepatch modules reference symbols defined elsewhere (vmlinux, other modules) that may not ordinarily be visible (non-exported, local, etc.) to the module loader. When livepatch modules register themselves on load, the livepatching core needs to find the address of the _target_ to-be-patched function using a kallsyms lookup. If that can't be found, the kernel will emit an error, "livepatch: symbol 'dummy_free' not found in symbol table". The call path is: klp_register_patch klp_init_object_loaded klp_find_object_symbol if you want to trace the execution path. > > thanks for your patience - so I did not yet understand how this really > works together - will give it a rerun and repost a hopefully proper > solution. > > thx! > hofrat Thanks for sticking with it and learning some livepatching internals along the way. -- Joe