<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64931>64931</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [UBSan] Runtime Executable Only violation hit when checking the function pointer on an execute-only target.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:driver,
            clang:frontend,
            compiler-rt:ubsan
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MaggieYingYi
      </td>
    </tr>
</table>

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

The commit [rG279a4d](https://reviews.llvm.org/rG279a4d0d67c874e80c171666822f2fabdd6fa926) 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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U02P4zYM_TXyhUjg0N8HHzKbpqeiQLtFsUfaom21shRIdLLTX1_YSToTtOjFhkSKfO_xkWI0o2NuVfGmilNCi0w-tD_ROBr-Ztz4zSSd1-_t0QF_534R3nln30EojCygTSRr_S2CJiGgvucYQTz0XjNE7sV4F_cqPan0eP9-nRh6P89GQBVv4UesGsq1Kk4K60nkElV2VHhWeA58NXyLe2uv896Hcb16pKe6rPq6yrlO-0N1KMuyRhxwoE7rcqAGS4UN9LREjiATw8iOAwnrOzLxEJg0CH-XJ8w7hdtk-glMBOcFNm6swTug_xTghdnvEztgR501bty6Dou7l47kjJi_OIDCejc8jyo7PVMUNgq_wG9vv5L79M6MjmQJHIGcBnm_MEwUp_UcGHg2snK6GZmMe2mpsIpwCd76ceE7tXUsE_d_vkJba-7h62QiBI6LlQiPUs673YPzc7IrCIKwODEzA4fgwz7RbaabrKGE20PZYNUUVYbJ1OblYUBM0ybXfa7TrKirjgtirHKqso4T02KKWVpjdshSTJt9rYu07oa8OCAPXaNVnvJMxv5jgcTEuHBb5k12SCx1bONmXcTekhtVdtTBXDkoRIVfPl0PwTthpz8Cfr4Yy2EXRGXHpYvk1lhxSkK7dtt1yxhVnloT5cOCiRix27Zsg1LFCX55iPHDphR1luHn1SBX4y1tCk9G4LZ6Y1P_X964eOOEw_-YLFmCbV93YzQyLd2-97PC84ru8dtdgv-De1F43qSKCs-bWn8HAAD__9t1UTI">