1. 08 Mar, 2024 1 commit
  2. 28 Feb, 2024 1 commit
  3. 13 Feb, 2024 1 commit
  4. 07 Feb, 2024 1 commit
  5. 06 Feb, 2024 1 commit
    • Ard Biesheuvel's avatar
      x86/sev: Fix position dependent variable references in startup code · 1c811d40
      Ard Biesheuvel authored
      The early startup code executes from a 1:1 mapping of memory, which
      differs from the mapping that the code was linked and/or relocated to
      run at. The latter mapping is not active yet at this point, and so
      symbol references that rely on it will fault.
      
      Given that the core kernel is built without -fPIC, symbol references are
      typically emitted as absolute, and so any such references occuring in
      the early startup code will therefore crash the kernel.
      
      While an attempt was made to work around this for the early SEV/SME
      startup code, by forcing RIP-relative addressing for certain global
      SEV/SME variables via inline assembly (see snp_cpuid_get_table() for
      example), RIP-relative addressing must be pervasively enforced for
      SEV/SME global variables when accessed prior to page table fixups.
      
      __startup_64() already handles this issue for select non-SEV/SME global
      variables using fixup_pointer(), which adjusts the pointer relative to a
      `physaddr` argument. To avoid having to pass around this `physaddr`
      argument across all functions needing to apply pointer fixups, introduce
      a macro RIP_RELATIVE_REF() which generates a RIP-relative reference to
      a given global variable. It is used where necessary to force
      RIP-relative accesses to global variables.
      
      For backporting purposes, this patch makes no attempt at cleaning up
      other occurrences of this pattern, involving either inline asm or
      fixup_pointer(). Those will be addressed later.
      
        [ bp: Call it "rip_rel_ref" everywhere like other code shortens
          "rIP-relative reference" and make the asm wrapper __always_inline. ]
      Co-developed-by: default avatarKevin Loughlin <kevinloughlin@google.com>
      Signed-off-by: default avatarKevin Loughlin <kevinloughlin@google.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/all/20240130220845.1978329-1-kevinloughlin@google.com
      1c811d40
  6. 03 Feb, 2024 2 commits
  7. 02 Feb, 2024 1 commit
  8. 29 Jan, 2024 29 commits
  9. 28 Jan, 2024 3 commits