Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1639997imu; Tue, 6 Nov 2018 01:47:20 -0800 (PST) X-Google-Smtp-Source: AJdET5e3yFdOryenBa7DCxb8aRG4FrDgdHk7gWyXkbTtpKf92Nj8OIPWHLJOar7CTTTcibMY+bRm X-Received: by 2002:a63:a41:: with SMTP id z1mr23080555pgk.117.1541497640109; Tue, 06 Nov 2018 01:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541497640; cv=none; d=google.com; s=arc-20160816; b=H9SYjwmFD8J7SNbITrNj9kHLPJuDNT0LScIbLyxnZWxdt66W97DPvQYgir5qyinDwR /VHC2Mk1gOUTcv7fhHn8guw4iTejmgFlbc+YdgT3mLbd/a5CYaiT/oejXJ4ggqqMw+bj /BNzX+iefTA/jpb/3BY/ogydj5FjCN6mxgkOh4KdurBB3n0l0LhHj4rIk5EDav2e0I6v MpZiilFlXtTMBDefZUs1ulVCUteMPZ4Vbxf8R0OwFlRHUzWh+NE3vyigz3c0f+A+aDkY cjtXR2Uy6SK5XzcbJ4++X1RDn2D6x1J1qSxUhCJ0Zxu42kt8VEWbMMe3upH25+jam69H AxPg== 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=gVun7lujQrvkptU3eIXKXlonwdm0gcnsft35idOjV20=; b=fwAqVqnoifUpLvzdsusX0Ls5dToVfn9MLv5qfwQsWGd0tts9HXvSlzlrQdMZXJGWUy N5u1XujPPxEnZcnf4/nIhZcA9OFXNygHHr1RkJJ6JJ6BbJgug6aK8WEOBlxJ38XhwuL4 BpjxlgVYXn8QzDTxtyk6uAsTeybGSaNooAzORHohXolcAXl0IdIfROX+xmfhXoNWosGZ M/3XyNZU/FFtnBQ1OOTNf1OwixduwpENmodXOPIuLyk5T0prUINrHvUyAF0Fj+hVTxeg vSgL56KPN5ELz5aFXqSjCu176S1SHDVYD+jZj8IiFbamT941uk3Hobe2fIQKVou3WoRu UqrA== 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 bg12-v6si45572538plb.319.2018.11.06.01.47.04; Tue, 06 Nov 2018 01:47:20 -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 S2387593AbeKFTIy (ORCPT + 99 others); Tue, 6 Nov 2018 14:08:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:44764 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729241AbeKFTIy (ORCPT ); Tue, 6 Nov 2018 14:08:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8BF93B12F; Tue, 6 Nov 2018 09:44:29 +0000 (UTC) Date: Tue, 6 Nov 2018 10:44:27 +0100 (CET) From: Miroslav Benes To: Will Deacon cc: Jessica Yu , 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 In-Reply-To: <20181105192637.GB25023@brain-police> Message-ID: References: <20181001140910.086E768BC7@newverein.lst.de> <20181001141652.5478C68BE1@newverein.lst.de> <20181105175722.removbbpilqxu7tr@redbean> <20181105185323.hgoflyvkyujdyjxj@redbean> <20181105192637.GB25023@brain-police> 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 Mon, 5 Nov 2018, Will Deacon wrote: > 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. FWIW you can also add my Reviewed-by: Miroslav Benes Thanks, Jessica. Miroslav