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

    <tr>
        <th>Summary</th>
        <td>
            [libc] add cmake for hardening mode
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement,
            libc
      </td>
    </tr>

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

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

<pre>
    We'd need to think about what precisely we'd want here, but I'd like to have some configuration knob for llvm-libc, for users that want additional hardening levels applied to their build.

For example, a bunch of the syscall wrappers take pointers.  If we pass these to the Linux kernel, the kernel aught to flag this. But sometimes we use/trust those pointers, and that can lead to a bad time.  As an example #86169 creates a reference from these pointers without checking for nullptr.

Should that be an LIBC_ASSERT? Should someone just enable assertions for their build of llvm-libc if they're paranoid? Do we need two different configs to distinguish between potentially expensive asserts vs hardening asserts?

This is probably worth an RFC, but filing a feature request for now.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxUVMuO4zgM_BrlQkzgyEmcHHzoxxpoYE7TA-xxQVl0pI4seUUp7vz9Qk6y3XPxgxCLVUVSyGxPnqgVu2exe11hTibE1tv-rIkxO28p8koFfW3_JiEbDZ5IQwqQjPVnQBVygtlggilSb5ncFebbyRl9AkORhHwBlRO8LWFnz1QADF4IOIwEffCDPeWIyQYPZx8UDCGCc5fxh7OqL_klkJkiQyrFFmzU2pYUdGAwavLWn8DRhRwDTpOzD6ZkI6hsnV6L6lVUT7dnFyLQJ46TWxgiqOx7A2EoGcBX7tE5mCNO01IXzwRTsD5R5DXA2wAzwYRcKBHTvRT8tD5_wpmiJ1dwS-z2B5hPJpVzg8NTcZDX8JzT4kKyI3FBzExCdilmTpBM4K-iC0uvbw706MERLgoRVPmwI60BnhjQP4SBkPVhv9kfoY-EiRgQIg0UyfcEQwzjnfyjBsw2mdLT3lB_LoYW5312bkrxD_veTcjuTkZRqfnz7fnln6f3979-_RZ1B_cDRVzwBB9FEHlUjgCZKZbW8QL_rUPF_v8bD3bpxVXIJharI_pgdcF-DcWq2yzOAbQdFk3pPktcXNGWk_WnbNmAojQTeZhCIp8sOncF-pzIs7086DBc-Nsg3YOi7r6r_m0sg2WYYlCoyrCHmExR_6t7eQz6YN2CAANhypEg0r-ZON28DPN6pdtaH-sjrqjdNJtNfdhuj3Jl2sN-qLDSen_ARktsGk39UQ0N1ZtjU--OK9vKSm6rWu42-3q7k2s6VAfayoqwr3eN0mJb0YjWrYuL6xBPK8ucqT3sd7JZOVTkeFl3Kckb9D2N5JOQUsgXIeVt32S5DGK7NELlE4tt5Swn_gJNNrnl2lgSdq9lGaEfy44UkV82jkHTKkfXmpQmFvWTkJ2Q3ckmk9W6D6OQXUG9v35MMXxQn4TsFt4sZLdQ_y8AAP__yCuZ7w">