mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
efi_selftest: Enhance LoadImage test
Check that only a file system installed on a handle for the
device-path node immediately preceding the file path node is
used for LoadImage().
LoadImage() ends up invoking efi_dp_find_obj(). This test helped to
demonstrate an issue in a suggested patch to change that function.
The test can be run with:
setenv efi_selftest load image from file
bootefi selftest
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
@@ -125,6 +125,44 @@ static struct {
|
||||
}
|
||||
};
|
||||
|
||||
/* Incorrect file device path */
|
||||
static struct {
|
||||
struct efi_device_path_vendor vendor;
|
||||
struct efi_device_path_controller ctrl;
|
||||
struct efi_device_path path;
|
||||
u16 file[sizeof(FILE_NAME)];
|
||||
struct efi_device_path end;
|
||||
} __packed dp_file2 = {
|
||||
.vendor = {
|
||||
.dp = {
|
||||
.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE,
|
||||
.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR,
|
||||
.length = sizeof(struct efi_device_path_vendor),
|
||||
},
|
||||
.guid = EFI_GUID(0x4f9a0ebf, 0xa179, 0x88a6, 0x25, 0x68,
|
||||
0x10, 0x72, 0xb1, 0x93, 0x51, 0x71),
|
||||
},
|
||||
.ctrl = {
|
||||
.dp = {
|
||||
.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE,
|
||||
.sub_type = DEVICE_PATH_SUB_TYPE_CONTROLLER,
|
||||
.length = sizeof(struct efi_device_path_controller),
|
||||
},
|
||||
.controller_number = 1,
|
||||
},
|
||||
.path = {
|
||||
.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,
|
||||
.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,
|
||||
.length = sizeof(struct efi_device_path) + sizeof(dp_file.file),
|
||||
},
|
||||
.file = FILE_NAME,
|
||||
.end = {
|
||||
.type = DEVICE_PATH_TYPE_END,
|
||||
.sub_type = DEVICE_PATH_SUB_TYPE_END,
|
||||
.length = sizeof(struct efi_device_path),
|
||||
}
|
||||
};
|
||||
|
||||
/* File system info */
|
||||
static struct file_system_info priv_file_system_info = {
|
||||
{
|
||||
@@ -517,6 +555,13 @@ static int execute(void)
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
|
||||
ret = boottime->load_image(false, handle_image, &dp_file2.vendor.dp,
|
||||
NULL, 0, &handle);
|
||||
if (ret == EFI_SUCCESS) {
|
||||
efi_st_error("Invalid file path accepted\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
|
||||
return EFI_ST_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user