Received: by 10.192.165.156 with SMTP id m28csp1573167imm; Tue, 17 Apr 2018 01:26:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx49NrbVxTcXHzM4E3hfJ/OyO9joALB8TvEFYQegPG9Wv4JA6rW3MWUlwCR0hlQJR1wS+r5pm X-Received: by 2002:a17:902:144:: with SMTP id 62-v6mr1196407plb.202.1523953567376; Tue, 17 Apr 2018 01:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523953567; cv=none; d=google.com; s=arc-20160816; b=po3RGcJwwYguptEfg5FHkUWVr+ESFaEMfSXvnCwQf8qg3NVCU0TOUTot67/SQyXF+I 8kfKG9gqxhpkZTD2cptSxyoq6V8mdAk/xoA2lIQFtiEs2JFctXPkWjCT9B3AbCjFHjj0 IQGQFVg/bymJx/v8lsPJf2Tg1Qjvi4KYFAv30ckRAZ/Y2kcmynkqfqkf19ZLLA52wcRy O1rMJDsNgkHD08w95u8dt1fteGhtRsi+t8iHc0MXHPCfoGE2nygqs3WCMrtAjeaN+Zqa mK2cAL8KOScgZYhazG5HXEKx/WL8dWYkQbgfmorFHLywnpEa2IHo1LWhTVFirhbtHmaO X2+w== 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 :arc-authentication-results; bh=BwFSiOWDiRfGI8SrdDMxSdnwQjUWNipIKZFDwmtaZPQ=; b=MtHksWpkQzHhIz5Kww9KT2pvNkf598Z4ZlyB99YWIPWaMJrnK0zQJzGgmj1LoDufIr C71TCHdmznABONKfBKKgf6aSfpQnqKFuoHaqQ3YEuWDlyh5uj5rDYOe3pPPPuMyUVtYe H89IfjC4zEj5wL2gWUGH0JBEuJojAgwBCAUkDNL4igL+fezh+U4exZTayAFJmS/THXSe fIsVnLnCHpA+3WkVGmAL0RKS/diyeoOXR8+yEGRDq1mb47ER753e7rEAaLzruGL6x06K fqmyzyirn6aqUrQ0N7N4KEQA7OeZbCM8CqDtxQzT6/Oj58gMFWCzIVmyK6tJzryOJDcj vNig== 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 90-v6si14057028plf.340.2018.04.17.01.25.53; Tue, 17 Apr 2018 01:26:07 -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 S1752357AbeDQIYn (ORCPT + 99 others); Tue, 17 Apr 2018 04:24:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:44232 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbeDQIXP (ORCPT ); Tue, 17 Apr 2018 04:23:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 082F9AE92; Tue, 17 Apr 2018 08:23:14 +0000 (UTC) Date: Tue, 17 Apr 2018 10:23:12 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: Petr Mladek , Jiri Kosina , Jason Baron , Joe Lawrence , Jessica Yu , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches. In-Reply-To: <20180416190425.tk7nnbqbmaxeniud@treble> Message-ID: References: <20180323224410.vuq5cabfprqhd6ej@treble> <20180326101107.bbloeh5l276on7uz@pathway.suse.cz> <20180406195049.dtfebzfdkbvv6yex@treble> <20180410083455.l26dgo5kx4cy7bc7@pathway.suse.cz> <20180410174206.l3uk6lchhzxvn75x@treble> <20180411123214.mfpkbrirze32phrb@treble> <20180411141711.cwceg7o5ttjgebii@pathway.suse.cz> <20180411154852.3yjab3ot76qicw6m@treble> <20180416145811.x4lvtm5kxyigbp56@pathway.suse.cz> <20180416190425.tk7nnbqbmaxeniud@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 > > > > Second, unrelated patches must never patch the same functions. > > > > Otherwise we would not be able to define which implementation > > > > should be used. This is especially important when a patch is > > > > removed and we need to fallback either to another patch or > > > > original code. Yes, it makes perfect sense. But it needs code > > > > that will check it, refuse loading the patch, ... It is not > > > > complicated. But it is rather additional code than > > > > simplification. I might make livepatching more safe > > > > but probably not simplify the code. > > > > > > We don't need to enforce that. The func stack can stay. If somebody > > > wants to patch the same function multiple times (without using > > > 'replace'), that's inadvisable, but it's also their business. They're > > > responsible for the tooling to ensure the patch stack order is sane. > > > > > > While it might make sense to ignore the patch stack (ordering) for > > the enable operation. Do we really want to ignore it when disabling > > a patch. > > > > By other words, do we want to allow disabling a patch that is in > > the middle of the stack, only partly in use? Does not this allow > > some other crazy scenarios? Is it really the user business? > > Will it make our life easier? > > If there's no longer a patch stack, then there's no concept of a middle. > We would expect the patches to be independent of one another, and so > disabling any of them independently would be harmless. > > If any of the patches share a func, and the user disables one in the > "middle", it's not our job to support that. The vendor / patch author > should prevent such cases from occurring with tooling, packaging, > documentation, etc. Or they can just use 'replace'. > > We can already have similar unexpected situations today. For example, > what if patch B is a cumulative superset of patch A, but the user > mistakenly loads patch A (without replace) *after* loading patch B? > Then some unforeseen craziness could ensue. > > We can't control all such scenarios (and that's ok), but we shouldn't > pretend that we support them. FWIW I agree with the above. Provided we keep the func stack. [...] > > The question is what to do with the stack of patches. It will have > > no meaning for the enable operation because it will be done > > automatically. But what about the disable/unregistrer operation? > > Assuming we got rid of the patch stack, would we even need to keep a > global list of patches anymore? There are places we walk through the list of patches (klp_add_nops() in this patch set, klp_module_coming()), so probably yes. Miroslav