Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1035523imd; Thu, 1 Nov 2018 09:14:48 -0700 (PDT) X-Google-Smtp-Source: AJdET5csILiATtO2MP4hVGCr3gQasrMWTyjdMrvilB9u2DtPFYr0WMrxO99SwRjpNlLJJHMRa8ie X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr8345910plt.268.1541088888236; Thu, 01 Nov 2018 09:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541088888; cv=none; d=google.com; s=arc-20160816; b=CDUz9IaSlU0qEWDcfNmgLT2zWqwb0XI41sowZcyJih1vMrYoMk5D0MCBIHVQbdFSH1 3muI+UCET1LbO5t4ACLc4mWAq7vTVkNMZM4dkexEXMo/UobprYty+lPSjPCxv+DBnJ43 2PmS/+1MjmGyBcZkK/YQvluDsYWnhblTuAX57BeQjmf6+CpIKejCg8WNFUkqBI6cxljf 72usIky7GKn0BnUba078fUb8+hWT5C4Ont/26D8hkUkK7POsc2tmUYSHqxNQuukxrTJJ bS3TQ2LCCgbqPd2zEB2fsPoVA9K1arOL5ci8X9GYq+x0J/TOpcztnu+asvHbASoRe2v+ bWuA== 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=c+ebReGGJJOqaJ2LRipC1AUgaOWDqyGrK3XSLUvusEE=; b=XnVhkzVzsBXWaks2EkXz9u4RzS7KX5QmFLmWAktI6L+YiVWo1OYHo7e3BV43uUaMoH FOhZ82xLyoeqgikETaqiP1FNncOwFylh2hpWy/G8+iTeuWwuDbEMN4KiYdD3M1hzb049 p8Um+XSVKfOrdz9ctD38FTkQSqfJtnujagAle8boC/Scfo/l2GGrGW++kJvSjb6ASfW+ LNlwqWtgrn88JSqw83yB5xkwu6WmH1tkjb+6Qyve8wzxqInhXOtdGJmWsfy6S9x6akMJ eSnAMOu0gwal4PtHUNX1MxWFxNFVDg7AshZsYoZmR7O2xiA7UydTMriMSs6h9lrimmSk EANw== 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 a123-v6si30488686pgc.219.2018.11.01.09.14.33; Thu, 01 Nov 2018 09:14: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; 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 S1728861AbeKBBL3 (ORCPT + 99 others); Thu, 1 Nov 2018 21:11:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728078AbeKBBL3 (ORCPT ); Thu, 1 Nov 2018 21:11:29 -0400 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 D7DF2341; Thu, 1 Nov 2018 09:07:51 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 955B53F716; Thu, 1 Nov 2018 09:07:51 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id C0A0F1AE0D51; Thu, 1 Nov 2018 16:07:59 +0000 (GMT) Date: Thu, 1 Nov 2018 16:07:59 +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 , Miroslav Benes , Petr Mladek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH v2] arm64/module: use mod->klp_info section header information for livepatch modules Message-ID: <20181101160759.GB17659@arm.com> References: <20181001140910.086E768BC7@newverein.lst.de> <20181001141652.5478C68BE1@newverein.lst.de> <20181023175553.gaobskk26koft6s2@linux-8ccs> <20181026172500.g65bl2p7cvey3qsx@linux-8ccs> <20181029152834.GA16289@arm.com> <20181030131910.zuqw523rq4pi7apb@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181030131910.zuqw523rq4pi7apb@linux-8ccs> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Jessica, On Tue, Oct 30, 2018 at 02:19:10PM +0100, Jessica Yu wrote: > +++ Will Deacon [29/10/18 15:28 +0000]: > >On Fri, Oct 26, 2018 at 07:25:01PM +0200, Jessica Yu wrote: > >>diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h > >>index fef773c94e9d..ac9b97f9ae5e 100644 > >>--- a/arch/arm64/include/asm/module.h > >>+++ b/arch/arm64/include/asm/module.h > >>@@ -25,6 +25,7 @@ struct mod_plt_sec { > >> struct elf64_shdr *plt; > >> int plt_num_entries; > >> int plt_max_entries; > >>+ int plt_shndx; > >>}; > > > >Does this mean we can drop the plt pointer from this struct altogether, and > >simply offset into the section headers when applying the relocations? > > Hmm, if everyone is OK with dropping the plt pointer from struct > mod_plt_sec, then I think we can simplify this patch even further. > > With the plt shndx saved, we can additionally pass a pointer to > sechdrs to module_emit_plt_entry(), and with that just offset into the > section headers as you suggest. Since livepatch *already* passes in > the correct copy of the section headers (mod->klp_info->sechdrs) to > apply_relocate_add(), we wouldn't even need to modify the arm64 > module_finalize() to change mod->arch.core.plt to point into > mod->klp_info->sechdrs anymore and we can drop all the changes to the > module loader too. > > Something like the following maybe? This looks pretty good, thanks! My only (minor) objection is that the renaming of plt_sec -> plt_info throughout makes the patch a lot more churny than it needs to be, for questionable gain. Anyway, it looks functionally correct and I've tested loading/unloading the "hello world" test module with both PLTs enabled and disabled. Acked-by: Will Deacon Will