+++ /dev/null
-/** @file\r
- Base Stack Check library for GCC/clang.\r
-\r
- Use -fstack-protector-all compiler flag to make the compiler insert the\r
- __stack_chk_guard "canary" value into the stack and check the value prior\r
- to exiting the function. If the "canary" is overwritten __stack_chk_fail()\r
- is called. This is GCC specific code.\r
-\r
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.\r
- Copyright (c) 2012, Apple Inc. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <Base.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-/// "canary" value that is inserted by the compiler into the stack frame.\r
-VOID *__stack_chk_guard = (VOID *)0x0AFF;\r
-\r
-// If ASLR was enabled we could use\r
-// void (*__stack_chk_guard)(void) = __stack_chk_fail;\r
-\r
-/**\r
- Error path for compiler generated stack "canary" value check code. If the\r
- stack canary has been overwritten this function gets called on exit of the\r
- function.\r
-**/\r
-VOID\r
-__stack_chk_fail (\r
- VOID\r
- )\r
-{\r
- UINT8 DebugPropertyMask;\r
-\r
- DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow at 0x%p.\n", RETURN_ADDRESS (0)));\r
-\r
- //\r
- // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings even if\r
- // BaseDebugLibNull is in use.\r
- //\r
- DebugPropertyMask = PcdGet8 (PcdDebugPropertyMask);\r
- if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
- CpuBreakpoint ();\r
- } else if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
- CpuDeadLoop ();\r
- }\r
-}\r
+++ /dev/null
-## @file\r
-# Stack Check Library\r
-#\r
-# Stack Check Library\r
-#\r
-# Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
-#\r
-# SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BaseStackCheckLib\r
- MODULE_UNI_FILE = BaseStackCheckLib.uni\r
- FILE_GUID = 5f6579f7-b648-4fdb-9f19-4c17e27e8eff\r
- MODULE_TYPE = BASE\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = NULL\r
-\r
-\r
-#\r
-# VALID_ARCHITECTURES = ARM AARCH64\r
-#\r
-\r
-[Sources]\r
- BaseStackCheckGcc.c | GCC\r
- BaseStackCheckNull.c | MSFT\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- DebugLib\r
-\r
-[Pcd]\r
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES\r
+++ /dev/null
-// /** @file\r
-// Stack Check Library\r
-//\r
-// Stack Check Library\r
-//\r
-// Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
-//\r
-// SPDX-License-Identifier: BSD-2-Clause-Patent\r
-//\r
-// **/\r
-\r
-\r
-#string STR_MODULE_ABSTRACT #language en-US "Stack Check Library"\r
-\r
-#string STR_MODULE_DESCRIPTION #language en-US "Stack Check Library"\r
-\r
\r
[Components.ARM, Components.AARCH64]\r
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf\r
- MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf\r
MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf\r
\r
[Components.RISCV64]\r