From patchwork Wed Feb 17 22:28:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102753 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp258887lbl; Wed, 17 Feb 2016 14:29:45 -0800 (PST) X-Received: by 10.98.66.75 with SMTP id p72mr5704284pfa.50.1455748185214; Wed, 17 Feb 2016 14:29:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eg4si4636081pac.40.2016.02.17.14.29.44; Wed, 17 Feb 2016 14:29:45 -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 S1423973AbcBQW3j (ORCPT + 30 others); Wed, 17 Feb 2016 17:29:39 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:53294 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423585AbcBQW3g (ORCPT ); Wed, 17 Feb 2016 17:29:36 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0Mf6Az-1aLMyL2Uf3-00OYIA; Wed, 17 Feb 2016 23:29:08 +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] ARM: move __kuser_cmpxchg{32,64} into .kprobes.text Date: Wed, 17 Feb 2016 23:28:27 +0100 Message-Id: <1455748127-2844701-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:0SxEfA8XTspJRTY6wsjWgoK8J/mOjL78xd7VzWEQ/M8gj9G8nrV Eodf0b7i8V3pNcIlJo9kvc0TvsBkwXpAlxIVWkeo5IfVajTd9XPURVdOeiHO3WRFFOJWm5B BBg3rUJNMyLd6VmEBLGlE9f+oSwcw1o7KP1zGU8kmakamCdVLRqTdqnjWNV1kHUNXnIOpNT sX7v9S+ImoWvY1EaSpyMw== X-UI-Out-Filterresults: notjunk:1; V01:K0:t03mVWTiHNk=:yoW+XbcHurPl16NZ5eUxA9 +tzo5uL3rPYzz63NWm5L7ZdAnOXmq5bvNh2fsT0o40TIBqVilioOIU7Q9LHy+3cOdQkKpWVSV 0uXrKMtln6Fo1qQvrolpbl80gdXuTg59FQwzB78nT1WBTM5Y2Du+CTlDExQysoFR4JcwPLud4 SrnUpqNTmbx2SHwb8Sw+r/AkbY7JdZHP73/Qe/Gb3FYF4Dlbc/4S+l0sBKSYUv/IjdIbn5K16 u1ZFVvwakk+157v3bemEPOyT2GZIo9SZ5TCLjr4HECaIuWHd3f9DAYCOlqT41mawYOax7lYhA lYZtlq9IeUPnVuN/Dd5ncOuou8g0FeGS8tF4dZVY1TURgbnNU1ro5ZATmUgovKr708s4sKdTw 8ed0Vne/YkO3oqmEb5un5rzZXzOYf3QZGXdddUdwPdsW5v55kuRaLFSk0BGcrPHPFqzU61FZW Syo6Uc8ct+P58UVd0+cydw/GOZdP2B0rO2lTrQwWJh0JOXveSqHCQIf3ShIlWdijQAUcbwKpv 7NItJHZQvY9sdh3RpaOk/H7acAixZm4cz9lnUBWsTK4NJWtnJikKopRJ8N4n4qpGPADdB07T4 kQBpIRbUWNzzvJfl8oCn7+934pBA2+4cYIQdo7WJJwoziv/17rsJqxdvl4iziv8x5tdBe5Csx wln8s/Rv0yaxh44qTLmIg66A2QeEM8TnZp8Sv+Og8dPUPbhZTvebCcWNqXu95LcqVQpY= 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, to avoid 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") --- arch/arm/kernel/entry-armv.S | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.0 diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index e2550500486d..030e43a0dce8 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -895,7 +895,11 @@ __kuser_cmpxchg64: @ 0xffff0f60 rsbs r0, r3, #0 @ set return val and C flag ldmfd sp!, {r4, r5, r6, pc} +#ifdef CONFIG_KPROBES + .section .kprobes.text,"ax",%progbits +#else .text +#endif kuser_cmpxchg64_fixup: @ Called from kuser_cmpxchg_fixup. @ r4 = address of interrupted insn (must be preserved). @@ -953,7 +957,11 @@ __kuser_cmpxchg: @ 0xffff0fc0 rsbs r0, r3, #0 @ set return val and C flag usr_ret lr +#ifdef CONFIG_KPROBES + .section .kprobes.text,"ax",%progbits +#else .text +#endif kuser_cmpxchg32_fixup: @ Called from kuser_cmpxchg_check macro. @ r4 = address of interrupted insn (must be preserved).