Skip to content

merge main -> release 2026-07-08 18:15 - #379

Merged
bputzeys merged 3 commits into
releasefrom
main
Jul 9, 2026
Merged

merge main -> release 2026-07-08 18:15#379
bputzeys merged 3 commits into
releasefrom
main

Conversation

@oriolpetithelical

@oriolpetithelical oriolpetithelical commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • fix(security): set DataLoader pin_memory explicitly to avoid undefined pinning

Trail of Bits' Semgrep rule automatic-memory-pinning (CWE-676) flags torch.utils.data.DataLoader calls that leave pin_memory unset, since the pinning behaviour is then implicit. Explicitly gate pinning on GPU availability across all 27 DataLoader call sites:

pin_memory=torch.cuda.is_available()

This pins host memory only when a CUDA device is present (faster, async host->GPU copies) and avoids wasting scarce page-locked memory on CPU-only machines. Previously-hardcoded pin_memory=True sites (scgpt, tahoe, transcriptformer) are unified to the same predicate so they no longer pin unconditionally on CPU-only runs.

Refs: trailofbits.python.automatic-memory-pinning

… pinning) (#378)

* fix(security): set DataLoader pin_memory explicitly to avoid undefined pinning

Trail of Bits' Semgrep rule `automatic-memory-pinning` (CWE-676) flags
`torch.utils.data.DataLoader` calls that leave `pin_memory` unset, since
the pinning behaviour is then implicit. Explicitly gate pinning on GPU
availability across all 27 DataLoader call sites:

    pin_memory=torch.cuda.is_available()

This pins host memory only when a CUDA device is present (faster, async
host->GPU copies) and avoids wasting scarce page-locked memory on
CPU-only machines. Previously-hardcoded `pin_memory=True` sites
(scgpt, tahoe, transcriptformer) are unified to the same predicate so
they no longer pin unconditionally on CPU-only runs.

Refs: trailofbits.python.automatic-memory-pinning
@oriolpetithelical oriolpetithelical self-assigned this Jul 8, 2026
@oriolpetithelical
oriolpetithelical requested review from bputzeys and maxiallard and removed request for maxiallard July 8, 2026 16:15
@oriolpetithelical oriolpetithelical changed the title fix(security): set DataLoader pin_memory explicitly (automatic memory… merge main -> release 2026-07-08 18:15 Jul 8, 2026
@bputzeys
bputzeys merged commit c392983 into release Jul 9, 2026
11 checks passed
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.

2 participants