<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154818>154818</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[rtsan] Missing parameter in ioctl call in unit test
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wolfy1961
</td>
</tr>
</table>
<pre>
The rtsan unit test _rtsan_test_interceptors_posix.cpp_ makes a call to ioctl with the request FIONREAD on line 756:
`auto Func = [this]() { ioctl(GetOpenFd(), FIONREAD); };`
This is causing problems because this call requires a third parameter, a pointer to an int, pointing to where the requested bytecount is written to. The parameter is not optional, so when it's missing, we're getting random behavior. We have seen some memory corruption happening in our test runs as a result.
The obvious fix would create some redundancy with the next test which is also calling ioctl with FIONREAD (this time with the 3rd parameter), so I'm not sure if the right thing is to delete this test or just fix it.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxUU8GO6zYM_Br5QjzDlu3YPviwaZriHdoHFA_oMZBtJuZWllyJSjZ_X0hJN9tTYhKaIWc4ynu6GMRBNHvRHDIVeLFuuFl9vpf9rsxGO9-HnwuCY68MBEMMjJ7hlAqn-P9EhtFNuLF1_rRZTx_5tG0nWNXf6EHBpLQGtkB2Yg034gU4QuI_IUIdv__4489f3w5gDWgyCG2zE9WbKN7ErlCBLRyDmUBUBxDNnhfyojkI2QnZg2j3D1ghu9-Qf2xojvOjJ-Qvn9Dxs9qDaA-i2otdEbGLt58LeSAPkwqezAU2Z0eNq4cRYwkhcj2mj7OSS9vwQm6GTTm1IqOLNAo2m0SIWyoDZDiWUzECs4Xbgg6_ro0zjHfGyQbDcYibI2Y0wDaHKPgnQWway2A3JmuUjsg-ARogFrL1sJKPC8TODYVsHcIFOVE7ZWa7woiLupJ1OfyFsKgrgkc04O2KsOJq3R0m61xIHLCobUMTn5MBG9zDcheMBxUlcOiD5vw_FRHseCUbPJzpA2426Bkmh4rxQeBwDmZWZrq_zDf48byk20LTEpdU2tukdiJ-3crnfQjZJUeYVnwhVf93o3_q813Idk3C-eAQ6PwQny4LRwsjhY_GzKiRn1aneayD9-A57UKcZ_NQzX3VqwyHsm2arijLTmbL0Ekp21mirHZj3ffVuajHptyNXTvLrt7VGQ2ykE3RybLsqqqQed_XZ1m3ddftZNFiK-oCV0U61_q65tZdMvI-4FA2dVd2mVYjap-iKaXBG6SukDIm1Q3x0bcxXLyoC02e_QuGiXXKdAqpaA7w--NCvl6VeWqc7pu-ZDsLTg8L8-ZjCuVRyOOFeAljPtlVyGOkef5825x9x4mFPKbhvJDH5_TXQf4bAAD__zvoeAM">