Re: [BUG REPORT] arch/x86/include/asm/uaccess_64.h:119: Error: junk at end of line
From: Willy Tarreau
Date: Sat Apr 15 2023 - 13:58:04 EST
Hi Boris!
On Tue, Mar 14, 2023 at 11:23:16AM +0100, Borislav Petkov wrote:
> On Tue, Mar 14, 2023 at 11:12:13AM +0800, Jingbo Xu wrote:
> > gcc (GCC) 6.5.1 20181026 (Alibaba 6.5.1-1)
>
> Looks like you should complain to whoever patched this gcc and broke it
> in the process. Unless you can reproduce the issue with an official
> compiler...
I got the exact same issue today when building over distcc using locally-
built gcc-7.5 and gcc-6.5 here, though the one from kernel.org/crosstool
didn't have the problem. The only difference I found is the binutils that
the asm comes from. Mine rely on 2.27 while the one from kernel.org is on
2.32.
I produced the .s file then tried to build it and compared. Both .s files
are identical, and only one asm (2.32) assembles it fine. The error is
triggered here:
663:
.pushsection .altinstructions,"a"
.long 661b - .
.long 6641f - .
.4byte ((((((1UL))) << (0)) << 16) | ((18*32+ 4)))
^
This is the "L" the asm complains about. If I change it to "1U" it's
happy. Indeed, the difference is here in the introduction of the BIT()
macro in the definition of ALT_FLAG_NOT in your commit 5d1dd961e743
("x86/alternatives: Add alt_instr.flags") merged into 6.3-rc1:
-#define ALTINSTR_FLAG_INV (1 << 15)
-#define ALT_NOT(feat) ((feat) | ALTINSTR_FLAG_INV)
+#define ALT_FLAGS_SHIFT 16
+
+#define ALT_FLAG_NOT BIT(0)
+#define ALT_NOT(feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature))
And I can confirm that the following patch fixes it for me, now the kernel
builds fine:
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index e2975a32d443..d7da28fada87 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -8,7 +8,7 @@
#define ALT_FLAGS_SHIFT 16
-#define ALT_FLAG_NOT BIT(0)
+#define ALT_FLAG_NOT (1 << 0)
#define ALT_NOT(feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature))
#ifndef __ASSEMBLY__
May I send you a cleaner patch for this ?
Thanks!
Willy