<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55944>55944</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
File system capabilities break leak sanitizer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wintersteiger
</td>
</tr>
</table>
<pre>
Not sure whether this is an actual bug or just an unexpected consequence, but it would be good to get an experts opinion:
When I use `setcap` to give my binary permission to bind to privileged ports, the leak sanitizer throws a fatal error.
For example:
```
... $ cat setcapleakchk.cpp
int main() { return 1; }
... $ clang++-15 -o setcapleakchk setcapleakchk.cpp -fsanitize=leak
... $ sudo setcap CAP_NET_BIND_SERVICE=+eip setcapleakchk
... $ ./setcapleakchk
==2203001==LeakSanitizer has encountered a fatal error.
==2203001==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==2203001==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
```
The suggested environment variable settings make no difference and it works as intended without the `setcap` command. Tested with clang 10 and 15:
```
... $ clang++-10 --version
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
... $ clang++-15 --version
Ubuntu clang version 15.0.0-++20220530092253+14cc4674bf5a-1~exp1~20220530092306.267
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VU1v4zYQ_TXyZSBBkvVhH3xI4gQ1sPAuGm97NChpLHMtkypJ2U5_fR_lZBvvBuheCgsSySHfvBm-GVe6eVmstSM7GKbznt2eDbm9tIRHKBK1G0RH1dCSNvRtsM6vDoovPdeOG6q1svzXwKrmIH3ARkfS0VkPXUMVU6t1Q05Ty-NBf8w4S7qXSmoVTO-CeBnEr-8_96xoRYNlCorYsqtFj8F4Xp6Yji9USSXMCwH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