Skip to content

Accept USB descriptor extensions and verify endpoint reloads. - #135

Merged
jon merged 1 commit into
mainfrom
work/audit-r47-accept-legal-descriptor-extensions-and-reload-en
Nov 2, 2026
Merged

jon merged 1 commit into
mainfrom
work/audit-r47-accept-legal-descriptor-extensions-and-reload-en

Conversation

@jon

@jon jon commented Nov 2, 2026

Copy link
Copy Markdown
Owner

USB configuration inspection now accepts legal trailing bytes in standard descriptors and zero-bandwidth isochronous endpoints. It still rejects short defined prefixes, inconsistent configuration lengths and zero-size bulk endpoints. Linux tests also verify endpoint reload after a successful alternate selection, including replacement of a previously cached endpoint set.

The call remains device.ActiveConfiguration(ctx): descriptors longer than their defined prefixes previously failed; the same call now retains the defined fields and advances by each returned length. A zero-bandwidth isochronous alternate can report a zero maximum packet size. This changes descriptor inspection, without claiming an isochronous transfer backend.

Likewise, after claim.SetAltSetting(1) succeeds, claim.Endpoint(ctx, address) reloads the selected alternate’s endpoints without another GET_INTERFACE. Tests check the new endpoint, rejection of the old endpoint, both fresh and previously populated caches, and complete interface/device cleanup. Retain the claim and device under the existing cleanup rules when selection or release fails.

Why

USB 2.0 sections 9.5 and 5.6.3 require hosts to tolerate descriptor extensions and permit default isochronous settings without reserved payload bandwidth. Exact-length and nonzero-payload checks rejected those descriptors before an adapter could inspect the configuration. The parser now consumes the known fields and ignores trailing bytes while preserving descriptor and buffer bounds.

The Linux endpoint reload path already retained a successful alternate selection, but had no test that distinguished a reload from a stale cache or an unnecessary interface query. The added tests exercise that path through the USB owner.

Documentation

The Linux USB guide describes descriptor prefixes, zero-bandwidth alternates and endpoint reload. The architecture guide and USB attachment comment now describe the existing location comparison as lexicographic: 10:2 precedes 2:1 among equal serials. Location formatting and runtime ordering are unchanged. These tests add no physical validation claim.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T02:15:11.471089Z fc919c4 Manual request
🔒 Security Review ✅ Completed 2026-11-02T02:04:29.620096Z 7331722 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jon

jon commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 73317226a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from work/audit-r46-handle-disappearing-linux-attachments-and-large to main November 2, 2026 02:10
Standard descriptors with legal trailing bytes were rejected, as were
zero-bandwidth isochronous endpoints. Parse each defined prefix and
advance by the returned length, retaining short-prefix rejection and
consistent configuration lengths across reads. Keep bulk payload
requirements while allowing zero-bandwidth periodic descriptors.

Exercise Linux endpoint reload after alternate selection, including a
previously cached alternate and the known-selection path. Describe the
existing lexicographic USB location ordering without changing its
representation or runtime comparison.
@jon
jon force-pushed the work/audit-r47-accept-legal-descriptor-extensions-and-reload-en branch from 7331722 to fc919c4 Compare November 2, 2026 02:13
@jon

jon commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: fc919c4625

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jon
jon merged commit cec835e into main Nov 2, 2026
9 checks passed
@jon
jon deleted the work/audit-r47-accept-legal-descriptor-extensions-and-reload-en branch November 2, 2026 02:30
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.

1 participant