From patchwork Thu Feb 18 10:01:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102752 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp489981lbl; Thu, 18 Feb 2016 02:02:11 -0800 (PST) X-Received: by 10.98.43.149 with SMTP id r143mr8695590pfr.7.1455789730873; Thu, 18 Feb 2016 02:02:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ey12si8426550pac.203.2016.02.18.02.02.10; Thu, 18 Feb 2016 02:02:10 -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; 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 S1425977AbcBRKCG (ORCPT + 30 others); Thu, 18 Feb 2016 05:02:06 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:58759 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425770AbcBRKCB (ORCPT ); Thu, 18 Feb 2016 05:02:01 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0LjrPF-1ZywaY0Rjt-00bppi; Thu, 18 Feb 2016 11:01:31 +0100 From: Arnd Bergmann To: Russell King Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Ard Biesheuvel , Nicolas Pitre , linux-kernel@vger.kernel.org Subject: [PATCH v2] ARM: move __kuser_cmpxchg{32,64} into .kprobes.text Date: Thu, 18 Feb 2016 11:01:20 +0100 Message-Id: <1455789689-2839463-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:OtNJvQMFMelnOuH/WL7YLpfelNSL8pJPv1feRz+IWxRmKlgRnhg k0UsuvjVpk2kLzPwtJ70GHtAyzFIh3b2G3CtE+DDwAUKzVGqeD+DEkaE6VIsYPXGt1XkL0K YhHPfJGq2s1amCeWyrp0nxCe/Zux4P/WoLSoIdyFcUQvvPLgVCiEUGn3IXPf9E35EpvxTzu UkUAd6yFclziH30qIDQUg== X-UI-Out-Filterresults: notjunk:1; V01:K0:KsGU4rKdGZU=:9q56ewmA69zHtCyNrq7x2F 2ZjbKMzIvGkLiaVS9LvDY1B7WaOYB4h5asLyOhfXGJ+u2h/3U1/uL10xQ+3BBDsD545IIWb2d wOYgsfXUjE+k1UHKOTHtJ0qtMZR5R7Zx3ktqJ3TRXCKhqoF0NgbaifVsosRnCdeNlAAw/ck5z w9ayPI+RRS5rQp88FHOnQQiQLSbXVSW7DVMYR20jMuXDjtbPrn4rbQkP+AWerpIdb9/ByQqg0 pmCQv/YJhDJHVHmSmSGrULRWJ55nBBEviNgqeNdaODyCLnlnSCmCh58URceU6//gavhRrRJr5 VSeSblYH/x6QRXoG7R5CJc0YFwA6UGi9CLqS0DWZzR6wXughA6N0fV7GiMvT3PzkTtYGqceuY aKM3J9QBTuaa6mLGcjmLnGqnY2D19xdrp116sqVZB5fkA9Ip58pwkPL7lcHa4FCJkfUNDz8kG fG426ahdry3VSa08QH35EuK01MG93pvOoEURslSSmNgsPVQn1jyaZrdEf964zLb6k7QO74mYl sRja7WPqdGLkY0gIhcHr06dS+Ax8lnsmpp47pd5BX8vB2d7+Vt/O+waAQEPMmTwF47rg+VFyh YB1O4XmOso05Hg1u+raBRrYUi6bnCzrmtljxyKKCUBGgYOLSeA+py2J960eOOLaivOCAcjkN1 qYuo1CiJOzGzODAkwo8m9RUeOnZf2TlOuDE20VNH1HRN3cQTKwmzgaI2/K9Ew9EubeCc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kprobes is used, most of the entry-armv.S file is put into the .kprobes.text section rather than .text, but the kuser_cmpxchg64_fixup and kuser_cmpxchg32_fixup code is not, which can lead to a link error when extremely large kernels get built (typically for randconfig): arch/arm/kernel/built-in.o: In function `__dabt_usr': :(.kprobes.text+0x47c): relocation truncated to fit: R_ARM_JUMP24 against `.text' arch/arm/kernel/built-in.o: In function `__irq_usr': :(.kprobes.text+0x4e4): relocation truncated to fit: R_ARM_JUMP24 against `.text' arch/arm/kernel/built-in.o: In function `__fiq_usr': :(.kprobes.text+0x740): relocation truncated to fit: R_ARM_JUMP24 against `.text' This moves the two remaining functions into the same section as the rest using a new macro suggested by Nicolas Pitre, which avoids the link error. The current behavior has existed for many years and has not caused problems in practice except for extreme randconfig builds, so the patch should not need to get backported. Signed-off-by: Arnd Bergmann Fixes: b49c0f24cf67 ("[ARM] 4659/1: remove possibilities for spurious false negative with __kuser_cmpxchg") Fixes: 785d3cd286f0 ("ARM kprobes: prevent some functions involved with kprobes from being probed") Acked-by: Nicolas Pitre --- arch/arm/kernel/entry-armv.S | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.7.0 diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index e2550500486d..3bc1a196cb53 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -83,11 +83,12 @@ .endm #ifdef CONFIG_KPROBES - .section .kprobes.text,"ax",%progbits +#define KPROBE_TEXT .section .kprobes.text,"ax",%progbits #else - .text +#define KPROBE_TEXT .text #endif + KPROBE_TEXT /* * Invalid mode handlers */ @@ -895,7 +896,7 @@ __kuser_cmpxchg64: @ 0xffff0f60 rsbs r0, r3, #0 @ set return val and C flag ldmfd sp!, {r4, r5, r6, pc} - .text + KPROBE_TEXT kuser_cmpxchg64_fixup: @ Called from kuser_cmpxchg_fixup. @ r4 = address of interrupted insn (must be preserved). @@ -953,7 +954,7 @@ __kuser_cmpxchg: @ 0xffff0fc0 rsbs r0, r3, #0 @ set return val and C flag usr_ret lr - .text + KPROBE_TEXT kuser_cmpxchg32_fixup: @ Called from kuser_cmpxchg_check macro. @ r4 = address of interrupted insn (must be preserved).