Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1389988pxb; Thu, 28 Jan 2021 15:36:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJybVwpchaIDVZDxuz3k3cWRw+DrN5lIJucdBBBjCkjA91Wsg3JQGuuP67Y/cJRa4anfiytX X-Received: by 2002:a17:906:fc5:: with SMTP id c5mr1807582ejk.538.1611876987651; Thu, 28 Jan 2021 15:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611876987; cv=none; d=google.com; s=arc-20160816; b=q5X/TQBxqehogVFV+52iOJIAis6kt58ZR3qC2qopxcTolT3nOJdE+JU0zV5EU0QEcm XHCq/fVDV9Bxf+MkZ8oRb6//swTRFWj9J7tTpJ/K7BBsHxRPlxw2q9eX4eUUL4UFsspA qHWSVtTuVDXZv5J1XSfTMgk1kCVBoSZhy8esyn2DGjEYaV3p6gh+epfvVbH3vilsI1D+ ytg3MMpKUcEdxqSUdrWGuhaw/jfniSUOwgD4CL98T+y0h6+TWdbUTiQOOZGiJBvxvhBa G5NfhTQiLuFaBVRUWR8YZ98igCOXmPZ/To2wPkqv72KzW+mLErynfEinQV7KQvYg6WBt vMtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8+oit+P4+s2dEOmT/n96aE4qKoNJkhLBsiemk0aGOus=; b=F9Dq0qY7e+3krtrS6zRZ7QtwLLFKvx4FcMWUCEAAK2yhgTIkNuRltoUKAVkYeWBT7q dT5xRSf96h4xfgETSUmLyDUXC95yiAGIdrCXP3hSrfvJA64bTDPKWFrj3sBHoO1cc5Yg OSBZduXX5QAit97BlUjyuPG5VXSw8vRljWb5TL8tpSc1VB+H7bfDGdd/igho1QiXcooE wbrqPrILFzQSEbrdG0A4fVQAPMQi0cxa9qwbtNH4VHFSTaYonoW41SSqu04Waam3PYbs xA2MC/j629FrpnU1c2piTgysQTU3d9jON5omIEnUOWClYOlo9hj3LMyrUBWQaw7/j5n/ 1n8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XPW2F5Cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si3627113ejy.672.2021.01.28.15.36.02; Thu, 28 Jan 2021 15:36:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XPW2F5Cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231160AbhA1Xdl (ORCPT + 99 others); Thu, 28 Jan 2021 18:33:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:50862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbhA1Xbv (ORCPT ); Thu, 28 Jan 2021 18:31:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5BA264DFC for ; Thu, 28 Jan 2021 23:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611876662; bh=a/cMMnXPcsFfWRH4ryA6nFzHSiiHCZHsMnVY+j8TpNA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XPW2F5CgDSmxwT+iNeeFzJG4ExgB3HxUxmFIueio5D1h3LU6xuRRjZoKjrpL2czMv nR6DQxXCzD3sMAX5HtdgCOxNiTx+1l5Lw8llD9oW7R2EQTdD+i4mlXo7fGAHNZ37ly wPHw/jhm0pwdJivwOAmGJS1SvaOBmCnB7m3zjWguvZUKCprItprd3F/FvNvJm8Dk7K l9D3Czn4BBNf2nctfdRho6AJoiFzsglkVK9ZYmJ6yfWq4H+SGu3benls/r+bliRgAU cu4adoCEMEOKYL7Wj/H2phXsxn48ooT+Wry66266ccKTh7NYprZYZqfj5tJJInduGP WgoN/tRxXz5SQ== Received: by mail-ot1-f44.google.com with SMTP id f6so6934026ots.9 for ; Thu, 28 Jan 2021 15:31:02 -0800 (PST) X-Gm-Message-State: AOAM531P7UKzi2otP4XkM2f31NruCa4c3fe5XvHEbQhY/8/gzLNCxRCC e5z7kPwxe0SKy/Yvp6izVM1/VnAekGWKlmbbSq0= X-Received: by 2002:a05:6830:1158:: with SMTP id x24mr1209516otq.108.1611876661885; Thu, 28 Jan 2021 15:31:01 -0800 (PST) MIME-Version: 1.0 References: <20210128193422.241155-1-ndesaulniers@google.com> In-Reply-To: From: Ard Biesheuvel Date: Fri, 29 Jan 2021 00:30:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c in UAL To: Arnd Bergmann Cc: Nick Desaulniers , Russell King , Arnd Bergmann , Nathan Chancellor , Linux ARM , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Jan 2021 at 23:28, Arnd Bergmann wrote: > > On Thu, Jan 28, 2021 at 10:03 PM Ard Biesheuvel wrote: > > On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers wrote: > > > @@ -468,15 +468,15 @@ void kprobe_thumb32_test_cases(void) > > > > > > TEST_UNSUPPORTED("strexb r0, r1, [r2]") > > > TEST_UNSUPPORTED("strexh r0, r1, [r2]") > > > - TEST_UNSUPPORTED("strexd r0, r1, [r2]") > > > + TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") > > > TEST_UNSUPPORTED("ldrexb r0, [r1]") > > > TEST_UNSUPPORTED("ldrexh r0, [r1]") > > > - TEST_UNSUPPORTED("ldrexd r0, [r1]") > > > + TEST_UNSUPPORTED("ldrexd r0, r1, [r1]") > > > > > > TEST_GROUP("Data-processing (shifted register) and (modified immediate)") > > > > > > #define _DATA_PROCESSING32_DNM(op,s,val) \ > > > - TEST_RR(op s".w r0, r",1, VAL1,", r",2, val, "") \ > > > + TEST_RR(op s" r0, r",1, VAL1,", r",2, val, "") \ > > > > What is wrong with these .w suffixes? Shouldn't the assembler accept > > these even on instructions that only exist in a wide encoding? > > I don't know if that is a bug in the integrated assembler or > intentional behavior, but it may be easier to just change the > kernel than the compiler in this case, as it also makes it work > for older versions. > > FWIW, I needed a related change in a couple of other files: > For fully specified test cases, I suppose removing the .w is fine. But for the macros below, it really isn't: it depends on the actual register assignment whether narrow encodings exist or not, and in that case, we definitely want the wide one. The fact that instantiating the macro in a different way can only produce wide encodings in the first place should really not trigger an error. Things like this can break the Thumb2 build very subtly, so if the integrated assembler is not up to that, we should simply disable it for Thumb2 builds. > diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S > index 6acdfde56849..3ced01d9afe4 100644 > --- a/arch/arm/lib/copy_from_user.S > +++ b/arch/arm/lib/copy_from_user.S > @@ -60,7 +60,7 @@ > #define LDR1W_SHIFT 0 > > .macro ldr1w ptr reg abort > - USERL(\abort, W(ldr) \reg, [\ptr], #4) > + USERL(\abort, ldr \reg, [\ptr], #4) > .endm > > .macro ldr4w ptr reg1 reg2 reg3 reg4 abort > @@ -80,7 +80,7 @@ > #define STR1W_SHIFT 0 > > .macro str1w ptr reg abort > - W(str) \reg, [\ptr], #4 > + str \reg, [\ptr], #4 > .endm > > .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort > diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S > index 485fa3cffdbe..a6a96f814720 100644 > --- a/arch/arm/lib/copy_to_user.S > +++ b/arch/arm/lib/copy_to_user.S > @@ -34,7 +34,7 @@ > #define LDR1W_SHIFT 0 > > .macro ldr1w ptr reg abort > - W(ldr) \reg, [\ptr], #4 > + ldr \reg, [\ptr], #4 > .endm > > .macro ldr4w ptr reg1 reg2 reg3 reg4 abort > @@ -77,7 +77,7 @@ > #define STR1W_SHIFT 0 > > .macro str1w ptr reg abort > - USERL(\abort, W(str) \reg, [\ptr], #4) > + USERL(\abort, str \reg, [\ptr], #4) > .endm > > .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort > diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S > index e4caf48c089f..7b980a1a4227 100644 > --- a/arch/arm/lib/memcpy.S > +++ b/arch/arm/lib/memcpy.S > @@ -15,7 +15,7 @@ > #define STR1W_SHIFT 0 > > .macro ldr1w ptr reg abort > - W(ldr) \reg, [\ptr], #4 > + ldr \reg, [\ptr], #4 > .endm > > .macro ldr4w ptr reg1 reg2 reg3 reg4 abort > @@ -31,7 +31,7 @@ > .endm > > .macro str1w ptr reg abort > - W(str) \reg, [\ptr], #4 > + str \reg, [\ptr], #4 > .endm > > .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort > diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S > index 6fecc12a1f51..35c5c06b7588 100644 > --- a/arch/arm/lib/memmove.S > +++ b/arch/arm/lib/memmove.S > @@ -84,24 +84,24 @@ WEAK(memmove) > addne pc, pc, ip @ C is always clear here > b 7f > 6: W(nop) > - W(ldr) r3, [r1, #-4]! > - W(ldr) r4, [r1, #-4]! > - W(ldr) r5, [r1, #-4]! > - W(ldr) r6, [r1, #-4]! > - W(ldr) r7, [r1, #-4]! > - W(ldr) r8, [r1, #-4]! > - W(ldr) lr, [r1, #-4]! > + ldr r3, [r1, #-4]! > + ldr r4, [r1, #-4]! > + ldr r5, [r1, #-4]! > + ldr r6, [r1, #-4]! > + ldr r7, [r1, #-4]! > + ldr r8, [r1, #-4]! > + ldr lr, [r1, #-4]! > > add pc, pc, ip > nop > W(nop) > - W(str) r3, [r0, #-4]! > - W(str) r4, [r0, #-4]! > - W(str) r5, [r0, #-4]! > - W(str) r6, [r0, #-4]! > - W(str) r7, [r0, #-4]! > - W(str) r8, [r0, #-4]! > - W(str) lr, [r0, #-4]! > + str r3, [r0, #-4]! > + str r4, [r0, #-4]! > + str r5, [r0, #-4]! > + str r6, [r0, #-4]! > + str r7, [r0, #-4]! > + str r8, [r0, #-4]! > + str lr, [r0, #-4]! > > CALGN( bcs 2b )