← Back to Pull requests

NR gNB MAC: read only the Buffer Size fields present in a Long BSR #1044

Open
unknown opened this pull request with 199 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 09, 2026 13:44 UTC
Author

estimate_ul_buffer_long_bsr() reads one Buffer Size octet for every LCGi bit set in the bitmap, without looking at the length L of the MAC CE.

TS 38.321 §6.1.3.1: in a Long Truncated BSR (used by UEs for padding BSRs), LCGi = 1 indicates that the LCG has data available, but the number of Buffer Size fields is bounded by the available space ("maximised, while not exceeding the number of padding bits"). There can therefore be fewer Buffer Size fields than bits set in the bitmap. The gNB read the subsequent octets (typically padding 0x3f) as buffer sizes, causing massive UL over-granting. Additionally, a Long BSR with L = 0 at the end of a PDU caused reads beyond the PDU buffer.

Changes:

  • Pass the MAC CE length to estimate_ul_buffer_long_bsr() and only read Buffer Size fields present within the CE bounds (m < num_bs).

  • If a Long BSR has mac_len == 0 (no bitmap octet), log an error and skip processing rather than reading out-of-bounds.

  • LCGs flagged without a corresponding Buffer Size field add nothing to the estimate (since no size was reported).
  • Tested:

    Evaluated estimate_ul_buffer_long_bsr() on Long Truncated BSR test cases before and after the fix:

    | MAC CE (followed by padding 0x3f) | Expected | develop | This PR |
    |---|---|---|---|
    | Long BSR, LCG0+LCG1, BS indexes 10, 20 (L = 3) | 58 | 58 | 58 |
    | Long Truncated BSR, LCG0+LCG1, one BS index 10 (L = 2) | 20 | 580 | 20 |
    | Long Truncated BSR, all LCGs, no BS field (L = 1) | 0 | 4480 | 0 |

    Built with ASan+UBSan (aarch64) with no new warnings; all gNB MAC unit tests (test_nr_mac_gnb) pass.

    Diff: 199 lines (+149 / -50) across 2 files Reviewer: antcybersec Review duration: 11607m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 199 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.317
    Real PR Conversation Timeline
    1 comments
    "Review active on #1044"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.3% · Safe to merge
    19.3%