$ the-wire · showcase
torch.load weights_only arbitrary file read; tensordict cleanup fixes land
By RepoJournal · Filed · About PyTorch · Composed from the cited sources · methodology
A torch.load(weights_only=True) arbitrary-file-read flaw leads the wire, with tensordict shipping a batch of memory-leak and stack-overflow fixes underneath.
torch.load(weights_only=True) allows arbitrary file read pytorch/pytorch
The safe-loading path in torch.load does not prevent arbitrary file reads, so weights_only=True does not by itself make an untrusted checkpoint safe to open. Treat checkpoints from outside your trust boundary as untrusted input until a fix lands.
[BugFix] Free a locked tensordict whose nested keys were listed when it is dropped pytorch/tensordict
A locked TensorDict whose nested keys were listed stayed alive until a full garbage collection: keys(True), keys(leaves_only=True) and td.depth all triggered it, and lock_(), memmap_() and share_memory_() return locked tensordicts. On an L40S, a loop moving a 64 MiB batch and listing nested keys peaked far above what the batch alone needs.
[BugFix] Free the buffer of a consolidated tensordict when it is dropped pytorch/tensordict
Dropping a consolidated tensordict in a loop held its buffer until the garbage collector ran, so the loop accumulated many batches at once; on a 45 GiB GPU, moving a 3 GiB consolidated tensordict to device hit CUDA out-of-memory in the 15th iteration. The fix frees the buffer on drop for td.consolidate(), consolidated.to(device), unpickling and TensorDict.from_consolidated(file).
[BugFix] Let Ctrl-C, sys.exit() and generator.close() pass through a with-block on a tensordict pytorch/tensordict
Ctrl-C, sys.exit(), asyncio cancellation or closing a generator inside a with block on a tensordict raised RuntimeError ("Converting a tensordict to boolean value is not permitted") in place of the original exception. Affected blocks include to_module(module), lock_(), unlock_() and flatten_keys(); the original exception now propagates.
[symm_mem] Check the IPC socket path length before bind (#204252) pytorch/pytorch
IpcChannel wrote $TMPDIR/symm_mem-<pid> into the 108-byte sockaddr_un.sun_path with no length check, so a long TMPDIR wrote past the stack array and produced a segfault or a bind failure that leaked the socket fd. make_socket_addr() now rejects a path that does not fit with its NUL and tells you to set a shorter TMPDIR.
[Performance] consolidate() copies padded leaves and the leaves of a slice once, not twice pytorch/tensordict
consolidate() copied twice on padded leaves (any float32, int32, float16 or bool leaf with an odd element count) and on leaves that do not start at the beginning of their storage, such as td[1:] or unbind(0)[i], costing double the time and peak memory. Both cases now copy once.
[rl] Train on image prompts, with a Geometry3K recipe (#5825) pytorch/torchtitan
torchtitan's RL path extends to image prompts end to end, from the rollout stack through the vLLM generator, with a Geometry3K training recipe on top. The rest of the day was routine: dead-code removal, BLAS and MKLDNN build-config changes, HUD test pages opened publicly while /api/tests stays authenticated, and pre-review gating dropped from the triage promotion helper.
Action items
- → Avoid loading untrusted checkpoints with torch.load(weights_only=True) until the arbitrary file read is fixed pytorch/pytorch [immediate]