File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -598,13 +598,35 @@ static void kexec_mark_crashkres(bool protect)
598
598
kexec_mark_range (control , crashk_res .end , protect );
599
599
}
600
600
601
+ /* make the memory storing dm crypt keys in/accessible */
602
+ static void kexec_mark_dm_crypt_keys (bool protect )
603
+ {
604
+ unsigned long start_paddr , end_paddr ;
605
+ unsigned int nr_pages ;
606
+
607
+ if (kexec_crash_image -> dm_crypt_keys_addr ) {
608
+ start_paddr = kexec_crash_image -> dm_crypt_keys_addr ;
609
+ end_paddr = start_paddr + kexec_crash_image -> dm_crypt_keys_sz - 1 ;
610
+ nr_pages = (PAGE_ALIGN (end_paddr ) - PAGE_ALIGN_DOWN (start_paddr ))/PAGE_SIZE ;
611
+ if (protect )
612
+ set_memory_np ((unsigned long )phys_to_virt (start_paddr ), nr_pages );
613
+ else
614
+ __set_memory_prot (
615
+ (unsigned long )phys_to_virt (start_paddr ),
616
+ nr_pages ,
617
+ __pgprot (_PAGE_PRESENT | _PAGE_NX | _PAGE_RW ));
618
+ }
619
+ }
620
+
601
621
void arch_kexec_protect_crashkres (void )
602
622
{
603
623
kexec_mark_crashkres (true);
624
+ kexec_mark_dm_crypt_keys (true);
604
625
}
605
626
606
627
void arch_kexec_unprotect_crashkres (void )
607
628
{
629
+ kexec_mark_dm_crypt_keys (false);
608
630
kexec_mark_crashkres (false);
609
631
}
610
632
#endif
You can’t perform that action at this time.
0 commit comments