Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3473538imu; Sun, 11 Nov 2018 15:55:41 -0800 (PST) X-Google-Smtp-Source: AJdET5d1KtJd3H+4Rrc+7I8YYwwS+4raRRrhnxT+iUJoZCfxOqomMPndYRsXs5zCwdBbMvopo4ca X-Received: by 2002:a63:e749:: with SMTP id j9-v6mr15222901pgk.246.1541980541116; Sun, 11 Nov 2018 15:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980541; cv=none; d=google.com; s=arc-20160816; b=PJTsXy53jixTyf9QTQWVLzjC3zBZsXb02iS0Ea4ffLCs9aqZ+HUuxDaktrKUliOme5 N7E+SriKfPDrOEKatPoBZ5razP8km8I/bSnOV5PVv67CZkfoV6okif9j4vIdXgkO/sqd hhK/k5ID4f4316aEqToiCgRsf0rz4oo5w7W99Iw+PhtFnCCO00ZjRwISSj/bc7cfVQFF /0tW48TawoWDIMRsoyZ9sO3s5wdrHUGHgXEf4beyfCkq1zs5cErmGDYWy+oA9reX6pZF ZPpE9pXJvE5UnM5wru2DxYOWbkK6vO7CkMMJIpXTYx9FsTuSb9Pz6JDLFDWpT8u87GTU Qxkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z8fxTy4XbvC+SkRDD9JS299FnVEJtqAy3QRIr5vE0YM=; b=Oo0TTFLZ7Bo4ovV/sfQ14YPALj9NLvn+g6jALRfV1pGd67oKR8XjyCnPnvzfAmjmO9 vJsc6t91nVesiM8b+Lcy0wOHGMhy5bfo/X1nN6pn7s51Xwe7KfmKz+N+ecyIR2lZkcvO JrG3TPRphLn4RO7lRMMw8cbp5ZDID50fGd9byFlCOHBNRpG1fX4399EeaXjr7Wgmp/ZX UN6xrWmTVognfT8xpNIN5DtbZ32ZegTeB5ga0uKRM4LHYjO04B8+UsaFHizyY5alTlaI iKX8b1y28y+4H2bXAWaOiFiBezE8pBbZS3HKh8h1Jp4S2iH7Fa1LjvfxcusU+B4iqZSB 6vhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oLieONoO; 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 cc8-v6si17859366plb.377.2018.11.11.15.55.26; Sun, 11 Nov 2018 15:55:41 -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; dkim=pass header.i=@kernel.org header.s=default header.b=oLieONoO; 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 S1732969AbeKLJoR (ORCPT + 99 others); Mon, 12 Nov 2018 04:44:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:37302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732756AbeKLISY (ORCPT ); Mon, 12 Nov 2018 03:18:24 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F5EE21527; Sun, 11 Nov 2018 22:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975308; bh=ecwUhoW/3eORpou8QEtFXAE4/OQjKY4PaNI9YRLouFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLieONoOQxGDG44wzh4nJbQ3+yEhffWCRnwuGX3rb+55C5HQ0n6NcNYDlYWZ9ZFP6 xQGf41KWoHSd3r8kiFp+m72Rb6hGHnsA/Xk7HetafSKGX64ADf8Zsurics93HnNFvm zll9kHyqm+rhM9ldyDrQS0rlpzcTADSDcUIxJlQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Naveen N. Rao" , Michael Ellerman Subject: [PATCH 4.19 280/361] powerpc64/module elfv1: Set opd addresses after module relocation Date: Sun, 11 Nov 2018 14:20:27 -0800 Message-Id: <20181111221655.792925529@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Naveen N. Rao commit 59fe7eaf3598a89cbcd72e645b1d08afd76f7b29 upstream. module_frob_arch_sections() is called before the module is moved to its final location. The function descriptor section addresses we are setting here are thus invalid. Fix this by processing opd section during module_finalize() Fixes: 5633e85b2c313 ("powerpc64: Add .opd based function descriptor dereference") Cc: stable@vger.kernel.org # v4.16 Signed-off-by: Naveen N. Rao Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/module.c | 8 ++++++++ arch/powerpc/kernel/module_64.c | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) --- a/arch/powerpc/kernel/module.c +++ b/arch/powerpc/kernel/module.c @@ -74,6 +74,14 @@ int module_finalize(const Elf_Ehdr *hdr, (void *)sect->sh_addr + sect->sh_size); #endif /* CONFIG_PPC64 */ +#ifdef PPC64_ELF_ABI_v1 + sect = find_section(hdr, sechdrs, ".opd"); + if (sect != NULL) { + me->arch.start_opd = sect->sh_addr; + me->arch.end_opd = sect->sh_addr + sect->sh_size; + } +#endif /* PPC64_ELF_ABI_v1 */ + #ifdef CONFIG_PPC_BARRIER_NOSPEC sect = find_section(hdr, sechdrs, "__spec_barrier_fixup"); if (sect != NULL) --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -360,11 +360,6 @@ int module_frob_arch_sections(Elf64_Ehdr else if (strcmp(secstrings+sechdrs[i].sh_name,"__versions")==0) dedotify_versions((void *)hdr + sechdrs[i].sh_offset, sechdrs[i].sh_size); - else if (!strcmp(secstrings + sechdrs[i].sh_name, ".opd")) { - me->arch.start_opd = sechdrs[i].sh_addr; - me->arch.end_opd = sechdrs[i].sh_addr + - sechdrs[i].sh_size; - } /* We don't handle .init for the moment: rename to _init */ while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))