From patchwork Thu Feb 18 17:05:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102736 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp701650lbl; Thu, 18 Feb 2016 09:06:37 -0800 (PST) X-Received: by 10.67.1.209 with SMTP id bi17mr11693685pad.150.1455815197346; Thu, 18 Feb 2016 09:06:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si10376534pfi.230.2016.02.18.09.06.37; Thu, 18 Feb 2016 09:06:37 -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 S1946985AbcBRRG1 (ORCPT + 30 others); Thu, 18 Feb 2016 12:06:27 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:59465 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946428AbcBRRGZ (ORCPT ); Thu, 18 Feb 2016 12:06:25 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MTgXI-1aNY2g1ICu-00QWLf; Thu, 18 Feb 2016 18:05:58 +0100 From: Arnd Bergmann To: Russell King Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Ard Biesheuvel , Nicolas Pitre , Jon Medhurst , Marc Zyngier , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] [RESEND] ARM: kprobes: use "I" constraint for inline assembly offsets Date: Thu, 18 Feb 2016 18:05:09 +0100 Message-Id: <1455815113-2562966-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455815113-2562966-1-git-send-email-arnd@arndb.de> References: <1455815113-2562966-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:vaob21BB2lSCMXyIsD4AwzJOs1MFgL68TT3uMvUl7xlcLVuExRt Vhl200+fcUNI47dV/fofFgd6hw/P50TRYtmjSJicZpla2lJiq0sGqwUpz30C97VioprTqK+ VlwOQtNVaEoKu2D5B9N0d7SusqjTAkWkB8VQAlWV+QI8b32cDJ0y2HfIix4Tpsg7qcRSsJc sZ9/IVER9o9RQvZUPS2Ig== X-UI-Out-Filterresults: notjunk:1; V01:K0:7eBOH525Ks0=:hzpAWuRE0kvtnOvnzEM/wM Xj4qXLHkowRMK8JR7dQrtn8tTAHceMm7qDAYtv2N4/itExXKinFR+2dQfBOMTpIbzlN2NtpYj lIEntEIWVftN/a5jJ6Cu9YJi5/xr//B+xY4n3Z/4ZcpQs8yt7gjDHS6M3z0h0EzsAJwGX9krR N7RWw9dGceaf+nBtnrpeRiol1drFXvHJTrzWvS0gN17oHAk5Ivhq374emTbsrWT8Fiv2ihi/Y 3KfAsNSIybt5yK3k2or4yCAS+sHI4AYnC4ctznij7JAMLPOFEm5KPsX+lfqEhgCl4Biyrq16I APLUuk8I4HGkicZtNNNGiPgLC/9PuELEqeOLwqDSW2sz4iY18SXCDteNVlrYoH8xHJqzrjYYr YxaQzhlH8LNSPXDgM4PmlytqaFWCUy0/QbLkNuzK+GzPQNouHG8N77gaHbsDwRpLWgK6IMx42 b1ty48ihkxl+MiGjXEUyQXlSftNxizDgW3BYW8K32PoUHdziJiBrmxO5nF4AOsVSrKntN3x2e Nej38qh/WnppBmtPRrkCDaeidQMa3syqXWu1l9hVU8fkom2ZBBExmeA8w/fPUj9LbLROeRrLE FciMLarp1R9sMlxIyo5bIiVykGUBURbO3kyfJ50AwT34exRgxS06x6NBWkJgWwJ8dzS9OCo5f 3929VRTrycODTEbs1DGJ7hwdonKovW4XfyQaIk0oHFOua5um/lF/2r0g7ekrwxMs9wgY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org build-testing with clang showed that the "J" constraint does not take positive arguments on clang when building in for Thumb-2: core.c:540:3: error: invalid operand for inline asm constraint 'J' This has been reported as llvm bug https://llvm.org/bugs/show_bug.cgi?id=26061 However, looking at the source code in depth, I found that the kernel is also wrong, and it should not use "J" at all, but should use "I" to pass an immediate argument to the inline assembly when that is used as an offset to an 'ldr' instruction rather than the 'sub' argument. Signed-off-by: Arnd Bergmann --- arch/arm/probes/kprobes/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.0 diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c index a4ec240ee7ba..4b34b40ca917 100644 --- a/arch/arm/probes/kprobes/core.c +++ b/arch/arm/probes/kprobes/core.c @@ -570,10 +570,10 @@ void __kprobes jprobe_return(void) : : "r" (kcb->jprobe_saved_regs.ARM_sp), "I" (sizeof(struct pt_regs) * 2), - "J" (offsetof(struct pt_regs, ARM_sp)), - "J" (offsetof(struct pt_regs, ARM_pc)), - "J" (offsetof(struct pt_regs, ARM_cpsr)), - "J" (offsetof(struct pt_regs, ARM_lr)) + "I" (offsetof(struct pt_regs, ARM_sp)), + "I" (offsetof(struct pt_regs, ARM_pc)), + "I" (offsetof(struct pt_regs, ARM_cpsr)), + "I" (offsetof(struct pt_regs, ARM_lr)) : "memory", "cc"); }