Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp706116ybz; Wed, 15 Apr 2020 17:08:42 -0700 (PDT) X-Google-Smtp-Source: APiQypL9T/ZhOWiWf55+DHLa3RNOAQ0TexZeKVzR5fE7Em6AtQu2t5IQ+Jw7qs2BoVipytYVNuNz X-Received: by 2002:a50:cb84:: with SMTP id k4mr28281423edi.89.1586995722026; Wed, 15 Apr 2020 17:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586995722; cv=none; d=google.com; s=arc-20160816; b=bqi8UdmRz57/Rq25oknDCHtMsyZ7799/vdqHV8ZI8ZQxEYuhQWVEBXcQc7WwmtXvgu ekjm+isnndDiu8MIXvb2jwapoVxi4Y0MzPjhsvdtTYNEUThykQVF2ghYZvcy6h4Yle5m NLxHPwAWEBRgbvB8MuAzgBo0tBneoqWccbA+8lQxDKxqRiIrY15Gf+iQO8f8UsPT7ZZI J/AuqMyKQcZn4+0tbNnEpGHrFrocJCzzUQV4Iqxw15fId8z1YbtS98Q4hVCZbs/qlCPv j7eBUwjuINZQpcuRBxY+kM2EJwGm9KO2Q2pg4SLUVt1qVrUmMzkOU23FFQLkCPsErrVO 3Ccg== 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=lWTz/9MnaVkSpzl9rNLjj1xHqec2GmpX14v0aVuu+20=; b=qATQrYeWTOlbb+zltksTjIIUo+XExsa+9fe2OlXQ6/k2/i0OsR6Klv0xSZst/iWlzI 1o8+dTkB+P60sbVrp2VZN1Zw2yXtOdDaGiSIM6oMeXUlK7tljpXLAMyALNE2ky8Qbx0z ExHZEfLopMFad8NJIedfVCU5EdlXkmCX4Mg70oFGCmojZf+IttAZy5URicF8AjAYV9OJ /Ri8USjI9f4pPsdcYVlpNQc/bxdo0gL3onqqI8TQ3g9YLdtQzjhMsF5xtixBdpwCG3RU eEEyziuP4K8RvKk50eWRkF8TO3ityTMPYqXB8e2pv9uQug2LWZMBkszDMvTogfYHpREt D3Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si8826918ejd.424.2020.04.15.17.08.18; Wed, 15 Apr 2020 17:08:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394019AbgDOOaX (ORCPT + 99 others); Wed, 15 Apr 2020 10:30:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:47646 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729358AbgDOOaT (ORCPT ); Wed, 15 Apr 2020 10:30:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 241A6AA7C; Wed, 15 Apr 2020 14:30:15 +0000 (UTC) Date: Wed, 15 Apr 2020 16:30:15 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: Peter Zijlstra , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu Subject: Re: [PATCH 1/7] livepatch: Apply vmlinux-specific KLP relocations early In-Reply-To: <20200414193150.iqw224itgpedpltm@treble> Message-ID: References: <8c3af42719fe0add37605ede634c7035a90f9acc.1586881704.git.jpoimboe@redhat.com> <20200414174406.GC2483@worktop.programming.kicks-ass.net> <20200414180109.da4v2b4ifpixuzn3@treble> <20200414193150.iqw224itgpedpltm@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 Tue, 14 Apr 2020, Josh Poimboeuf wrote: > On Tue, Apr 14, 2020 at 01:01:09PM -0500, Josh Poimboeuf wrote: > > On Tue, Apr 14, 2020 at 07:44:06PM +0200, Peter Zijlstra wrote: > > > On Tue, Apr 14, 2020 at 11:28:37AM -0500, Josh Poimboeuf wrote: > > > > KLP relocations are livepatch-specific relocations which are applied to > > > > 1) vmlinux-specific KLP relocation sections > > > > > > > > .klp.rela.vmlinux.{sec} > > > > > > > > These are relocations (applied to the KLP module) which reference > > > > unexported vmlinux symbols. > > > > > > > > 2) module-specific KLP relocation sections > > > > > > > > .klp.rela.{module}.{sec}: > > > > > > > > These are relocations (applied to the KLP module) which reference > > > > unexported or exported module symbols. > > > > > > Is there something that disallows a module from being called 'vmlinux' ? > > > If not, we might want to enforce this somewhere. > > > > I'm pretty sure we don't have a check for that anywhere, though the KLP > > module would almost certainly fail during the module load when it > > couldn't find the vmlinux.ko symbols it needed. > > > > It wouldn't hurt to add a check somewhere though. Maybe in > > klp_module_coming() since the restriction only applies to > > CONFIG_LIVEPATCH... > > From: Josh Poimboeuf > Subject: [PATCH] livepatch: Disallow vmlinux.ko > > This is purely a theoretical issue, but if there were a module named OT: "if there were"... subjunctive? > vmlinux.ko, the livepatch relocation code wouldn't be able to > distinguish between vmlinux-specific and vmlinux.o-specific KLP > relocations. > > If CONFIG_LIVEPATCH is enabled, don't allow a module named vmlinux.ko. Yup, there is no such check nowadays. I always struggle to find the right balance between being overprotective and letting the user shoot themselves in their foot if they want to. But it does not hurt, so ack to that. Miroslav