mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
6b974e9e29
Since kernel version 4.12 the GDT as seen by SGDT is only an r/o alias mapping located at a fixed address not backed by a dedicated kernel memory allocation. Later kernels moved it further to the "cpu entry area", yet another alias mapping. All, just to mitigate all too easy kernel address leaking in the name of KASLR. Anyhow, the fact that these virtual addresses have no 'struct page' attached prevents us from using virt_to_phys() to resolve its physical address. A full software page table walk is required instead. Luckily, slow_virt_to_phys() does just that. It was introduced in kernel v3.9 so covers all affected kernels. This fixes github issue #608. While at it, extend the switch block to reject invalid descriptor code arguments to not operate on uninitialized descriptor. Signed-off-by: Mathias Krause <minipli@grsecurity.net>