Skip to content

Commit

Permalink
BaseStackCheckLib: Fix STACK FAULT message
Browse files Browse the repository at this point in the history
__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 <jake@nvidia.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
References: tianocore#50
Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/3041199
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-sw-mobile-l4t <svc-sw-mobile-l4t@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
  • Loading branch information
jgarver authored and mobile promotions committed Dec 28, 2023
1 parent 534a28a commit a2ddf14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a2ddf14

Please sign in to comment.