Skip to content
  1. Apr 10, 2023
  2. Apr 07, 2023
  3. Apr 06, 2023
    • Ard Biesheuvel's avatar
      UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version · 3e3be2cb
      Ard Biesheuvel authored
      
      
      This library is no longer used or needed, so let's remove it.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarRay Ni <ray.ni@intel.com>
      3e3be2cb
    • Ard Biesheuvel's avatar
      OvmfPkg: Drop special Xcode5 version of exception handler library · 68c89b98
      Ard Biesheuvel authored
      
      
      The generic and XCODE5 versions of this library are now identical, so
      drop the special case. The library will be removed entirely in a
      subsequent patch.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Acked-by: default avatarJiewen Yao <jiewen.yao@intel.com>
      68c89b98
    • Ard Biesheuvel's avatar
      UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only · e5fcaeb1
      Ard Biesheuvel authored
      
      
      The CPU exception handler library code was rewritten at some point to
      populate the vector code templates with absolute references at runtime,
      given that the XCODE linker does not permit absolute references in
      executable code when creating PIE executables.
      
      This is rather unfortunate, as this prevents us from using strict
      permissions on the memory mappings, given that the .text section needs
      to be writable at runtime for this arrangement to work.
      
      So let's make this hack XCODE-only, by setting a preprocessor #define
      from the command line when using the XCODE toolchain, and only including
      the runtime fixup code when the macro is defined.
      
      While at it, rename the Xcode5ExceptionHandlerAsm.nasm source file and
      drop the Xcode5 prefix: this code is used by other toolchains too.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarRay Ni <ray.ni@intel.com>
      e5fcaeb1
    • Ard Biesheuvel's avatar
      UefiCpuPkg/PeiCpuExceptionHandlerLib: Use SEC/PEI specific asm component · 4764aa50
      Ard Biesheuvel authored
      
      
      The PEI flavor of CpuExceptionHandlerLib never populates more than 32
      IDT vectors, and there is no CET shadow stack support in the PEI phase.
      So there is no need to use the generic ExceptionHandler NASM source,
      which carries a 256-entry template and CET support, and writes to its
      own .text section when built using XCODE, which is not permitted in the
      PEI phase. So let's switch to the reduced SEC/PEI version of this
      component, which is sufficient for PEI and doesn't suffer from the same
      issue.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarRay Ni <ray.ni@intel.com>
      4764aa50
    • Ard Biesheuvel's avatar
      UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version · 95f03309
      Ard Biesheuvel authored
      
      
      Currently, we use the non-Xcode5 version of ExceptionHandlerAsm.nasm
      only for the SEC and PEI phases, and this version was not compatible
      with the XCODE or LLD linkers, which do not permit absolute relocations
      in read-only sections.
      
      Given that SEC and PEI code typically executes in place from flash and
      does not use page alignment for sections, we can simply emit the code
      carrying the absolute symbol references into the .data segment instead.
      This works around the linker's objections, and the resulting image will
      be mapped executable in its entirety anyway. Since this is only needed
      for XCODE, let's make this change conditionally using a preprocessor
      macro.
      
      Let's rename the .nasm file to reflect the fact that is used for the
      SecPei flavor of this library only, and while at it, remove some
      unnecessary absolute references.
      
      Also update the Xcode specific version of this library, and use this
      source file instead. This is necesessary, as the Xcode specific version
      modifies its own code at runtime, which is not permitted in SEC or PEI.
      Note that this also removes CET support from the Xcode5 specific build
      of the SEC/PEI version of this library, but this is not needed this
      early in any case, and this aligns it with other toolchains, which use
      this version of the library, which does not have CET support either.
      
      1. Change for non-XCODE SecPeiCpuExceptionHandlerLib:
      . Use SecPeiExceptionHandlerAsm.nasm (renamed from
        ExceptionHandlerAsm.nasm)
      . Removed some unnecessary absolute references
        (32 IDT stubs are still in .text.)
      
      2. Change for XCODE SecPeiCpuExceptionHandlerLib:
      . Use SecPeiExceptionHandlerAsm.nasm instead of
        Xcode5ExceptionHandlerAsm.nasm
      . CET logic is not in SecPeiExceptionHandlerAsm.nasm (but aligns to
        non-XCODE lib instance)
      . Fixed a bug that does runtime fixup in TEXT section in SPI flash.
      . Emitted the code carrying the absolute symbol references into the
        .data which XCODE or LLD linkers allow.
      . Then fixup can be done by other build tools such as GenFv if the code
        runs in SPI flash, or by PE coff loader if the code is loaded to
        memory.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarRay Ni <ray.ni@intel.com>
      95f03309
    • Ard Biesheuvel's avatar
      BaseTools/tools_def CLANGDWARF: Permit text relocations · a257988f
      Ard Biesheuvel authored
      
      
      We rely on PIE executables to get the codegen that is suitable for
      PE/COFF conversion where the resulting executables can be loaded
      anywhere in the address space.
      
      However, ELF linkers may default to disallowing text relocations in PIE
      executables, as this would require text segments to be updated at
      runtime, which is bad for security and increases the copy-on-write
      footprint of ELF executables and shared libraries.
      
      However, none of those concerns apply to PE/COFF executables in the
      context of EFI, which are copied into memory rather than mmap()'ed, and
      fixed up by the loader before launch.
      
      So pass -z notext to the LLD linker to permit runtime relocations in
      read-only sections.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarRebecca Cran <rebecca@bsdio.com>
      a257988f
    • Rebecca Cran's avatar
      BaseTools: Update antlr makefile to use cc by default · 8d185dfb
      Rebecca Cran authored
      
      
      Update the antlr makefile to remove the explicit setting of CC to either
      clang or gcc. This causes it to use /usr/bin/cc or whatever the user has
      set $(CC) to.
      
      This removes the last dependency on gcc for BaseTools.
      
      Signed-off-by: default avatarRebecca Cran <rebecca@bsdio.com>
      Reviewed-by: default avatarLiming Gao <gaoliming@byosoft.com.cn>
      8d185dfb
  4. Apr 05, 2023
  5. Apr 04, 2023
  6. Apr 03, 2023
  7. Apr 02, 2023
  8. Apr 01, 2023
Loading