]> www.infradead.org Git - users/jedix/linux-maple.git/commit
powerpc/vdso: Fix VDSO data access when running in a non-root time namespace
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Fri, 6 Sep 2024 08:33:43 +0000 (10:33 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 13 Sep 2024 15:28:36 +0000 (17:28 +0200)
commitc73049389e58c01e2e3bbfae900c8daeee177191
treebac26c60c30c643cba8c970b77972ce4cfedfa8c
parent8bc7c5e525584903ea83332e18a2118ed3b1985e
powerpc/vdso: Fix VDSO data access when running in a non-root time namespace

When running in a non-root time namespace, the global VDSO data page
is replaced by a dedicated namespace data page and the global data
page is mapped next to it. Detailed explanations can be found at
commit 660fd04f9317 ("lib/vdso: Prepare for time namespace support").

When it happens, __kernel_get_syscall_map and __kernel_get_tbfreq
and __kernel_sync_dicache don't work anymore because they read 0
instead of the data they need.

To address that, clock_mode has to be read. When it is set to
VDSO_CLOCKMODE_TIMENS, it means it is a dedicated namespace data page
and the global data is located on the following page.

Add a macro called get_realdatapage which reads clock_mode and add
PAGE_SIZE to the pointer provided by get_datapage macro when
clock_mode is equal to VDSO_CLOCKMODE_TIMENS. Use this new macro
instead of get_datapage macro except for time functions as they handle
it internally.

Fixes: 74205b3fc2ef ("powerpc/vdso: Add support for time namespaces")
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Closes: https://lore.kernel.org/all/ZtnYqZI-nrsNslwy@zx2c4.com/
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
arch/powerpc/include/asm/vdso_datapage.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/vdso/cacheflush.S
arch/powerpc/kernel/vdso/datapage.S