passing kmap_local_page() result to __kernel_write() is unsafe -
random ->write_iter() might (and 9p one does) get unhappy when
passed ITER_KVEC with pointer that came from kmap_local_page().
Fix by providing a variant of __kernel_write() that takes an iov_iter
from caller (__kernel_write() becomes a trivial wrapper) and adding
dump_emit_page() that parallels dump_emit(), except that instead of
__kernel_write() it uses __kernel_write_iter() with ITER_BVEC source.
Fixes: 3159ed57792b "fs/coredump: use kmap_local_page()"
Signed-off-by: Al Viro <email address hidden>
Signed-off-by: Sasha Levin <email address hidden>
Signed-off-by: Kamal Mostafa <email address hidden>
Confirmed that reverting this commit fixes the issue
commit 1c64ee93e442926 be20205b5659499 cfd405bff0
Author: Al Viro <email address hidden>
Date: Mon Sep 26 11:59:14 2022 -0400
don't use __kernel_write() on kmap_local_page()
BugLink: https:/ /bugs.launchpad .net/bugs/ 1994078
[ Upstream commit 06bbaa6dc53cb72 040db9520534325 41acb9adc7 ]
passing kmap_local_page() result to __kernel_write() is unsafe -
random ->write_iter() might (and 9p one does) get unhappy when
passed ITER_KVEC with pointer that came from kmap_local_page().
Fix by providing a variant of __kernel_write() that takes an iov_iter emit_page( ) that parallels dump_emit(), except that instead of write() it uses __kernel_ write_iter( ) with ITER_BVEC source.
from caller (__kernel_write() becomes a trivial wrapper) and adding
dump_
__kernel_
Fixes: 3159ed57792b "fs/coredump: use kmap_local_page()"
Signed-off-by: Al Viro <email address hidden>
Signed-off-by: Sasha Levin <email address hidden>
Signed-off-by: Kamal Mostafa <email address hidden>