Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4015785ybg; Fri, 25 Oct 2019 12:07:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJMR+/NLM2O8IDwWdYIWlgIkFVnDBqrY1TyirkZy3xic4unaIu64kMq310EheGdk88FMiO X-Received: by 2002:a17:907:429c:: with SMTP id ny20mr4872491ejb.234.1572030468458; Fri, 25 Oct 2019 12:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572030468; cv=none; d=google.com; s=arc-20160816; b=ntyieBg8Z+D6oGOlSVoCe2iQ3/keQZ6+R+k0PFOjZziwcvqO1jTwmFD+SNneIWPR98 Py0e5DrJ5s9UIlIz3DrLvX0P9x1Wk+7C9nEawcrLHgBOpvrvR6DCgK/KPEwqe3AT26OJ nQc1GnMD32mg3cnP75CmzqOT1QzDonpCcN49WvsZXHowiB7CbexMIw2nw09uO608zQkU 6rbcW6ll6GXrIhQA+EAyXsvroMXFSKRkn3Da+LbsV0FrAUn4j+bEgc2YTOIoP82kmyDB gYEYU5hLdtFNFIvmJ40gFOEaD5V7vyJvde6flMdZnjoQwUlkFaDkqP+/fby+409FX73b izbg== 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=GVODDosAz0KEwdHpAoHPZ1mcsfz+QIahQyGZ0FFdveI=; b=uQcQD+dKmfmUi6wu1q2JZEzfEaSrF0l07If5VfyVcQ6LifKgR0z+4B0duABqkqveBk YUj7u/aV12lvo+cz203+NevQlBqqOEKax033SwfU0hhZR18gqWhiPbTOru4o+CV7zgsr cb/FrD0NPAR4vmsX27Fq7CTTPWzfMkD09KJG1EDAhZsB0Dw3add69w56wGvvk6fccJ9e y0HFB19J1ks0zCBJAEtzTmXZmGggiPagQAYs4qMA1ANjOYBissSGMHxTwLwk2RZEGFSO jmJ5EhRm0B0BwZpbEqcXAHGfjWCNs8dYffIxiB5tJNfTJAGpi2lQVph5wahTSuW0dYQ8 2BAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=EWkROy1U; 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 u3si1774109edy.48.2019.10.25.12.07.24; Fri, 25 Oct 2019 12:07:48 -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=merlin.20170209 header.b=EWkROy1U; 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 S1727957AbfJXUdT (ORCPT + 99 others); Thu, 24 Oct 2019 16:33:19 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60874 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727709AbfJXUdT (ORCPT ); Thu, 24 Oct 2019 16:33:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=GVODDosAz0KEwdHpAoHPZ1mcsfz+QIahQyGZ0FFdveI=; b=EWkROy1UNPTh1cenqdA4Lbg0U SFH3/12wnub2nQFPEEaf4U/aYASqjMm0xqUrLVylowlgDwWhLiVA6jRnBfYgdrvpv99RFEk4H6rwa 6KyCw7Pk8KQ2sg8lPMEMyxiQgwTJxRSFGdvONnPWbzu3ieGxWjg/x+ZaRABi4tcFlFx+vxgdqFjin RbXncK9O1MEWFeqi9pntFjmWvn6dAB9CNLVqNeWDyZmQCXSRLyPTzZG+hEyppPqpPJofUCFOMbtuu mOFqtBPJhcfTLtkBx4RpxKD/YohtclX4KYsxwHBGrkKQwyTBHMnftmraNMMiR1JT93Jm6rtiSbeuu Ywv5jGfrw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNjn9-0004Is-K2; Thu, 24 Oct 2019 20:33:07 +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 8D53B300EBF; Thu, 24 Oct 2019 22:32:07 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 28BA6201A6638; Thu, 24 Oct 2019 22:33:06 +0200 (CEST) Date: Thu, 24 Oct 2019 22:33:06 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: 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 Subject: Re: [PATCH v4 15/16] module: Move where we mark modules RO,X Message-ID: <20191024203306.GL4114@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> <20191023151654.GF19358@hirez.programming.kicks-ass.net> <20191023171514.7hkhtvfcj5vluwcg@treble> <20191024105904.GB4131@hirez.programming.kicks-ass.net> <20191024183115.jomddpijq5u453qc@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191024183115.jomddpijq5u453qc@treble> 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 Thu, Oct 24, 2019 at 01:31:15PM -0500, Josh Poimboeuf wrote: > How about something like this? Completely untested, but if you agree > with this approach I could hack up kpatch-build to test it properly. > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index ab4a4606d19b..597bf32bc591 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -239,6 +239,17 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod) > if (ret) > return ret; > > + /* > + * Prevent module patches from using livepatch relas for > + * vmlinux symbols. Presumably such symbols are exported and > + * normal relas can instead be used at patch module loading > + * time. > + */ > + if (!vmlinux && core_kernel_text(addr)) { > + pr_err("unsupported livepatch symbol\n"); > + return -EINVAL; > + } > + > sym->st_value = addr; > } If that works, this is much simpler and therefore preferred.