From: Ard Biesheuvel <ardb@kernel.org> To: Arnd Bergmann <arnd@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com>, Russell King <linux@armlinux.org.uk>, Arnd Bergmann <arnd@arndb.de>, Nathan Chancellor <natechancellor@gmail.com>, Linux ARM <linux-arm-kernel@lists.infradead.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com> Subject: Re: [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c in UAL Date: Fri, 29 Jan 2021 00:30:50 +0100 [thread overview] Message-ID: <CAMj1kXEx-mUCgX5F6xg8-6jKtpqQ=sRosmo4u-0jhW5zu9A-fw@mail.gmail.com> (raw) In-Reply-To: <CAK8P3a0CTUh=4h=U6S5A_tqHxYEyO52HTropAV9mKh2hwJvi0g@mail.gmail.com> On Thu, 28 Jan 2021 at 23:28, Arnd Bergmann <arnd@kernel.org> wrote: > > On Thu, Jan 28, 2021 at 10:03 PM Ard Biesheuvel <ardb@kernel.org> wrote: > > On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> 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 )
WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ardb@kernel.org> To: Arnd Bergmann <arnd@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de>, Nick Desaulniers <ndesaulniers@google.com>, Russell King <linux@armlinux.org.uk>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com>, Nathan Chancellor <natechancellor@gmail.com>, Linux ARM <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c in UAL Date: Fri, 29 Jan 2021 00:30:50 +0100 [thread overview] Message-ID: <CAMj1kXEx-mUCgX5F6xg8-6jKtpqQ=sRosmo4u-0jhW5zu9A-fw@mail.gmail.com> (raw) In-Reply-To: <CAK8P3a0CTUh=4h=U6S5A_tqHxYEyO52HTropAV9mKh2hwJvi0g@mail.gmail.com> On Thu, 28 Jan 2021 at 23:28, Arnd Bergmann <arnd@kernel.org> wrote: > > On Thu, Jan 28, 2021 at 10:03 PM Ard Biesheuvel <ardb@kernel.org> wrote: > > On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> 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 ) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-01-28 23:33 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-28 4:43 [PATCH] ARM: kprobes: rewrite in UAL Nick Desaulniers 2021-01-28 4:43 ` Nick Desaulniers 2021-01-28 16:15 ` Arnd Bergmann 2021-01-28 16:15 ` Arnd Bergmann 2021-01-28 18:59 ` Nick Desaulniers 2021-01-28 21:23 ` Arnd Bergmann 2021-01-28 21:23 ` Arnd Bergmann 2021-01-28 19:34 ` [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c " Nick Desaulniers 2021-01-28 21:03 ` Ard Biesheuvel 2021-01-28 21:03 ` Ard Biesheuvel 2021-01-28 22:28 ` Arnd Bergmann 2021-01-28 22:28 ` Arnd Bergmann 2021-01-28 23:30 ` Ard Biesheuvel [this message] 2021-01-28 23:30 ` Ard Biesheuvel 2021-02-13 11:01 ` Ard Biesheuvel 2021-02-13 11:01 ` Ard Biesheuvel 2021-01-29 0:21 ` Nick Desaulniers 2021-01-29 0:21 ` Nick Desaulniers 2021-01-29 9:40 ` Ard Biesheuvel 2021-01-29 18:54 ` [PATCH v3] ARM: kprobes: rewrite test-arm.c " Nick Desaulniers 2021-01-29 18:54 ` Nick Desaulniers 2021-03-29 22:08 ` [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c " Nick Desaulniers 2021-03-29 22:08 ` Nick Desaulniers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAMj1kXEx-mUCgX5F6xg8-6jKtpqQ=sRosmo4u-0jhW5zu9A-fw@mail.gmail.com' \ --to=ardb@kernel.org \ --cc=arnd@arndb.de \ --cc=arnd@kernel.org \ --cc=clang-built-linux@googlegroups.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=natechancellor@gmail.com \ --cc=ndesaulniers@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.