VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/StackCheckLib/StackCheckLibCommonMsvc.c@ 108794

Last change on this file since 108794 was 108794, checked in by vboxsync, 2 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1/** @file
2 Provides the required functionality for handling stack
3 cookie check failures for MSVC.
4
5 Copyright (c) Microsoft Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7**/
8
9#include <Base.h>
10
11#include <Library/DebugLib.h>
12#include <Library/BaseLib.h>
13#include <Library/StackCheckLib.h>
14#include <Library/StackCheckFailureHookLib.h>
15
16/**
17 Triggers an interrupt using the vector specified by PcdStackCookieExceptionVector
18**/
19VOID
20TriggerStackCookieInterrupt (
21 VOID
22 );
23
24VOID *__security_cookie = (VOID *)(UINTN)STACK_COOKIE_VALUE;
25
26/**
27 This function gets called when an MSVC generated stack cookie fails. This implementation calls into a platform
28 failure hook lib and then triggers the stack cookie interrupt.
29
30 @param[in] ActualCookieValue The value that was written onto the stack, corrupting the stack cookie.
31
32**/
33VOID
34StackCheckFailure (
35 VOID *ActualCookieValue
36 )
37{
38 DEBUG ((DEBUG_ERROR, "Stack cookie check failed at address 0x%llx!\n", RETURN_ADDRESS (0)));
39 StackCheckFailureHook (RETURN_ADDRESS (0));
40 TriggerStackCookieInterrupt ();
41}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette