From patchwork Wed Jul 13 00:11:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jessica Yu X-Patchwork-Id: 9226591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 56B5660868 for ; Wed, 13 Jul 2016 00:13:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 444EF24DA1 for ; Wed, 13 Jul 2016 00:13:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3618427C39; Wed, 13 Jul 2016 00:13:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB29E24DA1 for ; Wed, 13 Jul 2016 00:13:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bN7mC-00084j-1c; Wed, 13 Jul 2016 00:11:44 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bN7m9-00083y-HJ for linux-arm-kernel@lists.infradead.org; Wed, 13 Jul 2016 00:11:42 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75E89CF61A; Wed, 13 Jul 2016 00:11:19 +0000 (UTC) Received: from packer-debian-8-amd64.digitalocean.com (vpn-58-244.rdu2.redhat.com [10.10.58.244]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u6D0BEf8023456; Tue, 12 Jul 2016 20:11:15 -0400 Date: Tue, 12 Jul 2016 20:11:14 -0400 From: Jessica Yu To: Miroslav Benes Subject: [PATCH] arm64: take SHN_LIVEPATCH syms into account when calculating plt_max_entries Message-ID: <20160713001113.GA30925@packer-debian-8-amd64.digitalocean.com> References: <20160627151500.2247A68D20@newverein.lst.de> <20160627151722.B81C968D29@newverein.lst.de> <20160711215807.GA23097@packer-debian-8-amd64.digitalocean.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-OS: Linux eisen.io 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 13 Jul 2016 00:11:20 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160712_171141_617501_49FA4133 X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Jungseok Lee , Arnd Bergmann , Catalin Marinas , Christopher Li , Jiri Kosina , Will Deacon , Linux Kernel Mailing List , Steven Rostedt , takahiro.akashi@linaro.org, linux-sparse@vger.kernel.org, Ingo Molnar , Torsten Duwe , andrew.wafaa@arm.com, Li Bin , live-patching@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP SHN_LIVEPATCH symbols are technically a subset of SHN_UNDEF/undefined symbols, except that their addresses are resolved by livepatch at runtime. Therefore, when calculating the upper-bound for the number of plt entries to allocate, make sure to take livepatch symbols into account as well. Signed-off-by: Jessica Yu --- arch/arm64/kernel/module-plts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c index 1ce90d8..1e95dc1 100644 --- a/arch/arm64/kernel/module-plts.c +++ b/arch/arm64/kernel/module-plts.c @@ -122,7 +122,8 @@ static unsigned int count_plts(Elf64_Sym *syms, Elf64_Rela *rela, int num) * as well, so modules can never grow beyond that limit. */ s = syms + ELF64_R_SYM(rela[i].r_info); - if (s->st_shndx != SHN_UNDEF) + if (s->st_shndx != SHN_UNDEF && + s->st_shndx != SHN_LIVEPATCH) break; /*