Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp909500ybe; Wed, 4 Sep 2019 09:29:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI5Pp7RodHKVI9hOzHlYUb9hKzVTd80Jzbje/wY3jT8RKSJ1nOcyfP+ErQC2uka+yuizIc X-Received: by 2002:a63:fe52:: with SMTP id x18mr37469021pgj.344.1567614573288; Wed, 04 Sep 2019 09:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567614573; cv=none; d=google.com; s=arc-20160816; b=aAR/zgEQj1YQYJUb9CleTWXIrFRiLWhUO7hSblt91mqnay8W8iPNAK6hqRYG48djkt oJDqFmgt+dbP+O0M9z/RiTY2mDJ2WbQAqcSms6NKbXrRsEsTfPL/oeDPYh1NmKPUqx/n QS+3bPtBt2mVsQVYDABGwFIhIB2R1rIW1+/H37M/JY6KyoF0QvESWZzIdFNKhDW+OIx0 f9U0MdHRWxLNeysjVUlC8e3g91nAmJ2DEEXNivTMZoKKD4hGq5kCJshAvhOpxGYG4z4N OkABXxvKicnwC95r4S/15aV3VU6Kki+gqhBok4lbdqAUSMwSPBgaHc0znHIBUO8ZYC7z gntA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=k2xt1Agv0Y/lG1qjuV08QzJjedeJE0jSUkRsxjy5NyM=; b=CPCvEFv+M4gxDjTCZSr4ldUsKBoD9Gu/cnhzKxCj6dCd9nXGxjryaLW7sU4auFkr9c obDucwGuFEGvWV5O13+ihi6nifqCtTZFk0tL72G7EGvMCmeifvCWQMOTiSKGVioiyKs5 ze/r2m1Q58Y9Dj/LMyiFKuOtuSE1tGzS/e5LL2S7BaRxcBIFqJnP4dAM4fkIFfQcVPGX rJclxk4NYiroyLaG5db/guB8JoDWEJgLk2f9jTPhy+5VfDi7+QoHn7hva8TYDVJNyzZF O/P7VM2xLPyObSDMP/b4qKzs4fW6qNyDvwQUy2dYYhNG/npu1XRuWNzZ4lHaPf0G84Vw mM2w== 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 u46si18043076pgn.578.2019.09.04.09.29.18; Wed, 04 Sep 2019 09:29:33 -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 S1731599AbfIDQ0y (ORCPT + 99 others); Wed, 4 Sep 2019 12:26:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60646 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730299AbfIDQ0y (ORCPT ); Wed, 4 Sep 2019 12:26:54 -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 A464585A03; Wed, 4 Sep 2019 16:26:53 +0000 (UTC) Received: from [10.18.17.153] (dhcp-17-153.bos.redhat.com [10.18.17.153]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1C035D6D0; Wed, 4 Sep 2019 16:26:52 +0000 (UTC) Subject: Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal To: Petr Mladek , Miroslav Benes Cc: jikos@kernel.org, Josh Poimboeuf , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org References: <20190728200427.dbrojgu7hafphia7@treble> <20190814151244.5xoaxib5iya2qjco@treble> <20190816094608.3p2z73oxcoqavnm4@pathway.suse.cz> <20190822223649.ptg6e7qyvosrljqx@treble> <20190823081306.kbkm7b4deqrare2v@pathway.suse.cz> <20190826145449.wyo7avwpqyriem46@treble> <5c649320-a9bf-ae7f-5102-483bc34d219f@redhat.com> <20190904084932.gndrtewubqiaxmzy@pathway.suse.cz> From: Joe Lawrence Message-ID: <72b5e7b6-4c8d-4211-01ee-96c219f93807@redhat.com> Date: Wed, 4 Sep 2019 12:26:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190904084932.gndrtewubqiaxmzy@pathway.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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.26]); Wed, 04 Sep 2019 16:26:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/4/19 4:49 AM, Petr Mladek wrote: > On Tue 2019-09-03 15:02:34, Miroslav Benes wrote: >> On Mon, 2 Sep 2019, Joe Lawrence wrote: >> >>> On 9/2/19 12:13 PM, Miroslav Benes wrote: >>>>> I can easily foresee more problems like those in the future. Going >>>>> forward we have to always keep track of which special sections are >>>>> needed for which architectures. Those special sections can change over >>>>> time, or can simply be overlooked for a given architecture. It's >>>>> fragile. >>>> >>>> Indeed. It bothers me a lot. Even x86 "port" is not feature complete in >>>> this regard (jump labels, alternatives,...) and who knows what lurks in >>>> the corners of the other architectures we support. >>>> >>>> So it is in itself reason enough to do something about late module >>>> patching. >>>> >>> >>> Hi Miroslav, >>> >>> I was tinkering with the "blue-sky" ideas that I mentioned to Josh the other >>> day. >> >>> I dunno if you had a chance to look at what removing that code looks >>> like, but I can continue to flesh out that idea if it looks interesting: >> >> Unfortunately no and I don't think I'll come up with something useful >> before LPC, so anything is really welcome. >> >>> >>> https://github.com/joe-lawrence/linux/tree/blue-sky >>> >>> A full demo would require packaging up replacement .ko's with a livepatch, as >>> well as "blacklisting" those deprecated .kos, etc. But that's all I had time >>> to cook up last week before our holiday weekend here. >> >> Frankly, I'm not sure about this approach. I'm kind of torn. The current >> solution is far from ideal, but I'm not excited about the other options >> either. It seems like the choice is basically between "general but >> technically complicated fragile solution with nontrivial maintenance >> burden", or "something safer and maybe cleaner, but limiting for >> users/distros". Of course it depends on whether the limitation is even >> real and how big it is. Unfortunately we cannot quantify it much and that >> is probably why our opinions (in the email thread) differ. > > I wonder what is necessary for a productive discussion on Plumbers: > Pre-planning this part of the miniconf is a great idea. > + Josh would like to see what code can get removed when late > handling of modules gets removed. I think that it might be > partially visible from Joe's blue-sky patches. > > > + I would like to better understand the scope of the current > problems. It is about modifying code in the livepatch that > depends on position of the related code: > > + relocations are rather clear; we will need them anyway > to access non-public (static) API from the original code. > > + What are the other changes? > > + Do we use them in livepatches? How often? > > + How often new problematic features appear? > > + Would be possible to detect potential problems, for example > by comparing the code in the binary and in memory when > the module is loaded the normal way? > > + Would be possible to reset the livepatch code in memory > when the related module is unloaded and safe us half > of the troubles? > > > + It might be useful to prepare overview of the existing proposals > and agree on the positives and negatives. I am afraid that some > of them might depend on the customer base and > use cases. Sometimes we might not have enough information. > But it might be good to get on the same page where possible. > > Anyway, it might rule out some variants so that we could better > concentrate on the acceptable ones. Or come with yet another > proposal that would avoid the real blockers. > > > Any other ideas? I'll just add to your list that late module patching introduces complexity for klp-convert / livepatch style relocation support. Without worrying about unloaded modules, I *think* klp-convert might already be able to handle relocations in special sections (altinsts, parainst, etc.). I've put the current klp-convert patchset on top of the blue-sky branch to see if this indeed the case, but I'm not sure if I'll get through that experiment before LPC. > > Would it be better to discuss this in a separate room with > a whiteboard or paperboard? > Whiteboard would probably be ideal, but paper would work and be more transportable than the former. -- Joe