-
Notifications
You must be signed in to change notification settings - Fork 53.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kexec runtime services #704
Closed
Closed
+3,558
−32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently only supports extremely simple apps like HelloWorld.efi * kexec.h - Added KEXEC_RUN_PE flag to be passed to kexec_load. This is the * kexec.c - Implemented kimage_load_pe, kimage_run_pe - Implemented EFI hooks to generate fake EFI system table and fake EFI boot services. - Implemented naive EFI AllocatePool, FreePool - Implemented EFI conout to enable OutputString
EFI Boot Services: efi_hook_HandleProtocol: - prints out the protocol GUID and name - implemented gEfiLoadedImageProtocolGuid - implemented gEfiDevicePathProtocolGuid EFI Protocols: gEfiLoadedImageProtocolGuid: - Respond with a fixed EFI_LOADED_IMAGE_PROTOCOL containing a fixd boot-device and fixed LoadOptions gEfiLoadedImageProtocolGuid: - Acceplts only BOOT_DEVICE_HANDLE, replies with a fixed windows_boot_device_path
windows_loaded_image needs to be patched during kimage_load_pe
* efi_setup_11_mapping: creates 1:1 mapping * efi_hook_AllocatePool: now calls efi_setup_11_mapping and returns "physical" address, thanks to the 1:1 mapping * efi_hook_FreePool: Removed call to kfree, which is incompatible with our new 1:1 mapping
* efi_register_mem_allocation: register new memory allocation * efi_unregister_allocation: reclaim memory and make it EfiConventionalMemory * efi_hook_GetMemoryMap: get current memory mappings The current bookkepping is naive and incorrect. TODO: 1. When allocating memory, we should seearch if blocks of EfiConventionalMemory are available for allocation. 2. When registerring memory, we might need to split a block of EfiConventionalMemory 3. When unregistering memory, we need to potentially coalsce blocks of EfiConventionalMemory.
This os a preparation for smarter management of mem maps.
Windows loader sets up interrupts 0x3, 0x2C, 0x2D to empty interrupt handlers. A good fix in the future would be to make the page temporarily.
Also refactored CHAR16 to char conversion function
…them. Implemented the following functions: * efi_hook_LocateHandle: implemented only for gEfiBlockIoProtocolGuid. Returning 4 devices: raw-hard-drive and partitions 1,2,3. * efi_handle_protocol_DevicePath: implemented for the 4 devices mentioned above * efi_handle_protocol_BlockIO: Returns the proper EFI_BLOCK_IO_PROTOCOL, depending on the handle provided. Implemented Read/write callbacks whcih print log msg to screen and return an erro code. * efi_hook_CloseProtocol: empty implementation (log and return success)
see efi_block_io_read_blocks
This ensures Windows loader can access these addresses
This is crucial to support Windows loader replacing CR3 with its own page table
This is required to allow Winload.efi to access the system table. * Allocate memory in a 1:1 mapped area * Print the memory map after every memory allocation.
This is important so that the system table and other structures can be accessible when Windows loader (either bootmg or Winload.efi) try to access them via a Windows page table.
laoder: * fake_systab * fake_systab->con_out * efi_config_table * runtime_services
… memory. Also making sure the memory map is sorted
Passing the original EFI runtime services via the system table. * Areas marked "reserved" in e820 map are marked EfiRuntimeServicesCode, as they contain runtime code. * Modified InternalSerialPuts to be a MACRO * Refactored memory mapping functions
fengguang
pushed a commit
to 0day-ci/linux
that referenced
this pull request
Aug 26, 2020
Use helper bpf_redirect_map() and bpf_redirect_map_multi() to test bpf arg ARG_CONST_MAP_PTR and ARG_CONST_MAP_PTR_OR_NULL. Make sure the map arg could be verified correctly when it is NULL or valid map pointer. Add devmap and devmap_hash in struct bpf_test due to bpf_redirect_{map, map_multi} limit. Test result: ]# ./test_verifier 702 705 torvalds#702/p ARG_CONST_MAP_PTR: null pointer OK torvalds#703/p ARG_CONST_MAP_PTR: valid map pointer OK torvalds#704/p ARG_CONST_MAP_PTR_OR_NULL: null pointer for ex_map OK torvalds#705/p ARG_CONST_MAP_PTR_OR_NULL: valid map pointer for ex_map OK Summary: 4 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
fengguang
pushed a commit
to 0day-ci/linux
that referenced
this pull request
Sep 3, 2020
Use helper bpf_redirect_map() and bpf_redirect_map_multi() to test bpf arg ARG_CONST_MAP_PTR and ARG_CONST_MAP_PTR_OR_NULL. Make sure the map arg could be verified correctly when it is NULL or valid map pointer. Add devmap and devmap_hash in struct bpf_test due to bpf_redirect_{map, map_multi} limit. Test result: ]# ./test_verifier 702 705 torvalds#702/p ARG_CONST_MAP_PTR: null pointer OK torvalds#703/p ARG_CONST_MAP_PTR: valid map pointer OK torvalds#704/p ARG_CONST_MAP_PTR_OR_NULL: null pointer for ex_map OK torvalds#705/p ARG_CONST_MAP_PTR_OR_NULL: valid map pointer for ex_map OK Summary: 4 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
fengguang
pushed a commit
to 0day-ci/linux
that referenced
this pull request
Sep 7, 2020
Use helper bpf_redirect_map() and bpf_redirect_map_multi() to test bpf arg ARG_CONST_MAP_PTR and ARG_CONST_MAP_PTR_OR_NULL. Make sure the map arg could be verified correctly when it is NULL or valid map pointer. Add devmap and devmap_hash in struct bpf_test due to bpf_redirect_{map, map_multi} limit. Test result: ]# ./test_verifier 702 705 torvalds#702/p ARG_CONST_MAP_PTR: null pointer OK torvalds#703/p ARG_CONST_MAP_PTR: valid map pointer OK torvalds#704/p ARG_CONST_MAP_PTR_OR_NULL: null pointer for ex_map OK torvalds#705/p ARG_CONST_MAP_PTR_OR_NULL: valid map pointer for ex_map OK Summary: 4 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now reaching phase 4 of Windows loading. Using original EFI runtime services