]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
powerpc/uaccess: Move barrier_nospec() out of allow_read_{from/write}_user()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 24 Dec 2025 11:20:49 +0000 (12:20 +0100)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 7 Jan 2026 04:01:04 +0000 (09:31 +0530)
commit5fbc09eb0b4f4b1a4b33abebacbeee0d29f195e9
tree71b38a1394fe4fb627662bc24350d5cf3df21d0f
parent9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
powerpc/uaccess: Move barrier_nospec() out of allow_read_{from/write}_user()

Commit 74e19ef0ff80 ("uaccess: Add speculation barrier to
copy_from_user()") added a redundant barrier_nospec() in
copy_from_user(), because powerpc is already calling
barrier_nospec() in allow_read_from_user() and
allow_read_write_user(). But on other architectures that
call to barrier_nospec() was missing. So change powerpc
instead of reverting the above commit and having to fix
other architectures one by one. This is now possible
because barrier_nospec() has also been added in
copy_from_user_iter().

Move barrier_nospec() out of allow_read_from_user() and
allow_read_write_user(). This will also allow reuse of those
functions when implementing masked user access which doesn't
require barrier_nospec().

Don't add it back in raw_copy_from_user() as it is already called
by copy_from_user() and copy_from_user_iter().

Fixes: 74e19ef0ff80 ("uaccess: Add speculation barrier to copy_from_user()")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/f29612105c5fcbc8ceb7303808ddc1a781f0f6b5.1766574657.git.chleroy@kernel.org
arch/powerpc/include/asm/kup.h
arch/powerpc/include/asm/uaccess.h