Skip to content

Commit 877cff5

Browse files
Sebastian Andrzej Siewiorbp3tk0v
authored andcommitted
x86/vdso: Fake 32bit VDSO build on 64bit compile for vgetcpu
The 64bit register constrains in __arch_hweight64() cannot be fulfilled in a 32-bit build. The function is only declared but not used within vclock_gettime.c and gcc does not care. LLVM complains and aborts. Reportedly because it validates extended asm even if latter would get compiled out, see https://lore.kernel.org/r/Y%2BJ%[email protected] i.e., a long standing design difference between gcc and LLVM. Move the "fake a 32 bit kernel configuration" bits from vclock_gettime.c into a common header file. Use this from vclock_gettime.c and vgetcpu.c. [ bp: Add background info from Nathan. ] Fixes: 92d3306 ("x86/vdso: Provide getcpu for x86-32.") Reported-by: kernel test robot <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5646bbd commit 877cff5

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifdef CONFIG_X86_64
3+
4+
/*
5+
* in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel
6+
* configuration
7+
*/
8+
#undef CONFIG_64BIT
9+
#undef CONFIG_X86_64
10+
#undef CONFIG_COMPAT
11+
#undef CONFIG_PGTABLE_LEVELS
12+
#undef CONFIG_ILLEGAL_POINTER_VALUE
13+
#undef CONFIG_SPARSEMEM_VMEMMAP
14+
#undef CONFIG_NR_CPUS
15+
#undef CONFIG_PARAVIRT_XXL
16+
17+
#define CONFIG_X86_32 1
18+
#define CONFIG_PGTABLE_LEVELS 2
19+
#define CONFIG_PAGE_OFFSET 0
20+
#define CONFIG_ILLEGAL_POINTER_VALUE 0
21+
#define CONFIG_NR_CPUS 1
22+
23+
#define BUILD_VDSO32_64
24+
25+
#endif
Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#define BUILD_VDSO32
3-
4-
#ifdef CONFIG_X86_64
5-
6-
/*
7-
* in case of a 32 bit VDSO for a 64 bit kernel fake a 32 bit kernel
8-
* configuration
9-
*/
10-
#undef CONFIG_64BIT
11-
#undef CONFIG_X86_64
12-
#undef CONFIG_COMPAT
13-
#undef CONFIG_PGTABLE_LEVELS
14-
#undef CONFIG_ILLEGAL_POINTER_VALUE
15-
#undef CONFIG_SPARSEMEM_VMEMMAP
16-
#undef CONFIG_NR_CPUS
17-
#undef CONFIG_PARAVIRT_XXL
18-
19-
#define CONFIG_X86_32 1
20-
#define CONFIG_PGTABLE_LEVELS 2
21-
#define CONFIG_PAGE_OFFSET 0
22-
#define CONFIG_ILLEGAL_POINTER_VALUE 0
23-
#define CONFIG_NR_CPUS 1
24-
25-
#define BUILD_VDSO32_64
26-
27-
#endif
28-
3+
#include "fake_32bit_build.h"
294
#include "../vclock_gettime.c"

arch/x86/entry/vdso/vdso32/vgetcpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#include "fake_32bit_build.h"
23
#include "../vgetcpu.c"

0 commit comments

Comments
 (0)