<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 - Failure to enqueue packets for cryptodev-scheduler_multicore can lead to program crashes"
   href="https://bugs.dpdk.org/show_bug.cgi?id=1537">1537</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure to enqueue packets for cryptodev-scheduler_multicore can lead to program crashes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>22.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>critical
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cryptodev
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev@dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>1269690261@qq.com
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class="bz_comment_block">
          <pre class="bz_comment_text">Created <span class=""><a href="attachment.cgi?id=288" name="attach_288" title="Incorrect Variable Usage">attachment 288</a> <a href="attachment.cgi?id=288&action=edit" title="Incorrect Variable Usage">[details]</a></span>
Incorrect Variable Usage

Failure Scenario:
   The `cryptodev` scheduler is running in Multi-core mode, with OpenSSL PMD
attached as workers.
   When a batch of packets to be enqueued contains invalid encrypted ESP
(Encapsulating Security Payload) packets, the program crashes.



---------------------------------
Specific Issues:
1. Incorrect Variable Usage:
   - The variable `pending_deq_ops` was incorrectly used instead of
`pending_enq_ops`. This leads to failed condition checks and prevents the
`scheduler_retrieve_session` function from executing. Consequently, the content
of the `op->sym->session` variable becomes abnormal, causing the program to
crash when the OpenSSL PMD accesses this variable.
2. Lack of Exception Handling:
   - There is no handling for exceptional cases when enqueuing packets. When
invalid packets are enqueued, the `rte_cryptodev_enqueue_burst` function always
returns a value of `processed_ops` that is less than `pending_enq_ops`, leading
the program into an infinite retry loop.



--------------------------------
Resolution Suggestions:
1. Correct Variable Usage:
   - In the faulty code, replace `pending_deq_ops` with `pending_enq_ops`.

2. Documentation Update:
   - Add documentation stating that packets should always be added to the
processed operations queue in the worker PMD.

   - Alternatively, implement a maximum retry count check to prevent the
program from entering an infinite retry loop.
          </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=1537">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>