git: kernel - Fix efivar panic

Matthew Dillon dillon at crater.dragonflybsd.org
Thu May 28 23:54:00 PDT 2020


commit 8d2aaeec20170c5188010f1b7bfbc1684364c84b
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu May 28 22:41:32 2020 -0700

    kernel - Fix efivar panic
    
    * The efirt driver uses direct-map mode, and creates an independent
      pmap to hold it.  The direct map typically uses userspace addresses,
      so SMAP must be disabled across any EFI call.
    
    * Add smap_open(), smap_close(), smap_smep_disable(), and
      smap_smep_enable() calls for C.
    
      NOTE: We also have to set pcb_onfault to non-NULL to bypass failsafe
    	checks done in trap().
    
    * Hack the EFI address space code to disable SMAP and SMEP across
      the EFI call.  Unfortunately since we also have to disable SMEP,
      these functions have to manipulate CR4.
    
    Reported-by: daftaupe

Summary of changes:
 sys/cpu/x86_64/include/cpufunc.h   |  2 ++
 sys/platform/pc64/x86_64/efirt.c   |  5 +++++
 sys/platform/pc64/x86_64/pmap.c    | 42 ++++++++++++++++++++++++++++++++++++++
 sys/platform/pc64/x86_64/support.s | 10 +++++++++
 sys/platform/pc64/x86_64/trap.c    |  2 ++
 sys/vm/pmap.h                      |  2 ++
 6 files changed, 63 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/8d2aaeec20170c5188010f1b7bfbc1684364c84b


-- 
DragonFly BSD source repository


More information about the Commits mailing list