lowRISC / lowRISC/opentitan

[dv/dpi] TCP server enters infinite loop if ring buffer is full

Open
#24,616 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

Description

The rptr and wptr variables here are missing volatile, so GCC will optimize the while loop in tcp_server_put_byte to a branch and an infinite loop when compiling with -O2. as you can see in this godbolt link.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in hw/dv/dpi/common/tcp_server/tcp_server.c at the rptr and wptr declarations and tcp_server_put_byte. Reproduce or inspect the -O2 behavior using the linked Godbolt example, then verify that the ring-buffer-full loop observes pointer updates and no longer becomes infinite.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.