Skip to content

zeroize: extend asm! to slice Zeroize impl - #1607

Merged
tarcieri merged 1 commit into
masterfrom
zeroize/extend-asm-to-slice-zeroization
Nov 17, 2026
Merged

tarcieri merged 1 commit into
masterfrom
zeroize/extend-asm-to-slice-zeroization

Conversation

@tarcieri

Copy link
Copy Markdown
Member

(Re-)adds fill_slice, but this time using fill followed by optimization_barrier on targets that support asm!, falling back to volatile writes for ones that don't.

This reintroduces some annoying slice-to-pointer-to-slice juggling mainly because optimization_barrier has a slice-based API but also to preserve the byte zeroization fast path, particularly for cases that use a pointer cast from another type whose bit pattern is allowed to be all zeros.

(Re-)adds `fill_slice`, but this time using `fill` followed by
`optimization_barrier` on targets that support `asm!`, falling back to
volatile writes for ones that don't.

This reintroduces some annoying slice-to-pointer-to-slice juggling
mainly because `optimization_barrier` has a slice-based API but also to
preserve the byte zeroization fast path, particularly for cases that use
a pointer cast from another type whose bit pattern is allowed to be all
zeros.
@tarcieri
tarcieri requested a review from newpavlov November 17, 2026 02:57
@tarcieri
tarcieri merged commit 16c3b6a into master Nov 17, 2026
31 checks passed
@tarcieri
tarcieri deleted the zeroize/extend-asm-to-slice-zeroization branch November 17, 2026 03:02
@tarcieri tarcieri mentioned this pull request Nov 17, 2026
tarcieri added a commit that referenced this pull request Nov 17, 2026
## Added
- Optimized `zeroize_bytes` function (#1604)

## Changed
- Implement `optimization_barrier` using `core::hint::black_box` on
  targets without stable `asm!` (#1592)
- Optimized slice zeroization (#1602, #1603, #1607)
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