CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
81 lines
2.2 KiB
ArmAsm
81 lines
2.2 KiB
ArmAsm
//===-- hwasan_setjmp_x86_64.S --------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// setjmp interceptor for x86_64.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "sanitizer_common/sanitizer_asm.h"
|
|
|
|
#if HWASAN_WITH_INTERCEPTORS && defined(__x86_64__)
|
|
#include "sanitizer_common/sanitizer_platform.h"
|
|
|
|
// We want to save the context of the calling function.
|
|
// That requires
|
|
// 1) No modification of the return address by this function.
|
|
// 2) No modification of the stack pointer by this function.
|
|
// 3) (no modification of any other saved register, but that's not really going
|
|
// to occur, and hence isn't as much of a worry).
|
|
//
|
|
// There's essentially no way to ensure that the compiler will not modify the
|
|
// stack pointer when compiling a C function.
|
|
// Hence we have to write this function in assembly.
|
|
//
|
|
// TODO: Handle Intel CET.
|
|
|
|
.section .text
|
|
.file "hwasan_setjmp_x86_64.S"
|
|
.att_syntax
|
|
|
|
.global ASM_WRAPPER_NAME(setjmp)
|
|
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(setjmp))
|
|
ASM_WRAPPER_NAME(setjmp):
|
|
CFI_STARTPROC
|
|
_CET_ENDBR
|
|
xorl %esi, %esi
|
|
jmp .Linterceptor_sigsetjmp
|
|
CFI_ENDPROC
|
|
ASM_SIZE(ASM_WRAPPER_NAME(setjmp))
|
|
|
|
.global ASM_WRAPPER_NAME(sigsetjmp)
|
|
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(sigsetjmp))
|
|
ASM_WRAPPER_NAME(sigsetjmp):
|
|
.Linterceptor_sigsetjmp:
|
|
CFI_STARTPROC
|
|
_CET_ENDBR
|
|
|
|
// Save callee save registers.
|
|
mov %rbx, (0*8)(%rdi)
|
|
mov %rbp, (1*8)(%rdi)
|
|
mov %r12, (2*8)(%rdi)
|
|
mov %r13, (3*8)(%rdi)
|
|
mov %r14, (4*8)(%rdi)
|
|
mov %r15, (5*8)(%rdi)
|
|
|
|
// Save SP as it was in caller's frame.
|
|
lea 8(%rsp), %rdx
|
|
mov %rdx, (6*8)(%rdi)
|
|
|
|
// Save return address.
|
|
mov (%rsp), %rax
|
|
mov %rax, (7*8)(%rdi)
|
|
|
|
jmp __sigjmp_save
|
|
|
|
CFI_ENDPROC
|
|
ASM_SIZE(ASM_WRAPPER_NAME(sigsetjmp))
|
|
|
|
ASM_INTERCEPTOR_TRAMPOLINE(sigsetjmp)
|
|
ASM_TRAMPOLINE_ALIAS(__sigsetjmp, sigsetjmp)
|
|
ASM_INTERCEPTOR_TRAMPOLINE(setjmp)
|
|
ASM_TRAMPOLINE_ALIAS(_setjmp, setjmp)
|
|
#endif
|
|
|
|
// We do not need executable stack.
|
|
NO_EXEC_STACK_DIRECTIVE
|