<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [ASan] False alarm to recv/recvfrom"
   href="https://llvm.org/bugs/show_bug.cgi?id=27673">27673</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ASan] False alarm to recv/recvfrom
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>laszio@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>ASan checks the return value of real recv/recvfrom to see if the written bytes
fit in the buffer:

<a href="https://github.com/llvm-mirror/compiler-rt/commit/c06094fbd7e254dc8ebf03f02d0e9935896829fe">https://github.com/llvm-mirror/compiler-rt/commit/c06094fbd7e254dc8ebf03f02d0e9935896829fe</a>

That works fine most of time. However, there is an exception: (from the RECV(2)
man page)

MSG_TRUNC (since Linux 2.2)
    ... return the real length of the packet or datagram, even when it was
longer than the passed buffer. ...

Some programs combine MSG_TRUNK, MSG_PEEK and a single-byte buffer to peek the
incoming data size without reading (much of) them. In this case, the return
value is usually longer than what's been written and ASan raises a false alarm
here.</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>