函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_file.c Create Date:2022-07-27 12:05:33
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:In file mode list of segments is prepared by kernel. Copy relevant* data from user space, do error checking, prepare segment list

函数原型:static int kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, const char __user *cmdline_ptr, unsigned long cmdline_len, unsigned flags)

返回类型:int

参数:

类型参数名称
struct kimage *image
intkernel_fd
intinitrd_fd
const char __user *cmdline_ptr
unsigned longcmdline_len
unsignedflags
246  ret等于kernel_read_file_from_fd(kernel_fd, & Additional fields for file based kexec syscall , & size, INT_MAX, READING_KEXEC_IMAGE)
248  如果ret则返回:ret
250  kernel_buf_len等于size
253  ret等于Architectures can provide this probe function
255  如果ret则转到:out
265  如果非flags按位与KEXEC_FILE_NO_INITRAMFS的值则
266  ret等于kernel_read_file_from_fd(initrd_fd, & initrd_buf, & size, INT_MAX, READING_KEXEC_INITRAMFS)
269  如果ret则转到:out
271  initrd_buf_len等于size
274  如果cmdline_len
275  cmdline_buf等于memdup_user(cmdline_ptr, cmdline_len)
276  如果是错误
277  ret等于错误
278  cmdline_buf = NULL
279  转到:out
282  cmdline_buf_len等于cmdline_len
285  如果cmdline_buf[cmdline_len - 1]不等于'\0'则
286  ret等于负EINVAL
287  转到:out
290  ima_kexec_cmdline(cmdline_buf, cmdline_buf_len - 1)
295  ima_add_kexec_buffer(image)
298  ldata等于arch_kexec_kernel_image_load(image)
300  如果是错误
301  ret等于错误
302  转到:out
305  Image loader handling the kernel can store a pointer here 等于ldata
306  out :
308  如果retFree up memory used by kernel, initrd, and command line. This is temporary* memory allocation which is not needed any more after these buffers have* been loaded into separate segments and have been copied elsewhere.
310  返回:ret
调用者
名称描述
kimage_file_alloc_init