linux-stable/arch/x86/entry/vdso
Kirill A. Shutemov 1b8b1aa90c x86/mm: Fix VDSO and VVAR placement on 5-level paging machines
Yingcong has noticed that on the 5-level paging machine, VDSO and VVAR
VMAs are placed above the 47-bit border:

8000001a9000-8000001ad000 r--p 00000000 00:00 0                          [vvar]
8000001ad000-8000001af000 r-xp 00000000 00:00 0                          [vdso]

This might confuse users who are not aware of 5-level paging and expect
all userspace addresses to be under the 47-bit border.

So far problem has only been triggered with ASLR disabled, although it
may also occur with ASLR enabled if the layout is randomized in a just
right way.

The problem happens due to custom placement for the VMAs in the VDSO
code: vdso_addr() tries to place them above the stack and checks the
result against TASK_SIZE_MAX, which is wrong. TASK_SIZE_MAX is set to
the 56-bit border on 5-level paging machines. Use DEFAULT_MAP_WINDOW
instead.

Fixes: b569bab78d ("x86/mm: Prepare to expose larger address space to userspace")
Reported-by: Yingcong Wu <yingcong.wu@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20230803151609.22141-1-kirill.shutemov%40linux.intel.com
2023-08-09 13:38:48 -07:00
..
vdso32 x86/vdso: Fake 32bit VDSO build on 64bit compile for vgetcpu 2023-02-07 18:20:41 +01:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
checkundef.sh
extable.c x86/vdso: Add support for exception fixup in vDSO functions 2020-11-18 18:02:50 +01:00
extable.h x86/vdso: Add support for exception fixup in vDSO functions 2020-11-18 18:02:50 +01:00
Makefile vdso: Improve cmd_vdso_check to check all dynamic relocations 2023-03-21 21:15:34 +01:00
vclock_gettime.c y2038: vdso: change time_t to __kernel_old_time_t 2019-11-15 14:38:28 +01:00
vdso-layout.lds.S x86: Remove .fixup section 2021-12-11 09:09:50 +01:00
vdso-note.S x86: Add build salt to the vDSO 2018-07-18 01:18:05 +09:00
vdso.lds.S x86/vdso: Conditionally export __vdso_sgx_enter_enclave() 2022-12-09 14:58:02 +01:00
vdso2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_385.RULE 2022-06-10 14:51:36 +02:00
vdso2c.h x86/vdso: Move VDSO image init to vdso2c generated code 2023-01-25 12:33:40 +01:00
vdso32-setup.c x86: Simplify one-level sysctl registration for abi_table2 2023-03-22 11:47:21 -07:00
vdsox32.lds.S x86/vdso: Switch to generic vDSO implementation 2019-06-22 21:21:10 +02:00
vgetcpu.c x86/vdso: Include vdso/processor.h 2023-05-18 11:56:18 -07:00
vma.c x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-09 13:38:48 -07:00
vsgx.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00