Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp32358imu; Fri, 14 Dec 2018 13:52:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/WQbl79IFpf1szAnxaNOmKvUghdVoYF+oiu3qORljVOF7iMVpw3SyP1HsIpWaBViJBB8VtJ X-Received: by 2002:a63:585c:: with SMTP id i28mr4246665pgm.178.1544824362936; Fri, 14 Dec 2018 13:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544824362; cv=none; d=google.com; s=arc-20160816; b=ZX4soqeoYxQDGWtPkXmhoOEJ5xOFfqqxcOqHX13pzgI2JnacPE7uR2owHjSEybMJgY UgJG9m++W1WI+TP4ilmAd6NCTsjmi8kMNbvCVQJLgwNtPyiwkZHTCLRmKwXQTGyj+e8K Zcq4fnkOnt2G0CVp7bqO/9jRNESL1UI9j2ZnWK/r0OKPgBYTYRU9GW46BfZW6wJAebPT L1Rl8Y/wu0xX63Pmj+rfTWMyEBZc1tFAjkdeAoHAhYdLmzZ3YRTYK2QJrXjfrJLK3mGQ plxM4lCZXJRUynUffxLLwoPD3NM7wTsPQy9dBwhkkSlJrnB1l1Dx2JZ7191D3ylT4Mhn LmkA== 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=NuelaCRozXkaQJewjAv88LfKMDdSEu6Qrci8rrbynEA=; b=SjZJnBRHwwRRuQ9+B1cayzMkRCNJfcT9w8zbZRWEnc4oz6hiC0FcDWXWaEBq33M2y+ SiqO8KaFqxaQv435TDmDbFoPlBUyw2+oF38by/wBOMxQo09qVUtrcepXfeClEsQClc3Q z2dva15hNZnZeOq9EFEiwKBYxucvWq32NLmqDiBrxcUnVLcmjOYAgpLKo8d/D1TEhoCu yl4hfwypDnsfg9XpHqHvEjZkZXBUEHusW0dTKh1sH/0zQ/vShLNm+Cms9YbS+SJMeKMH 80eDtLKsCiQcu0q62mrpcdaD3rFO4AAHZTNY/HhcsAvFOry0ROmlne3TSJzNm6SWWinY MBqA== 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 c201si5316279pfb.211.2018.12.14.13.52.23; Fri, 14 Dec 2018 13:52:42 -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 S1731092AbeLNVvf (ORCPT + 99 others); Fri, 14 Dec 2018 16:51:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730734AbeLNVvf (ORCPT ); Fri, 14 Dec 2018 16:51:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D55421B9C; Fri, 14 Dec 2018 21:51:34 +0000 (UTC) Received: from treble (ovpn-125-218.rdu2.redhat.com [10.10.125.218]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2D34600C0; Fri, 14 Dec 2018 21:51:31 +0000 (UTC) Date: Fri, 14 Dec 2018 15:51:29 -0600 From: Josh Poimboeuf To: Joe Lawrence Cc: Nicholas Mc Guire , 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: <20181214215129.mshuswyuqlcx76wz@treble> References: <1544806570-21299-1-git-send-email-hofrat@osadl.org> <72b8f2a4-9070-23d3-4e75-66e10b2d94b5@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <72b8f2a4-9070-23d3-4e75-66e10b2d94b5@redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 14 Dec 2018 21:51:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > suggested by Joe Lawrence ) is used > > for the statically declared functions. > > > > Signed-off-by: Nicholas Mc Guire > > Link: https://lkml.org/lkml/2018/12/13/827 Needs a: Suggested-by: Joe Lawrence > > > > diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c > > index 49b1355..eaab10f 100644 > > --- a/samples/livepatch/livepatch-shadow-fix1.c > > +++ b/samples/livepatch/livepatch-shadow-fix1.c > > @@ -71,7 +71,7 @@ static int shadow_leak_ctor(void *obj, void *shadow_data, void *ctor_data) > > return 0; > > } > > > > -struct dummy *livepatch_fix1_dummy_alloc(void) > > +static __noclone struct dummy *livepatch_fix1_dummy_alloc(void) > > { > > struct dummy *d; > > void *leak; > > @@ -108,7 +108,7 @@ static void livepatch_fix1_dummy_leak_dtor(void *obj, void *shadow_data) > > __func__, d, *shadow_leak); > > } > > > > -void livepatch_fix1_dummy_free(struct dummy *d) > > +static __noclone void livepatch_fix1_dummy_free(struct dummy *d) > > { > > void **shadow_leak; > > > > diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c > > index 4c54b25..0a72bc2 100644 > > --- a/samples/livepatch/livepatch-shadow-mod.c > > +++ b/samples/livepatch/livepatch-shadow-mod.c > > @@ -30,6 +30,11 @@ > > * memory leak, please load these modules at your own risk -- some > > * amount of memory may leaked before the bug is patched. > > * > > + * NOTE - the __noclone attribute to those functions that are to be > > + * shared with other modules while being declared static. As livepatch > > + * needs the unmodified symbol names and the usual "static" would > > + * invoke gccs cloning mechanism that renames the functions this > > + * needs to be suppressed with the additional __noclone attribute. > > I like the idea of providing the sample code reader this information, > but since the compiler might also optimize livepatch-callbacks-busymod.c > :: busymod_work_func(), it too should be annotated __noclone. Would > that file deserve a similar comment? > > I don't have a strong opinion, but would throw my vote at leaving this > in the commit message only. Agreed, IMO the comment isn't needed. > BTW, Petr/Miroslav/Josh, should we be annotating the selftests in > similar fashion? Probably so. -- Josh