Hello, thank you for your contribution in this project, I an testing our static analysis tool in github's Rust project and I notice the following code:
fn jmp64(entry_addr: u64) -> ! {
unsafe {
llvm_asm!(
"pushl $$0x10
pushl %eax
movl %ebx, %eax
movl %eax, %cr0
lret"
: : "{eax}"(entry_addr), "{ebx}"((1 << 31) | (1 << 0)) "{esi}"(0x7C00) :
);
unreachable_unchecked();
}
}
I think there is a unsound problem because this function doesn't varify the entry_addr is valid and pass it to asm. It will trigger UB. Although it is a private function, I notice a possible way to call this function from a pub function start_kernel.
// 函数: start_kernel
pub fn start_kernel(entry_addr: u64) -> ! {
setup_gdt();
enable_pae();
setup_page_tables();
enable_paging();
jmp64(entry_addr);
}
Hello, thank you for your contribution in this project, I an testing our static analysis tool in github's Rust project and I notice the following code:
I think there is a unsound problem because this function doesn't varify the
entry_addris valid and pass it to asm. It will trigger UB. Although it is a private function, I notice a possible way to call this function from a pub functionstart_kernel.