Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4049798ybg; Fri, 25 Oct 2019 12:35:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUJW9E3VHE3xPQMm0ABauMxFtc0KBGhnmrKD3oHKJSIy6DMeY88dPUY7yink0BHWvUD6fO X-Received: by 2002:a17:906:184e:: with SMTP id w14mr5094500eje.10.1572032120137; Fri, 25 Oct 2019 12:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572032120; cv=none; d=google.com; s=arc-20160816; b=or7SQ5QBDEc1+LdThEzupX269m8N0vKn6XsB+p69XM4DnyhZ1NHRD6Wdyr72PmuJd8 bVxe/YfMiz70MxceDBKDk+h6yCofemm/hYesIS0KGmE7MjhjOxOsMq+FEEVKIMzjZLfh Wb6+JBI3VIrKuvdsRlnpqgZF0CxMTeCH8ivUyOKxM0VllOBcJhpZj9VGd6dhf85LqzvB XuvRmKJ8/DOEz6l5irEryZPAC0o1Y/tTU+v8eBsCZ6l/KUR8203IP9dyvmVgZ/XlL4+Q 7KG8XR9ndch/2hEUhphVJuriM01HRQQfZ1HcwtOvYzSjq0/OKH/2qNm6B9dKYsBciVj2 cj7w== 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:dkim-signature; bh=4HNQYHclJdpz6RgSoEiA+TUKr4RT5EnizppRlQ3bps8=; b=tyxEbiW+OXEKCI4FvxHnM2fBVqQ/VTyWL6cDXIB8QZ2ZxEH0E2R/8JiBBsRvF6Xe3M ZGEtrTliIyumU3UsiQiZ2mawAEFT3mqvV04OEwVIa//buDWcdiE2+n4T2vyyaIJEt92v lZJxsq2Mq5s1jBsGIuxrH8s73pST3aYbDvpd/4BS1bg6JJXSlKhLaBK9JgP8pHVXFdOn jJhhMtCkH0Pem9qZVi0u6un025tiUloTIZnpcfiF1yPdv5rB8j7PMk1mTxM4PXltfH6Q Gklz2QAlqobDkCgYd1piqkgZtZjRil0paL6Tb7wlw7GY2pYrjqhhnMuJHtFboULW1H52 V99Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qiISsN8D; 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 17si1693657ejt.403.2019.10.25.12.34.56; Fri, 25 Oct 2019 12:35:20 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qiISsN8D; 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 S2436548AbfJYJQ5 (ORCPT + 99 others); Fri, 25 Oct 2019 05:16:57 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35966 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbfJYJQ5 (ORCPT ); Fri, 25 Oct 2019 05:16:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4HNQYHclJdpz6RgSoEiA+TUKr4RT5EnizppRlQ3bps8=; b=qiISsN8DPpzxJuDWz5BDD7Vsb nyk65gVZOZKlJdImt/zQ93JZf06MrUU84AZ2Rsfj9ptyTwWjr0D3qFev4YZQfFPwJTMmDobsN0BIk BjQ5xOzlgeGTMGH/nj+hTq32C+lTp3YOmIQQjx690HEJY53zroXK96U1kgH2zoh/q6D+yAR7fxkCR NbWzxkhobMh986G8cityFONFpJ+3Kz3hnTzKbLn0NepyOKE4bk0Ic96FQ5eI9MaWJNoVq2rAnv1bg zC0/oopErZGmxqjGq2sEPyLSJLd+UMv9VuOpm84Rd7H5jLuP4VkpiYrpLY9ByFMTMEMhCU+USTsNm TJq8gTq9A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNvi1-00055a-9Y; Fri, 25 Oct 2019 09:16:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3873A3006E3; Fri, 25 Oct 2019 11:15:36 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 07F88201A6624; Fri, 25 Oct 2019 11:16:35 +0200 (CEST) Date: Fri, 25 Oct 2019 11:16:34 +0200 From: Peter Zijlstra To: Petr Mladek Cc: Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.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, jeyu@kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH v4 15/16] module: Move where we mark modules RO,X Message-ID: <20191025091634.GA4114@hirez.programming.kicks-ass.net> References: <20191018073525.768931536@infradead.org> <20191018074634.801435443@infradead.org> <20191021135312.jbbxsuipxldocdjk@treble> <20191021141402.GI1817@hirez.programming.kicks-ass.net> <20191023114835.GT1817@hirez.programming.kicks-ass.net> <20191023170025.f34g3vxaqr4f5gqh@treble> <20191024131634.GC4131@hirez.programming.kicks-ass.net> <20191025064456.6jjrngm4m3mspaxw@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191025064456.6jjrngm4m3mspaxw@pathway.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 25, 2019 at 08:44:56AM +0200, Petr Mladek wrote: > On Thu 2019-10-24 15:16:34, Peter Zijlstra wrote: > > Right, that really should be able to run early. Esp. after commit > > > > 11e86dc7f274 ("x86/paravirt: Detect over-sized patching bugs in paravirt_patch_call()") > > > > paravirt patching is unconditional. We _never_ run with the indirect > > call except very early boot, but modules should have them patched way > > before their init section runs. > > > > We rely on this for spectre-v2 and friends. > > Livepatching has the same requirement. The module code has to be fully > livepatched before the module gets actually used. Right, and that is just saying that all paravirt RELAs (pv_ops) can basically be deleted from modules. Which avoids the reported problem in yet another way. > It means before mod->init() is called and before the module is moved > into MODULE_STATE_LIVE state. Funny thing, currently ftrace is running code before all that. It runs code before klp_module_coming(), before jump_label patching. My other patch in this thread fixes that.