Skip to content

fuzz: posix: widen fuzz framing length to 2 bytes#10956

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part4
Open

fuzz: posix: widen fuzz framing length to 2 bytes#10956
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fuzzing/enhancement/part4

Conversation

@tmleman

@tmleman tmleman commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The fuzz harness in posix/ipc.c frames each IPC message using a length prefix at the start of the libFuzzer input buffer. Until now this prefix was a single byte multiplied by 2, encoding a maximum per-message payload of 510 bytes. That fits IPC3 (SOF_IPC_MSG_MAX_SIZE = 384) but caps IPC4 at ~12% of its 4096-byte envelope, hiding the entire large_config / vendor_config / pipeline-state-data path family from coverage feedback.

Replace the prefix with two little-endian bytes, encoding lengths up to 65535 (still clamped to SOF_IPC_MSG_MAX_SIZE - 4 in code). The remainder of the framing logic is mechanically updated to consume two header bytes per message. Introduce POSIX_FUZZ_HDR_LEN to keep header arithmetic self-documenting.

Existing IPC3 and IPC4 corpora are reinterpreted under the new header: what was previously a length byte becomes the low byte of a 16-bit length, with the next byte becoming the high byte. libFuzzer's mutation engine re-discovers productive frame shapes within minutes of running, so the corpora are kept rather than regenerated.

@tmleman tmleman requested a review from lgirdwood as a code owner June 25, 2026 10:09
Copilot AI review requested due to automatic review settings June 25, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the POSIX IPC fuzzing harness framing to use a 2-byte little-endian length prefix so libFuzzer can generate IPC messages large enough to exercise IPC4’s larger message envelope and improve coverage of large-config/vendor-config related paths.

Changes:

  • Switch fuzz input framing from a 1-byte (×2) length prefix to a 2-byte little-endian byte-count prefix.
  • Introduce POSIX_FUZZ_HDR_LEN and update header arithmetic (copy/memmove) accordingly.
  • Update the in-file protocol documentation to reflect the new framing and rationale.

Comment thread src/platform/posix/ipc.c

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmleman can you resolve the copilot comments, thanks !

@tmleman tmleman force-pushed the topic/upstream/pr/fuzzing/enhancement/part4 branch from 513d42e to b5a3c6f Compare June 26, 2026 08:35
@tmleman

tmleman commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@tmleman can you resolve the copilot comments, thanks !

Fixed

The fuzz harness in posix/ipc.c frames each IPC message using a length
prefix at the start of the libFuzzer input buffer.  Until now this
prefix was a single byte multiplied by 2, encoding a maximum per-message
payload of 510 bytes.  That fits IPC3 (SOF_IPC_MSG_MAX_SIZE = 384) but
caps IPC4 at ~12% of its 4096-byte envelope, hiding the entire
large_config / vendor_config / pipeline-state-data path family from
coverage feedback.

Replace the prefix with two little-endian bytes, encoding lengths up to
65535 (still clamped to SOF_IPC_MSG_MAX_SIZE - 4 in code).  The
remainder of the framing logic is mechanically updated to consume two
header bytes per message.  Introduce POSIX_FUZZ_HDR_LEN to keep header
arithmetic self-documenting.

Existing IPC3 and IPC4 corpora are reinterpreted under the new header:
what was previously a length byte becomes the low byte of a 16-bit
length, with the next byte becoming the high byte.  libFuzzer's mutation
engine re-discovers productive frame shapes within minutes of running,
so the corpora are kept rather than regenerated.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants