#nostack
April 13, 2026 at 3:07 PM
Parts 1-2/2 — EFTA01756421.jpg
#epsteinweb #efta01756421
https://epsteinweb.org
Available in the iOS app store now!
https://apps.apple.com/us/app/epstein-web/id6758880661
March 9, 2026 at 6:20 AM
Rust needs a safe abstraction over uninitialized memory
CAD97: > This operation is not `freeze`, though, although you could use it as `freeze`. So this example is better? #[repr(C)] #[repr(align8)] pub struct Foo { a: u32, b: u8, } pub fn freeze(x: &Foo) -> u64 { unsafe { let r: u64; core::arch::asm!( "mov {1}, qword ptr [{0}]", in(reg) x, out(reg) r, options(nomem, nostack, preserves_flags), ); r } } Most programmers expect that `asm!` blocks exist outside of the AM. The only connection between them is input/output registers and `options`, everything else is just a black box (well, there are also some extremely annoying technicalities like needing to enable target features if you use certain instructions, but they are not important here). Unfortunately, stuff like creating `&mut [u8]` references to an uninitialized memory by freezing is tied closer to AM since because of `MADV_FREE` such memory may observably break assumptions used during optimizations. Doing so probably at the very least would require "touching" memory pages before returning the reference. There was also a somewhat similar example I encountered recently: Reading and erasing bits outside of an allocation in inline asm Unsafe Code Guidelines > RISC-V has an annoying peculiarity in respect of misaligned operations. Technically, it allows misaligned loads using the usual scalar load/store instructions, but the ISA spec does not make any particular guarantees about it. It can run fine, be "extremely slow" (exception trapping by OS and subsequent emulation), or even can result in a fatal exception. Even with the new Zicclsm extension misaligned operation can still be "extremely slow". And there are no extensions (neither existing, nor pla… It's unclear how it's better to formalize it, but these tools exist and some programmers rely heavily on them in practice.
internals.rust-lang.org
March 5, 2025 at 9:43 PM
Halfstack or Nostack seems better.
February 23, 2025 at 9:26 AM