Skip to content
  • Gary Hook's avatar
    x86/mm/mem_encrypt: Disable all instrumentation for early SME setup · f037116f
    Gary Hook authored
    [ Upstream commit b51ce374 ]
    
    Enablement of AMD's Secure Memory Encryption feature is determined very
    early after start_kernel() is entered. Part of this procedure involves
    scanning the command line for the parameter 'mem_encrypt'.
    
    To determine intended state, the function sme_enable() uses library
    functions cmdline_find_option() and strncmp(). Their use occurs early
    enough such that it cannot be assumed that any instrumentation subsystem
    is initialized.
    
    For example, making calls to a KASAN-instrumented function before KASAN
    is set up will result in the use of uninitialized memory and a boot
    failure.
    
    When AMD's SME support is enabled, conditionally disable instrumentation
    of these dependent functions in lib/string.c and arch/x86/lib/cmdline.c.
    
     [ bp: Get rid of intermediary nostackp var and cleanup whitespace. ]
    
    Fixes: aca20d54 ("x86/mm: Add support to make use of Secure Memory Encryption")
    Reporte...
    f037116f