Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inital StackCookie implementation for MSVC AARCH64 #1221

Draft
wants to merge 1 commit into
base: dev/202405
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
;------------------------------------------------------------------------------
; AARCH64/StackCheckFunctionsMsvc.nasm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
; AARCH64/StackCheckFunctionsMsvc.nasm
; AARCH64/StackCheckFunctionsMsvc.asm

;
; Copyright (c) Microsoft Corporation.
; SPDX-License-Identifier: BSD-2-Clause-Patent
;------------------------------------------------------------------------------

EXPORT __report_rangecheckfailure
EXPORT __GSHandlerCheck
EXPORT __security_check_cookie
EXPORT __security_push_cookie
EXPORT __security_pop_cookie

AREA |.text|, CODE, READONLY

;------------------------------------------------------------------------------
; Calls an interrupt using the vector specified by PcdStackCookieExceptionVector
;
; VOID
; TriggerStackCookieInterrupt (
; VOID
; );
;------------------------------------------------------------------------------
__report_rangecheckfailure PROC
RET
__report_rangecheckfailure ENDP

;------------------------------------------------------------------------------
; Calls an interrupt using the vector specified by PcdStackCookieExceptionVector
;
; VOID
; __GSHandlerCheck (
; VOID
; );
;------------------------------------------------------------------------------
__GSHandlerCheck PROC
RET
__GSHandlerCheck ENDP

;------------------------------------------------------------------------------
; Checks the stack cookie value against passed __security_cookie. Take
; appropiate action on a mismatch (stack smashed case)
;
; VOID
; EFIAPI
; __security_check_cookie (
; IN UINTN CheckValue
; );
;------------------------------------------------------------------------------
__security_check_cookie PROC
RET
__security_check_cookie ENDP


;------------------------------------------------------------------------------
; Pop the cookie off the stack (recommended in 16 bytes)
;
; VOID
; __security_push_cookie (
; VOID
; );
;------------------------------------------------------------------------------
__security_pop_cookie PROC
RET
__security_pop_cookie ENDP


;------------------------------------------------------------------------------
; Push a Security Cookie onto the stack (recommended is 16 bytes)
;
; VOID
; __security_push_cookie (
; VOID
; );
;------------------------------------------------------------------------------
__security_push_cookie PROC
RET
__security_push_cookie ENDP

END
3 changes: 3 additions & 0 deletions MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
[Sources.X64]
X64/StackCheckFunctionsMsvc.nasm | MSFT

[Sources.AARCH64]
AARCH64/StackCheckFunctionsMsvc.asm | MSFT

[Packages]
MdePkg/MdePkg.dec

Expand Down
Loading