Skip to content

Use closer-to-native RPM building#2

Closed
BrianSipos wants to merge 12 commits into
mainfrom
ci-rpm-more-native
Closed

Use closer-to-native RPM building#2
BrianSipos wants to merge 12 commits into
mainfrom
ci-rpm-more-native

Conversation

@BrianSipos
Copy link
Copy Markdown
Collaborator

No description provided.

BrianSipos and others added 6 commits June 30, 2025 13:43
@BrianSipos BrianSipos added this to the BSL v1.0.0 milestone Jun 30, 2025
@BrianSipos BrianSipos self-assigned this Jun 30, 2025
@BrianSipos BrianSipos requested a review from a team as a code owner June 30, 2025 20:50
@BrianSipos BrianSipos added this to BSL Jun 30, 2025
@github-project-automation github-project-automation Bot moved this to Todo in BSL Jun 30, 2025
@BrianSipos BrianSipos moved this from Todo to In Progress in BSL Jul 1, 2025
@BrianSipos BrianSipos closed this Jul 9, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in BSL Jul 9, 2025
@BrianSipos BrianSipos removed this from BSL Jul 9, 2025
@BrianSipos BrianSipos removed this from the BSL v1.0.0 milestone Jul 9, 2025
iondev33 pushed a commit to iondev33/BSL that referenced this pull request Feb 26, 2026
…MOS#2)

   Bug NASA-AMMOS#2: BSL_BundleCtx_WriteBTSD must call realloc callback before write

   Problem:
   - BSL_BundleCtx_WriteBTSD was calling the write callback directly without
     first ensuring the BTSD buffer was large enough
   - When ION creates extension blocks, they start with length=1 (placeholder)
   - BSL then attempted to write 82 bytes into the 1-byte buffer
   - This caused the ION realloc callback to be called during write, but write
     had already started with insufficient buffer space

   Root Cause:
   - BSL_BundleCtx_WriteBTSD (lines 131-137) immediately called:
       return HostDescriptorTable.block_write_btsd_fn(bundle, block_num, btsd_len);
   - No buffer size check or realloc call before writing
   - The write callback would fail when attempting to write beyond allocated space

   Fix:
   - Added realloc call before write in BSL_BundleCtx_WriteBTSD (lines 138-148)
   - Check if realloc callback is registered and btsd_len > 0
   - Call block_realloc_btsd_fn to expand buffer to needed size
   - Return NULL if realloc fails (with error logging)
   - Only proceed to write if realloc succeeds

   Code:
       /* Ensure the BTSD buffer is large enough before writing */
       if (btsd_len > 0 && HostDescriptorTable.block_realloc_btsd_fn)
       {
           int realloc_result = HostDescriptorTable.block_realloc_btsd_fn(bundle,
   block_num, btsd_len);
           if (realloc_result != 0)
           {
               BSL_LOG_ERR("Failed to realloc BTSD buffer: block=%llu size=%zu
   result=%d",
                           (unsigned long long)block_num, btsd_len, realloc_result);
               return NULL;
           }
       }

   Impact:
   - BSL now properly expands BTSD buffers before writing
   - BCB encryption can now write full encrypted payloads
   - BIB can write full HMAC signatures
   - This is part of a series of fixes enabling BSL BCB encryption in ION

   Related ION integration fixes (separate ION commits):
   - Bug NASA-AMMOS#3: Fix SDR violation in ion_bsl_ReallocBTSD
   - Bug NASA-AMMOS#4: Add payload block special handling in ion_bsl_ReallocBTSD

   Test: ION tests/bpsec/bpsec-all-multinode-test.bsl
   Status: BSL operations now succeed with this fix

WIP: bpsec/bpsec-all-multinode-test.bsl not yet passing.
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