[tip: x86/urgent] x86/alternatives: Do not use integer constant suffixes in inline asm

From: tip-bot2 for Willy Tarreau
Date: Tue Apr 18 2023 - 06:07:51 EST


The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: c22ef5684b64a3a1ac08db06a6f327f2695fd377
Gitweb: https://git.kernel.org/tip/c22ef5684b64a3a1ac08db06a6f327f2695fd377
Author: Willy Tarreau <w@xxxxxx>
AuthorDate: Tue, 18 Apr 2023 08:42:28 +02:00
Committer: Borislav Petkov (AMD) <bp@xxxxxxxxx>
CommitterDate: Tue, 18 Apr 2023 11:57:18 +02:00

x86/alternatives: Do not use integer constant suffixes in inline asm

The usage of the BIT() macro in inline asm code was introduced in 6.3 by
the commit in the Fixes tag. However, this macro uses "1UL" for integer
constant suffixes in its shift operation, while gas before 2.28 does not
support the "L" suffix after a number, and gas before 2.27 does not
support the "U" suffix, resulting in build errors such as the following
with such versions:

./arch/x86/include/asm/uaccess_64.h:124: Error: found 'L', expected: ')'
./arch/x86/include/asm/uaccess_64.h:124: Error: junk at end of line,
first unrecognized character is `L'

However, the currently minimal binutils version the kernel supports is
2.25.

There's a single use of this macro here, revert to (1 << 0) that works
with such older binutils.

As an additional info, the binutils PRs which add support for those
suffixes are:

https://sourceware.org/bugzilla/show_bug.cgi?id=19910
https://sourceware.org/bugzilla/show_bug.cgi?id=20732

[ bp: Massage and extend commit message. ]

Fixes: 5d1dd961e743 ("x86/alternatives: Add alt_instr.flags")
Signed-off-by: Willy Tarreau <w@xxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Tested-by: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/lkml/a9aae568-3046-306c-bd71-92c1fc8eeddc@xxxxxxxxxxxxxxxxx/
---
arch/x86/include/asm/alternative.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index e2975a3..d7da28f 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__