]> git.baikalelectronics.ru Git - kernel.git/commit
fs/kernel_file_read: Add "offset" arg for partial reads
authorKees Cook <keescook@chromium.org>
Fri, 2 Oct 2020 17:38:25 +0000 (10:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Oct 2020 11:37:04 +0000 (13:37 +0200)
commit493b4358441f080bbf60370effafd02856171b33
treeebfed647c8f2a43a0967ba127c7e75df36909cba
parent7bda4a7c008de2026b0180c6cdc4f18194d50d94
fs/kernel_file_read: Add "offset" arg for partial reads

To perform partial reads, callers of kernel_read_file*() must have a
non-NULL file_size argument and a preallocated buffer. The new "offset"
argument can then be used to seek to specific locations in the file to
fill the buffer to, at most, "buf_size" per call.

Where possible, the LSM hooks can report whether a full file has been
read or not so that the contents can be reasoned about.

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20201002173828.2099543-14-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_loader/main.c
fs/kernel_read_file.c
include/linux/kernel_read_file.h
kernel/kexec_file.c
kernel/module.c
security/integrity/digsig.c
security/integrity/ima/ima_fs.c