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: 9226587 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 8C95560868 for ; Wed, 13 Jul 2016 00:12:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C31727BFA for ; Wed, 13 Jul 2016 00:12:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E76527CCB; Wed, 13 Jul 2016 00:12:57 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F35A24DA1 for ; Wed, 13 Jul 2016 00:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751024AbcGMALd (ORCPT ); Tue, 12 Jul 2016 20:11:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51829 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbcGMALb (ORCPT ); Tue, 12 Jul 2016 20:11:31 -0400 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 Cc: Torsten Duwe , Catalin Marinas , Will Deacon , takahiro.akashi@linaro.org, Jungseok Lee , Arnd Bergmann , Li Bin , Steven Rostedt , Ingo Molnar , Christopher Li , Jiri Kosina , andrew.wafaa@arm.com, linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List , live-patching@vger.kernel.org, linux-arch@vger.kernel.org, linux-sparse@vger.kernel.org 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) Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.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; /*