Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7164082ybp; Wed, 16 Oct 2019 04:52:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7+CnObtUbJPHmqWm0ElR8h9hVK0eKyuEKozX132lAUJ/s6jSfwDpq1+3PCF7PzXPry2it X-Received: by 2002:a17:906:4757:: with SMTP id j23mr37305315ejs.174.1571226779545; Wed, 16 Oct 2019 04:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571226779; cv=none; d=google.com; s=arc-20160816; b=Ac8i89fii8mAZMov3ULuheNKyqWXSg5CtqUbU3Gt9oOWbLIwVq7bGC8e1YkfU1teeX eQdHYicWihZA/r5KUEseIm4y2RIaHn/9ev1mYAnOupYBexpa8VtWdhq5hF1tPDooG263 fWiRDvVltHFtLrdmrMMmJfaNHEDJq6DkmHtltCG6KrbbDhaeeO7Akd535vYlV6c8dSbC WAFRBJdoR9CUNFLMpE4BZr4ugEHlydTqZpgORuhYreysKFef6VslOu3JiUSipmW7IMBK 2UNvy3Pa2DtMN7VfHzktJsqUX6jKOjskcMJ3nVegHRujr/LLL/DJX2Iu0xf64P+Ni39o ei4Q== 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=w4S3LcggWHZFMHf+Q5alhQ6gtQ4ejls9Fcrc6MA8Bks=; b=iCXRMoXgqBmBe9Mm5eiEMGq8seAKnzx+ztfuONT6idFLU56BMFcjZ9GpxnP9I+CW1A elkHKqKg8T0AwySN2Lj/UuE1LTLbPwhJRmveAou3yZLUpLwQH+bTRCjQzhbO7I3RbJI8 EnR2ODmOFA4gxQYqJEFaX9vjf/a0M4TjoUZIlktRtTaLxB3jislAR5kCqB+1gN+yHIY2 hfvG5a8eU4myL/MLD4ezdPWmHTEm78iVJGUh7DV8AGQo3zMGzcbrvMZED1ddGpe+4Fto wljtXGhGTQLMlhuMw8CMcEI49tEyAMcyul4bNRsrJ3j38zjJAyX3AunOJXI9U46OFw3k XAVA== 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 d3si14937640ejw.31.2019.10.16.04.52.37; Wed, 16 Oct 2019 04:52:59 -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 S2388845AbfJPGvb (ORCPT + 99 others); Wed, 16 Oct 2019 02:51:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:35846 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388363AbfJPGvb (ORCPT ); Wed, 16 Oct 2019 02:51:31 -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 2435DB715; Wed, 16 Oct 2019 06:51:29 +0000 (UTC) Date: Wed, 16 Oct 2019 08:51:27 +0200 (CEST) From: Miroslav Benes To: Joe Lawrence cc: Peter Zijlstra , Jessica Yu , Steven Rostedt , x86@kernel.org, linux-kernel@vger.kernel.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com, live-patching@vger.kernel.org Subject: Re: [PATCH v3 5/6] x86/ftrace: Use text_poke() In-Reply-To: <88bab814-ea24-ece9-2bc0-7a1e10a62f12@redhat.com> Message-ID: References: <20191007081945.10951536.8@infradead.org> <20191008104335.6fcd78c9@gandalf.local.home> <20191009224135.2dcf7767@oasis.local.home> <20191010092054.GR2311@hirez.programming.kicks-ass.net> <20191010091956.48fbcf42@gandalf.local.home> <20191010140513.GT2311@hirez.programming.kicks-ass.net> <20191010115449.22044b53@gandalf.local.home> <20191010172819.GS2328@hirez.programming.kicks-ass.net> <20191011125903.GN2359@hirez.programming.kicks-ass.net> <20191015130739.GA23565@linux-8ccs> <20191015135634.GK2328@hirez.programming.kicks-ass.net> <88bab814-ea24-ece9-2bc0-7a1e10a62f12@redhat.com> 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 Tue, 15 Oct 2019, Joe Lawrence wrote: > On 10/15/19 10:13 AM, Miroslav Benes wrote: > > Yes, it does. klp_module_coming() calls module_disable_ro() on all > > patching modules which patch the coming module in order to call > > apply_relocate_add(). New (patching) code for a module can be relocated > > only when the relevant module is loaded. > > FWIW, would the LPC blue-sky2 model (ie, Steve's suggestion @ plumber's where > livepatches only patch a single object and updates are kept on disk to handle > coming module updates as they are loaded) eliminate those outstanding > relocations and the need to perform this late permission flipping? Yes, it should, but we don't have to wait for it. PeterZ proposed a different solution to this specific issue in https://lore.kernel.org/lkml/20191015141111.GP2359@hirez.programming.kicks-ass.net/ It should not be a problem to create a live patch module like that and the code in kernel/livepatch/ is almost ready. Something like module_section_disable_ro(mod, section) (and similar for X protection) should be enough. Module reloads would still require juggling with the protections, but I think it is all feasible. Miroslav