News for hackers. Stuff that matters.
Re:no strpy either by gizmo686 on Wednesday December 31, 2025 @04:07AM (#46442588)
X86-64 has the REP prefix for string operation. When combined with the MOVS instruction, that is pretty much an instruction for strcpy.
Re:no strpy either by messe on Wednesday December 31, 2025 @05:11AM (#46442897)
No, it's an instruction for memcpy. You still need to compute the string length first, which means touching every byte individually because you can't use SIMD due to alignment assumptions (or lack thereof) and the potential to touch uninitialized or unmapped memory (when the string crosses a page boundary).
Re:no strpy either by ncruces on Wednesday December 31, 2025 @05:35AM (#46443014)
You do aligned reads, which can't crash.

Not even musl uses a scalar loop, if it can do aligned reads/writes: https://git.musl-libc.org/cgit/musl/tree/src/string/stpcpy.c

And you don't need to worry about C UB if you do it in ASM.