-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededtests
Milestone
Description
The tests load_aout_direct
and load_elf_direct
only check the return values of the load functions:
bhyve-multiboot/tests/test-multiboot.c
Lines 214 to 228 in 63cc3d7
/* Load a kernel with a valid a.out kludge */ | |
ATF_CHECK(fread(random_buffer, 128*kiB, 1, urandom)); | |
mbh = (struct multiboot_header* )(random_buffer + 2*kiB); | |
mbh->magic = MULTIBOOT1_MAGIC; | |
mbh->flags = 0 | MULTIBOOT_AOUT_KLUDGE; | |
mbh->checksum = (uint32_t) 0U-MULTIBOOT1_MAGIC-(mbh->flags); | |
mbh->header_addr = 1*MiB; | |
mbh->load_addr = 1*MiB; | |
mbh->load_end_addr = 1*MiB + 0x100; | |
mbh->bss_end_addr = 1*MiB + 0x200; | |
mbh->entry_addr = 1*MiB + sizeof(struct multiboot_header); | |
mb = mb_scan(random_buffer, 128*kiB); | |
error = multiboot_load_aout(random_buffer, 128*kiB, mbh); | |
ATF_CHECK_EQ_MSG(0, error, "multiboot_load_aout failed"); |
bhyve-multiboot/tests/test-multiboot.c
Lines 302 to 306 in 63cc3d7
mb = mb_scan(kernel, kernsz); | |
mbh = mb->info.mb.header; | |
multiboot_load_type(kernel, kernsz, &kernelf, mbh); | |
error = multiboot_load_elf(kernel, kernsz, kernelf); | |
ATF_CHECK_EQ_MSG(0, error, "multiboot_load_elf failed"); |
Instead they should also verify that copyin
actually copied something. Probably the best idea is to
- implement a function to get the
lowmem_buffer
andhighmem_buffer
pointers frommock_bhyveload.c
- then use memcmp() to verify that the appropriate parts were actually loaded
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededtests