<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [CFI] Pointer-to-member-function calls are uninstrumented."
href="https://bugs.llvm.org/show_bug.cgi?id=35350">35350</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[CFI] Pointer-to-member-function calls are uninstrumented.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mitchphillips@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>icalls made through the pointer-to-member-function operators (both operator.*
and operator->*) are uninstrumented by CFI, meaning that the virtual call is
unprotected.
As a conservative estimate, this bug is causing ~15% (2,608 individual
instructions) of total "unexpected unprotected" indirect control flow
instructions in the Chrome browser.
This problem is easily revealed by llvm-cfi-verify. See below for a minimised
testcase:
$ clang++ -flto -fsanitize=cfi -fvisibility=hidden -g a.cc
$ llvm-cfi-verify a.out
U [FAIL_BAD_CONDITIONAL_BRANCH] 0x4005b5 | callq *%rax
0x4005b5 = /tmp/a.cc:8:3 (main)
Expected Protected: 0 (0.00%)
Unexpected Protected: 0 (0.00%)
Expected Unprotected: 0 (0.00%)
Unexpected Unprotected (BAD): 1 (100.00%)
$ cat a.cc
struct A {
virtual void f() {}
};
int main() {
A a;
void (A::* ptr)() = &A::f;
(a.*ptr)(); // Unprotected by cfi.
}
$ objdump -d a.out
<..snip..>
4005a3: 74 0d je 4005b2 <main+0x52>
4005a5: 48 8b 0b mov (%rbx),%rcx
4005a8: 48 83 e8 01 sub $0x1,%rax
4005ac: 48 8b 04 01 mov (%rcx,%rax,1),%rax
4005b0: eb 00 jmp 4005b2 <main+0x52>
4005b2: 48 89 df mov %rbx,%rdi
4005b5: ff d0 callq *%rax
4005b7: 8b 45 f4 mov -0xc(%rbp),%eax
4005ba: 48 83 c4 28 add $0x28,%rsp
<..snip..></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>