]> Git Repo - linux.git/commit
RISC-V: use memcpy for kexec_file mode
authorLiao Chang <[email protected]>
Fri, 8 Apr 2022 10:09:10 +0000 (18:09 +0800)
committerPalmer Dabbelt <[email protected]>
Thu, 19 May 2022 18:53:41 +0000 (11:53 -0700)
commitb7fb4d78a6ade6026d9e5cf438c2a46ab962e032
tree7511f5ce3a8ffff190131edb850c0f64b475efee
parent4853f68d158ac59b05985a6af5b7da7ccdbc14c8
RISC-V: use memcpy for kexec_file mode

The pointer to buffer loading kernel binaries is in kernel space for
kexec_fil mode, When copy_from_user copies data from pointer to a block
of memory, it checkes that the pointer is in the user space range, on
RISCV-V that is:

static inline bool __access_ok(unsigned long addr, unsigned long size)
{
return size <= TASK_SIZE && addr <= TASK_SIZE - size;
}

and TASK_SIZE is 0x4000000000 for 64-bits, which now causes
copy_from_user to reject the access of the field 'buf' of struct
kexec_segment that is in range [CONFIG_PAGE_OFFSET - VMALLOC_SIZE,
CONFIG_PAGE_OFFSET), is invalid user space pointer.

This patch fixes this issue by skipping access_ok(), use mempcy() instead.

Signed-off-by: Liao Chang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
arch/riscv/kernel/machine_kexec.c
This page took 0.055733 seconds and 4 git commands to generate.