llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[UBSan] Runtime Executable Only violation hit when checking the function pointer on an execute-only target.

Open MaggieYingYi opened this issue 3 years ago • 10 comments

An execute-only target disallows data access to code sections.

The commit rG279a4d causes the generated code to read text section data which is not allowed on an execute-only target.

When enabling the function sanitizer (-fsanitize=function), UBSan function signatures and type hashes are emitted within the function's prologue data to check the function type. This results in the non-execute access and a runtime error.

MaggieYingYi avatar Aug 23 '23 13:08 MaggieYingYi

@llvm/issue-subscribers-clang-driver

llvmbot avatar Aug 23 '23 13:08 llvmbot

@llvm/issue-subscribers-clang-frontend

llvmbot avatar Aug 23 '23 13:08 llvmbot

D158614 is created for code review.

MaggieYingYi avatar Aug 23 '23 13:08 MaggieYingYi

/cherry-pick 9ef536a12ea65a2b9e2511936327c7b621af38fb

MaskRay avatar Aug 31 '23 02:08 MaskRay

/branch llvm/llvm-project-release-prs/issue64931

llvmbot avatar Aug 31 '23 02:08 llvmbot

/pull-request llvm/llvm-project-release-prs#671

llvmbot avatar Aug 31 '23 02:08 llvmbot

/cherry-pick 9ef536a12ea65a2b9e2511936327c7b621af38fb d26dd681f9726ed7d43d7c0bdd8ee3cb2db69a2b 39f6a31eaa665b1a01305346092ed69f4b9f940a c7dce0283b5b502dacd47eb1488342a31f4ed35a

MaskRay avatar Aug 31 '23 03:08 MaskRay

/branch llvm/llvm-project-release-prs/issue64931

llvmbot avatar Aug 31 '23 03:08 llvmbot

release/17.x does not contain -### exit code change in clang/lib/Driver (https://reviews.llvm.org/D156363).

Here is a modified fix:

/branch MaskRay/llvm-project/17.x-mexecute-only

MaskRay avatar Aug 31 '23 17:08 MaskRay

I merged your branch manually @MaskRay

tru avatar Sep 01 '23 06:09 tru