Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp963064imu; Mon, 5 Nov 2018 11:29:10 -0800 (PST) X-Google-Smtp-Source: AJdET5e8DDxVRaKEyH6DkSZ3gwkvieR488MuIFS8p2buNxkT+Ytv5cpuDirvq9n4vLNziMiuL546 X-Received: by 2002:a63:4342:: with SMTP id q63mr21278704pga.63.1541446150373; Mon, 05 Nov 2018 11:29:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541446150; cv=none; d=google.com; s=arc-20160816; b=a+qDad3ID4UIOZZKn52S13j4Lo3BIkKIT48d+1RDCQ22omcgwx98fjOtVc5w1wu3vI CctlDXTKDGjXGz40wYf+zScUzimXHbscLiRNRF6S28iqpvn8RhASgkeUGBo63R8+A/PB K/exNiqK1BNZpVLcPG5SeIWUTEVDrG0b2ThTWd015DkKs+Yfget3HToOl8nxrJgkMtf5 5AJ+XHLQq5hpc+0Z7B7syhokP1odMsKOxaR9W0J6uR66xag5RinVP3GUW6smz4r61ixF FbF7loCOl+DjnsOfF2zr0W1U6kGIrzSDHtENSLjNq+5lvXaWan3f5NlyS45mXKuigsGO Htow== 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; bh=JTPJ2nmkETEWenoD4AOPdCtEYxRsVQYUh3fbHL/IfJc=; b=lL8/5pg1xV+TuMBt6An2D6v91G1Rx1nFpXzrg0IBa01YhUuAdRLW59u0nRJDVJRwPW 4CW0W36wHoqmZlyD+Zk7/rptxHE0yWWbxCK9FsXjbI1GZmYastSFOXkgSYZ2tfAoTp69 4OQalyUByB9m6C4gT3H7AneF7CSw6MXFwW4mC7RPImuThpqZHeRMsEAGMv8DDl0m8gA9 T2kDlgFwt6dL7eidt4zLrvATcWfqP6e12d9kqYkYJ44EyTtfMK8q7lstWg4LtF5RRyCq GioMjAGWqMs6CAxxqj30qwvtRtb3fmvSaXnBWcmYrRy+39vgibDD8x6kqyRx9W+BwJZI sq7Q== 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 x3-v6si43312876pgj.425.2018.11.05.11.28.55; Mon, 05 Nov 2018 11:29:10 -0800 (PST) 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 S2388051AbeKFEru (ORCPT + 99 others); Mon, 5 Nov 2018 23:47:50 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49398 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387556AbeKFEru (ORCPT ); Mon, 5 Nov 2018 23:47:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2873680D; Mon, 5 Nov 2018 11:26:40 -0800 (PST) Received: from brain-police (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B3EA23F5CF; Mon, 5 Nov 2018 11:26:39 -0800 (PST) Date: Mon, 5 Nov 2018 19:26:38 +0000 From: Will Deacon To: Jessica Yu Cc: Torsten Duwe , Catalin Marinas , Julien Thierry , Steven Rostedt , Josh Poimboeuf , Ingo Molnar , Ard Biesheuvel , Arnd Bergmann , AKASHI Takahiro , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH v2] arm64/module: use plt section indices for relocations Message-ID: <20181105192637.GB25023@brain-police> References: <20181001140910.086E768BC7@newverein.lst.de> <20181001141652.5478C68BE1@newverein.lst.de> <20181105175722.removbbpilqxu7tr@redbean> <20181105185323.hgoflyvkyujdyjxj@redbean> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181105185323.hgoflyvkyujdyjxj@redbean> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 05, 2018 at 07:53:23PM +0100, Jessica Yu wrote: > Instead of saving a pointer to the .plt and .init.plt sections to apply > plt-based relocations, save and use their section indices instead. > > The mod->arch.{core,init}.plt pointers were problematic for livepatch > because they pointed within temporary section headers (provided by the > module loader via info->sechdrs) that would be freed after module load. > Since livepatch modules may need to apply relocations post-module-load > (for example, to patch a module that is loaded later), using section > indices to offset into the section headers (instead of accessing them > through a saved pointer) allows livepatch modules on arm64 to pass in > their own copy of the section headers to apply_relocate_add() to apply > delayed relocations. > > Signed-off-by: Jessica Yu > --- > > v2: > > - Do sechdrs[pltsec->plt_shndx].sh_addr instead of pointer math > > Note: Addressed Will's comment about the pltsec -> plt_info rename and > removed that change to reduce unnecessary code churn. I didn't include the > Ack's for this reason so let me know if this version is OK as well. Thanks, Jessica! Acked-by: Will Deacon > arch/arm64/include/asm/module.h | 8 +++++--- > arch/arm64/kernel/module-plts.c | 36 ++++++++++++++++++++---------------- > arch/arm64/kernel/module.c | 9 +++++---- > 3 files changed, 30 insertions(+), 23 deletions(-) Actually, I guess I should just queue this for 4.21 given that it's completely self-contained. Will