From patchwork Fri Nov 20 20:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 11922199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C69C6379F for ; Fri, 20 Nov 2020 20:30:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 529AC2223F for ; Fri, 20 Nov 2020 20:30:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 529AC2223F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D8BA76B0072; Fri, 20 Nov 2020 15:30:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CCFAA6B0078; Fri, 20 Nov 2020 15:30:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8875F6B0074; Fri, 20 Nov 2020 15:30:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 578FC6B0072 for ; Fri, 20 Nov 2020 15:30:08 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E88263649 for ; Fri, 20 Nov 2020 20:30:07 +0000 (UTC) X-FDA: 77505938454.27.feet22_0316d7b2734e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id C66593D663 for ; Fri, 20 Nov 2020 20:30:07 +0000 (UTC) X-HE-Tag: feet22_0316d7b2734e X-Filterd-Recvd-Size: 3262 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Nov 2020 20:30:06 +0000 (UTC) IronPort-SDR: 3Q4djgNl0DDwRnVoIekI8vnM7ClJ8ykxAzHmiY/VgJSikoWm2SfpddB1i06c/pyflRsuTtkOXo wENsEz7HDY8Q== X-IronPort-AV: E=McAfee;i="6000,8403,9811"; a="171702876" X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="171702876" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2020 12:30:04 -0800 IronPort-SDR: U72t0mwZ0fnOScOzQ+Cap1KnJJ99WrXmxF1BTKUleIlNidw12qKWyWmE3jcq71e92pPJ/C0z1M wXnoMBoRm+QA== X-IronPort-AV: E=Sophos;i="5.78,357,1599548400"; d="scan'208";a="342163315" Received: from rpedgeco-mobl.amr.corp.intel.com (HELO localhost.intel.com) ([10.209.105.214]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2020 12:30:03 -0800 From: Rick Edgecombe To: akpm@linux-foundation.org, jeyu@kernel.org, bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, luto@kernel.org, dave.hansen@linux.intel.com, peterz@infradead.org, x86@kernel.org, rppt@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com Cc: elena.reshetova@intel.com, ira.weiny@intel.com, Rick Edgecombe Subject: [PATCH RFC 07/10] x86/unwind: Unwind orc at module writable address Date: Fri, 20 Nov 2020 12:24:23 -0800 Message-Id: <20201120202426.18009-8-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201120202426.18009-1-rick.p.edgecombe@intel.com> References: <20201120202426.18009-1-rick.p.edgecombe@intel.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since modules can have a separate writable address during loading, do the orc unwind at the writable address. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/unwind_orc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index 73f800100066..41f9022a10cc 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -238,8 +238,8 @@ static int orc_sort_cmp(const void *_a, const void *_b) void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size, void *_orc, size_t orc_size) { - int *orc_ip = _orc_ip; - struct orc_entry *orc = _orc; + int *orc_ip = module_adjust_writable_addr(_orc_ip); + struct orc_entry *orc = module_adjust_writable_addr(_orc); unsigned int num_entries = orc_ip_size / sizeof(int); WARN_ON_ONCE(orc_ip_size % sizeof(int) != 0 || @@ -257,8 +257,8 @@ void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size, sort(orc_ip, num_entries, sizeof(int), orc_sort_cmp, orc_sort_swap); mutex_unlock(&sort_mutex); - mod->arch.orc_unwind_ip = orc_ip; - mod->arch.orc_unwind = orc; + mod->arch.orc_unwind_ip = _orc_ip; + mod->arch.orc_unwind = _orc; mod->arch.num_orcs = num_entries; } #endif