The pmap_pti_add_kva_locked function truncates the starting address and
rounds up to PAGE_SIZE the end address, thus passing etext is bogous,
since it overlaps with the start of rodata, see the example bellow.
objdump -d kernel before this patch:
... ffffffff808fff54: 41 5f pop %r15 ffffffff808fff56: 5d pop %rbp ffffffff808fff57: c3 retq <- etext Disassembly of section .rodata: ffffffff808fff60 <cam_status_table-0x570>: <- rodata ffffffff808fff60: 43 rex.XB ffffffff808fff61: 43 rex.XB ...
and after:
... ffffffff808fff54: 41 5f pop %r15 ffffffff808fff56: 5d pop %rbp ffffffff808fff57: c3 retq <- etext Disassembly of section .rodata: ffffffff80900000 <cam_status_table-0x570>: <- rodata ffffffff80900000: 43 rex.XB ffffffff80900001: 43 rex.XB ...
Obtained from: opBSD