<html>
<head>
<base href="https://bugs.dpdk.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - __rte_trace_mem_get causing out of bounds write"
href="https://bugs.dpdk.org/show_bug.cgi?id=1665">1665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__rte_trace_mem_get causing out of bounds write
</td>
</tr>
<tr>
<th>Product</th>
<td>DPDK
</td>
</tr>
<tr>
<th>Version</th>
<td>24.11
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>Normal
</td>
</tr>
<tr>
<th>Component</th>
<td>other
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dev@dpdk.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oleksandrn@interfacemasters.com
</td>
</tr>
<tr>
<th>Target Milestone</th>
<td>---
</td>
</tr></table>
<p>
<div class="bz_comment_block">
<pre class="bz_comment_text">When almost out of trace memory, __rte_trace_mem_get can write out of bounds.
It happens in my case if I have trace events of sizes that are not aligned to
__RTE_TRACE_EVENT_HEADER_SZ. like 27,33 etc.
I suspect that the issue is with the incorrect bounds check in
__rte_trace_mem_get.
<span class="quote">> uint32_t offset = trace->offset;
> if (unlikely((offset + sz) >= trace->len)) { // assume condition is false,
> and offset is not aligned
> ...}
> offset = RTE_ALIGN_CEIL(offset, __RTE_TRACE_EVENT_HEADER_SZ); // after
> offset alignment offset + size might be bigger than trace->len
> void *mem = RTE_PTR_ADD(&trace->mem[0], offset); // returning memory chunk
> that is smaller than requested size</span >
For example:
offset = 21, len = 32, size = 9 -> offset + size is smaller than len
align offset to __RTE_TRACE_EVENT_HEADER_SZ -> offset = 24
offset + size is bigger than len.
</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1665">
<meta itemprop="name" content="View bug">
</div>
<meta itemprop="description" content="Bugzilla bug update notification">
</div>
</body>
</html>