Commit graph

5 commits

Author SHA1 Message Date
Andrew Kelley
017228de89 libc malloc: introduce a canary
Instead of padding, use static entropy to detect corrupted header.

* 64-bit, safe modes: 10 canary bits
* 64-bit, unsafe modes: 0 canary bits
* 32-bit: 27 canary bits

A further enhancement, not done here, would be to upgrade from canary to
parity.
2026-02-14 09:25:41 +01:00
Andrew Kelley
6d52678a6c zig libc malloc: skip export when unit testing
These functions can only be exported when external libc components are
available due to the errno location dependency. Note that even when zig
libc is complete, on Windows, errno location will always be external (in
ucrtbase.dll).
2026-02-12 13:14:51 -08:00
Andrew Kelley
ec02571a30 zig libc malloc: set errno when returning null 2026-02-12 13:14:51 -08:00
Andrew Kelley
6ccabbd4e5 std: brk allocator for single-threaded mode 2026-02-12 13:14:51 -08:00
Andrew Kelley
6744160211 zig libc: implement malloc 2026-02-12 13:14:51 -08:00