linux/fs/ecryptfs
Fabio M. De Francesco e2393b8f39 fs/ecryptfs: Use kmap_local_page() in copy_up_encrypted_with_header()
kmap_atomic() has been deprecated in favor of kmap_local_page().

Therefore, replace kmap_atomic() with kmap_local_page() in
ecryptfs_copy_up_encrypted_with_header().

kmap_atomic() is implemented like a kmap_local_page() which also
disables page-faults and preemption (the latter only in !PREEMPT_RT
kernels). The kernel virtual addresses returned by these two API are
only valid in the context of the callers (i.e., they cannot be handed to
other threads).

With kmap_local_page() the mappings are per thread and CPU local like
in kmap_atomic(); however, they can handle page-faults and can be called
from any context (including interrupts). The tasks that call
kmap_local_page() can be preempted and, when they are scheduled to run
again, the kernel virtual addresses are restored and are still valid.

In ecryptfs_copy_up_encrypted_with_header(), the block of code between
the mapping and un-mapping does not depend on the above-mentioned side
effects of kmap_aatomic(), so that the mere replacements of the old API
with the new one is all that is required (i.e., there is no need to
explicitly call pagefault_disable() and/or preempt_disable()).

Tested in a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel with
HIGHMEM64GB enabled.

Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Message-Id: <20230426172223.8896-4-fmdefrancesco@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2023-07-10 14:36:10 +02:00
..
crypto.c fs/ecryptfs: Replace kmap() with kmap_local_page() 2023-07-10 14:36:10 +02:00
debug.c ecryptfs: debug: Demote a couple of kernel-doc abuses 2021-04-19 04:42:13 +00:00
dentry.c ecryptfs: dentry: File headers are not good candidates for kernel-doc 2021-04-19 04:42:13 +00:00
ecryptfs_kernel.h ecryptfs: constify path 2022-09-01 17:40:38 -04:00
file.c splice: Use filemap_splice_read() instead of generic_file_splice_read() 2023-05-24 08:42:17 -06:00
inode.c fs: drop unused posix acl handlers 2023-03-06 09:57:12 +01:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
keystore.c ecryptfs: keystore: Fix some kernel-doc issues and demote non-conformant headers 2021-04-19 04:42:13 +00:00
kthread.c ecryptfs: kthread: Demote file header and provide description for 'cred' 2021-04-19 04:42:13 +00:00
main.c ecryptfs: constify path 2022-09-01 17:40:38 -04:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
messaging.c eCryptfs: Use DEFINE_MUTEX() for mutex lock 2021-04-19 04:42:13 +00:00
miscdev.c ecryptfs: miscdev: File headers are not good kernel-doc candidates 2021-04-19 04:42:13 +00:00
mmap.c fs/ecryptfs: Use kmap_local_page() in copy_up_encrypted_with_header() 2023-07-10 14:36:10 +02:00
read_write.c fs/ecryptfs: Use kmap_local_page() in ecryptfs_write() 2023-07-10 14:36:10 +02:00
super.c fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00