mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
Misc fixes:
- Fix an UV boot crash, - Skip spurious ENDBR generation on _THIS_IP_, - Fix ENDBR use in putuser() asm methods, - Fix corner case boot crashes on 5-level paging, - and fix a false positive WARNING on LTO kernels. Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmUHOrwRHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1j6Jw/+PjUfh/4+KM/Z8VzcBy2UhY3NMF2ptGCN 47FPLy+8ADqOvIfgsPsBEO9VXwdvkHfH64YWRUlULjvPNOSs+37drBYMe9AI9xKE u6NhoBHmsnOtoLkBFIQYlJys9GyAeoMlwSSHxzRwQS+3VztRjoH636jiBcg/h7DR zhakfnJD1SSOZuEyyDPnO0uIUarrcqC2jdZwucSqZnvZFdA/pexUHQEe2RtMXLln EIA5kuEo7UdADcSr/Lbty7MKO+6xpRTjxF0yNItPtwPWsnxrSAC7P+dQ37uB975U Z0CJ/kw54XG5Sdoech7XCWYmJzDxSPhiziA1USKpZJMo5phAG/apTJK6NG4TG94r U+3QhLopUoSd8N74/VtZn0FjOrMsk7YKD5o8twlTbpCd2VaiJk4X5oBIns6Tvq05 0Vmsx15XO3mEzg1wWbbdjhjHW0czRgBpikS9QyexZKVkukYcW8QT6bk1gK1ypg94 do4PHKB53QIt31dedy/ddpQj4u1sJ4+a9/+IG29kjUB33M4+uFedtw11vfe+CDN0 XLRc6HfPblogIIEO/figJgwSq/TPCOsNHTwKkejq+D1Ey6DsrnX9Gg4BWVz/3dDW 84SW7TaO2FGEDh4NkR2ijkZlbpofFnCvhCh/uohodPlqDrTVTuRKCZW9I5plmGVa qeXUpNDFs1E= =BMjT -----END PGP SIGNATURE----- Merge tag 'x86-urgent-2023-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 fixes from Ingo Molnar: "Misc fixes: - Fix an UV boot crash - Skip spurious ENDBR generation on _THIS_IP_ - Fix ENDBR use in putuser() asm methods - Fix corner case boot crashes on 5-level paging - and fix a false positive WARNING on LTO kernels" * tag 'x86-urgent-2023-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/purgatory: Remove LTO flags x86/boot/compressed: Reserve more memory for page tables x86/ibt: Avoid duplicate ENDBR in __put_user_nocheck*() x86/ibt: Suppress spurious ENDBR x86/platform/uv: Use alternate source for socket to node data
This commit is contained in:
commit
e789286468
@ -59,6 +59,14 @@ static void *alloc_pgt_page(void *context)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Consumed more tables than expected? */
|
||||
if (pages->pgt_buf_offset == BOOT_PGT_SIZE_WARN) {
|
||||
debug_putstr("pgt_buf running low in " __FILE__ "\n");
|
||||
debug_putstr("Need to raise BOOT_PGT_SIZE?\n");
|
||||
debug_putaddr(pages->pgt_buf_offset);
|
||||
debug_putaddr(pages->pgt_buf_size);
|
||||
}
|
||||
|
||||
entry = pages->pgt_buf + pages->pgt_buf_offset;
|
||||
pages->pgt_buf_offset += PAGE_SIZE;
|
||||
|
||||
|
@ -40,23 +40,40 @@
|
||||
#ifdef CONFIG_X86_64
|
||||
# define BOOT_STACK_SIZE 0x4000
|
||||
|
||||
# define BOOT_INIT_PGT_SIZE (6*4096)
|
||||
# ifdef CONFIG_RANDOMIZE_BASE
|
||||
/*
|
||||
* Assuming all cross the 512GB boundary:
|
||||
* 1 page for level4
|
||||
* (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
|
||||
* 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
|
||||
* Total is 19 pages.
|
||||
* Used by decompressor's startup_32() to allocate page tables for identity
|
||||
* mapping of the 4G of RAM in 4-level paging mode:
|
||||
* - 1 level4 table;
|
||||
* - 1 level3 table;
|
||||
* - 4 level2 table that maps everything with 2M pages;
|
||||
*
|
||||
* The additional level5 table needed for 5-level paging is allocated from
|
||||
* trampoline_32bit memory.
|
||||
*/
|
||||
# ifdef CONFIG_X86_VERBOSE_BOOTUP
|
||||
# define BOOT_PGT_SIZE (19*4096)
|
||||
# else /* !CONFIG_X86_VERBOSE_BOOTUP */
|
||||
# define BOOT_PGT_SIZE (17*4096)
|
||||
# endif
|
||||
# else /* !CONFIG_RANDOMIZE_BASE */
|
||||
# define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE
|
||||
# endif
|
||||
# define BOOT_INIT_PGT_SIZE (6*4096)
|
||||
|
||||
/*
|
||||
* Total number of page tables kernel_add_identity_map() can allocate,
|
||||
* including page tables consumed by startup_32().
|
||||
*
|
||||
* Worst-case scenario:
|
||||
* - 5-level paging needs 1 level5 table;
|
||||
* - KASLR needs to map kernel, boot_params, cmdline and randomized kernel,
|
||||
* assuming all of them cross 256T boundary:
|
||||
* + 4*2 level4 table;
|
||||
* + 4*2 level3 table;
|
||||
* + 4*2 level2 table;
|
||||
* - X86_VERBOSE_BOOTUP needs to map the first 2M (video RAM):
|
||||
* + 1 level4 table;
|
||||
* + 1 level3 table;
|
||||
* + 1 level2 table;
|
||||
* Total: 28 tables
|
||||
*
|
||||
* Add 4 spare table in case decompressor touches anything beyond what is
|
||||
* accounted above. Warn if it happens.
|
||||
*/
|
||||
# define BOOT_PGT_SIZE_WARN (28*4096)
|
||||
# define BOOT_PGT_SIZE (32*4096)
|
||||
|
||||
#else /* !CONFIG_X86_64 */
|
||||
# define BOOT_STACK_SIZE 0x1000
|
||||
|
@ -8,6 +8,14 @@
|
||||
#undef notrace
|
||||
#define notrace __attribute__((no_instrument_function))
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
/*
|
||||
* The generic version tends to create spurious ENDBR instructions under
|
||||
* certain conditions.
|
||||
*/
|
||||
#define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; })
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
|
||||
#endif /* CONFIG_X86_32 */
|
||||
|
@ -1533,7 +1533,7 @@ static void __init build_socket_tables(void)
|
||||
{
|
||||
struct uv_gam_range_entry *gre = uv_gre_table;
|
||||
int nums, numn, nump;
|
||||
int cpu, i, lnid;
|
||||
int i, lnid, apicid;
|
||||
int minsock = _min_socket;
|
||||
int maxsock = _max_socket;
|
||||
int minpnode = _min_pnode;
|
||||
@ -1584,15 +1584,14 @@ static void __init build_socket_tables(void)
|
||||
|
||||
/* Set socket -> node values: */
|
||||
lnid = NUMA_NO_NODE;
|
||||
for_each_possible_cpu(cpu) {
|
||||
int nid = cpu_to_node(cpu);
|
||||
int apicid, sockid;
|
||||
for (apicid = 0; apicid < ARRAY_SIZE(__apicid_to_node); apicid++) {
|
||||
int nid = __apicid_to_node[apicid];
|
||||
int sockid;
|
||||
|
||||
if (lnid == nid)
|
||||
if ((nid == NUMA_NO_NODE) || (lnid == nid))
|
||||
continue;
|
||||
lnid = nid;
|
||||
|
||||
apicid = per_cpu(x86_cpu_to_apicid, cpu);
|
||||
sockid = apicid >> uv_cpuid.socketid_shift;
|
||||
|
||||
if (_socket_to_node[sockid - minsock] == SOCK_EMPTY)
|
||||
|
@ -56,7 +56,6 @@ SYM_FUNC_END(__put_user_1)
|
||||
EXPORT_SYMBOL(__put_user_1)
|
||||
|
||||
SYM_FUNC_START(__put_user_nocheck_1)
|
||||
ENDBR
|
||||
ASM_STAC
|
||||
2: movb %al,(%_ASM_CX)
|
||||
xor %ecx,%ecx
|
||||
@ -76,7 +75,6 @@ SYM_FUNC_END(__put_user_2)
|
||||
EXPORT_SYMBOL(__put_user_2)
|
||||
|
||||
SYM_FUNC_START(__put_user_nocheck_2)
|
||||
ENDBR
|
||||
ASM_STAC
|
||||
4: movw %ax,(%_ASM_CX)
|
||||
xor %ecx,%ecx
|
||||
@ -96,7 +94,6 @@ SYM_FUNC_END(__put_user_4)
|
||||
EXPORT_SYMBOL(__put_user_4)
|
||||
|
||||
SYM_FUNC_START(__put_user_nocheck_4)
|
||||
ENDBR
|
||||
ASM_STAC
|
||||
6: movl %eax,(%_ASM_CX)
|
||||
xor %ecx,%ecx
|
||||
@ -119,7 +116,6 @@ SYM_FUNC_END(__put_user_8)
|
||||
EXPORT_SYMBOL(__put_user_8)
|
||||
|
||||
SYM_FUNC_START(__put_user_nocheck_8)
|
||||
ENDBR
|
||||
ASM_STAC
|
||||
9: mov %_ASM_AX,(%_ASM_CX)
|
||||
#ifdef CONFIG_X86_32
|
||||
|
@ -19,6 +19,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
|
||||
# optimization flags.
|
||||
KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))
|
||||
|
||||
# When LTO is enabled, llvm emits many text sections, which is not supported
|
||||
# by kexec. Remove -flto=* flags.
|
||||
KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS))
|
||||
|
||||
# When linking purgatory.ro with -r unresolved symbols are not checked,
|
||||
# also link a purgatory.chk binary without -r to check for unresolved symbols.
|
||||
PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
|
||||
|
@ -2,7 +2,12 @@
|
||||
#ifndef _LINUX_INSTRUCTION_POINTER_H
|
||||
#define _LINUX_INSTRUCTION_POINTER_H
|
||||
|
||||
#include <asm/linkage.h>
|
||||
|
||||
#define _RET_IP_ (unsigned long)__builtin_return_address(0)
|
||||
|
||||
#ifndef _THIS_IP_
|
||||
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_INSTRUCTION_POINTER_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user