From a2ddf14b2f8319ed2e43a4b4bacfe6441cae4b79 Mon Sep 17 00:00:00 2001 From: Jake Garver Date: Thu, 5 Oct 2023 09:18:31 -0700 Subject: [PATCH] BaseStackCheckLib: Fix STACK FAULT message __builtin_return_address returns a pointer, not a string. Fix the STACK FAULT message in BaseStackCheckLib appropriately. Jira TEGRAUEFI-3005 Change-Id: Iff5c9a88c4481083487bbdedc4dcdfab5310849e Signed-off-by: Jake Garver Reviewed-by: Liming Gao References: #50 Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/3041199 Reviewed-by: svcacv Reviewed-by: svc-mobile-coverity Reviewed-by: svc-sw-mobile-l4t GVS: Gerrit_Virtual_Submit --- MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c index 0d2918668e238..ea168841b617d 100644 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c +++ b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c @@ -6,6 +6,7 @@ to exiting the function. If the "canary" is overwritten __stack_chk_fail() is called. This is GCC specific code. + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. Copyright (c) 2012, Apple Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -34,7 +35,7 @@ __stack_chk_fail ( { UINT8 DebugPropertyMask; - DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow in function %a.\n", __builtin_return_address (0))); + DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow at 0x%p.\n", RETURN_ADDRESS (0))); // // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings even if