Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1082258ybe; Thu, 5 Sep 2019 10:02:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlUUASS2ooZjrJd1HYmv1bC112Py/S5OGmud8XLFxAglaVKzgpKPjOImdItA/Fd1dDz/nl X-Received: by 2002:a17:90a:a002:: with SMTP id q2mr2921934pjp.69.1567702939009; Thu, 05 Sep 2019 10:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567702939; cv=none; d=google.com; s=arc-20160816; b=TXdvb33TpSEX3FZgyPXD0MdwrFB5cb7dub4FfbbEtikblOiLM/R1Y8JulgCLr2apxp jYiBTDTPkwSXb/L4KJ029kfyV21AQcy5ht8xZzUPTvkHbHzwEiAC2o/X1ZYl3V7PXAXY 1YPCXo4PqS+vYL3xB/t0lGk3SdnfvZXEj+jvCo+5irOVLiis/6yrAhz6qTS1aK201a+q mP3flFgnGG8vzSEqCCXj6Ua4DZq5cyWEb7CMAaA5708EHeJ+KBwn2c510Ho15tc4SM95 qEcsnCxBpCJhRP4+FUr+OV3PdWYZ2Mi6HA0mKdI8pf0smTacKmr6yFQPoeFRb3Ij2WhT 6gyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=IoSs0JB1IjVOWXmj7QccabUajyLTZHrHFIAcyIdncdk=; b=f7HpaSe/roQpc2EtssMFy6K1ZJOFD7TCILCgfJzf5Kt9EuV1Cem48q1ZKjKbMbQjqH 3hRfLqwpeC9OPbsfEQkA/M89Iu5ExZNQyFGMi/qFD9EFp6zmU0JBiBG2uFYU2iaQduez tyIdsnSHai26cGITjpUDxVsbyKZVVisWN5fSZj5zrnnE3JqQ3gjKeq1AvT1iMnoeBrqo Fcu1WT5jrxekVy3/BoJoqxE0rUEWe97KkeQ4IMEbT5sghGCVhDrL8cI1yxUahLr3Jeay OSDLHyXEIcc6wMocOVsC2tN/ddlrPVCBvCkQQoEfq2MYorHMl/GMCFbETIepm3l3K5jr DJmw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn16si2566569plb.97.2019.09.05.10.01.56; Thu, 05 Sep 2019 10:02:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732586AbfIEMtQ (ORCPT + 99 others); Thu, 5 Sep 2019 08:49:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:43184 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730864AbfIEMtP (ORCPT ); Thu, 5 Sep 2019 08:49:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B0F3CB02C; Thu, 5 Sep 2019 12:49:14 +0000 (UTC) Date: Thu, 5 Sep 2019 14:49:00 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: Petr Mladek , Joe Lawrence , jikos@kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal In-Reply-To: <20190905123558.d4zh4h5pnej6pcuk@treble> Message-ID: References: <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> <20190905025055.36loaatxtkhdo4q5@treble> <20190905123558.d4zh4h5pnej6pcuk@treble> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 Sep 2019, Josh Poimboeuf wrote: > On Thu, Sep 05, 2019 at 02:03:34PM +0200, Miroslav Benes wrote: > > > > + 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? > > > > > > I think the .klp.arch sections are the big ones: > > > > > > .klp.arch.altinstructions > > > .klp.arch.parainstructions > > > .klp.arch.jump_labels (doesn't exist yet) > > > > > > And that's just x86... > > > > I may misunderstand, but we have .klp.arch sections because para and > > alternatives have to be processed after relocations. And if we cannot get > > rid of relocations completely, because of static symbols, then we cannot > > get rid of .klp.arch sections either. > > With late module patching gone, the module code can just process the klp > relocations at the same time it processes normal relocations. > > Then the normal module alt/para/jump_label processing code can be used > instead of arch_klp_init_object_loaded(). Ah, of course. I obviously cannot grasp the idea of not having late module patching :) > Note this also means that Joe's patches can remove copy_module_elf() and > free_module_elf(). And module_arch_freeing_init() in s390. Correct. So yes, it would simplify the code a lot. I am still worried about the consequences. > > > And then of course there's the klp coming/going notifiers which have > > > also been an additional source of complexity. > > > > True, but I think we (me and Petr) do not consider it as much of a problem > > as you. > > It's less of an issue than .klp.arch and all the related code which can > be removed. Ok. Miroslav