Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1027568ybe; Thu, 5 Sep 2019 09:14:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQ/wuc6bftsfX4gCjfVk9VJ5V14VIq81NVtJpAzGtKM6OUSowzY8/jKky7vLn2f10VdJaB X-Received: by 2002:a17:90a:ad98:: with SMTP id s24mr2237245pjq.36.1567700077225; Thu, 05 Sep 2019 09:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567700077; cv=none; d=google.com; s=arc-20160816; b=qSPrE9XZpKagDN1XAUoo6jdwXOEsHXNZHFE8rlB+hNrXXNtR5SzzYvbnKTIXpHc60u 7GFx+C35FOQ3n/drhF7hnpXY+pCNI0BL8kwRr5Lh9Rz0ZyKR0y9e9aCX3zGToPIdXIh9 eF+iBTJJZPRz6r4APYtcVdjrzllz42mWK/eqKY06tBE7V9YdhLIITgXwUbcBzCBNHTrg oNT2MWGA2QMFMoX8nM7U0vWSaAo+1oan6jTzlycrAZhOzaULrd/1Mcl1k/mFnrMUUTFh cqL/R8f0qfUoVi3NVhXl6edjDtcIrJh4nyBVItx1G4ypayfrs3I6Pk1Q7hR37pFwZnne 1gMw== 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=L84/UVQtxnrEqJhQ2NoLwmzG2hSrm1tu+qw4L5ivDWY=; b=gPFjtyG0rkzVfVP/LfdauukRsqGNt4EP/q7wSUj9qIxAlM9GzQ4omcjhCc+n8JrYoF 5fcGWTDcUajg069zQPO27ZT9HRL49CviAkYi1sqaRiyV7DXj+oHLmNm0PKlf+r3ls3E4 DLqRf2rhjwD9U/jFRlRkQSRkP0UzjmN8W4RBo8Pkb1xqCWuK5g4jnTVFtMzOoBCfbHXs 5n2Bp5kxY/p03wf+yIUH8Ge7fgFRtS6cO5LoFlDa1c8hduBUsEOMtoJJrkipF7swQ2aI ctDFsqAnjjjaj57pnZhSXUTK1uMbe++cN5VnUs3vfwoBU9AG7bAi/PBJLwTiaHec3m8P fhrw== 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 3si2317074plu.15.2019.09.05.09.14.19; Thu, 05 Sep 2019 09:14:37 -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 S2388733AbfIENPL (ORCPT + 99 others); Thu, 5 Sep 2019 09:15:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34742 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731758AbfIENPL (ORCPT ); Thu, 5 Sep 2019 09:15:11 -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 4B8B130860D1; Thu, 5 Sep 2019 13:15:11 +0000 (UTC) Received: from treble (ovpn-120-170.rdu2.redhat.com [10.10.120.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CDB4C5D6A3; Thu, 5 Sep 2019 13:15:04 +0000 (UTC) Date: Thu, 5 Sep 2019 08:15:02 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: jikos@kernel.org, Joe Lawrence , Miroslav Benes , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal Message-ID: <20190905131502.mgiaplb3grlxsahp@treble> References: <20190822223649.ptg6e7qyvosrljqx@treble> <20190823081306.kbkm7b4deqrare2v@pathway.suse.cz> <20190826145449.wyo7avwpqyriem46@treble> <5c649320-a9bf-ae7f-5102-483bc34d219f@redhat.com> <20190904084932.gndrtewubqiaxmzy@pathway.suse.cz> <20190905025055.36loaatxtkhdo4q5@treble> <20190905110955.wl4lwjbnpqybhkcn@pathway.suse.cz> <20190905130832.dznviqrrg6lfrxvx@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190905130832.dznviqrrg6lfrxvx@treble> User-Agent: NeoMutt/20180716 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]); Thu, 05 Sep 2019 13:15:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 05, 2019 at 08:08:32AM -0500, Josh Poimboeuf wrote: > On Thu, Sep 05, 2019 at 01:09:55PM +0200, Petr Mladek wrote: > > > I don't have a number, but it's very common to patch a function which > > > uses jump labels or alternatives. > > > > Really? My impression is that both alternatives and jump_labels > > are used in hot paths. I would expect them mostly in core code > > that is always loaded. > > > > Alternatives are often used in assembly that we are not able > > to livepatch anyway. > > > > Or are they spread widely via some macros or inlined functions? > > Jump labels are used everywhere. Looking at vmlinux.o in my kernel: > > Relocation section [19621] '.rela__jump_table' for section [19620] '__jump_table' at offset 0x197873c8 contains 11913 entries: > > Each jump label entry has 3 entries, so 11913/3 = 3971 jump labels. > > $ readelf -s vmlinux.o |grep FUNC |wc -l > 46902 > > 3971/46902 = ~8.5% > > ~8.5% of functions use jump labels. Obviously some functions may use more than one jump label so this isn't exactly bulletproof math. But it gives a rough idea of how widespread they are. > > > > > + How often new problematic features appear? > > > > > > I'm not exactly sure what you mean, but it seems that anytime we add a > > > new feature, we have to try to wrap our heads around how it interacts > > > with the weirdness of late module patching. > > > > I agree that we need to think about it and it makes complications. > > Anyway, I think that these are never the biggest problems. > > > > I would be more concerned about arch-specific features that might need > > special handling in the livepatch code. Everyone talks only about > > alternatives and jump_labels that were added long time ago. > > Jump labels have been around for many years, but we somehow missed > implementing klp.arch for them. As I said this resulted in panics. > > There may be other similar cases lurking, both in x86 and other arches. > It's not a comforting thought! > > And each case requires special klp code in addition to the real code. > > -- > Josh -- Josh