Commit graph

10511 commits

Author SHA1 Message Date
Andrew Kelley
58f928814d
Merge pull request #22862 from ziglang/fuzz
fuzzer: write inputs to shared memory before running
2025-02-11 23:36:53 -08:00
Alex Rønne Petersen
db0d9c2126
Merge pull request #22857 from nikneym/master
linux(io_uring): port new functions from liburing
2025-02-12 07:57:10 +01:00
Andrew Kelley
c2a3d8cbb9 std.ArrayHashMap: introduce setKey
Only available in the "unmanaged" variant since the other one is
deprecated.
2025-02-11 17:24:59 -08:00
Meghan Denny
b2b830e0e9 std.c: was missing calloc 2025-02-11 17:21:07 -08:00
Andrew Kelley
d789f1e5cf fuzzer: write inputs to shared memory before running
breaking change to the fuzz testing API; it now passes a type-safe
context parameter to the fuzz function.

libfuzzer is reworked to select inputs from the entire corpus.

I tested that it's roughly as good as it was before in that it can find
the panics in the simple examples, as well as achieve decent coverage on
the tokenizer fuzz test.

however I think the next step here will be figuring out why so many
points of interest are missing from the tokenizer in both Debug and
ReleaseSafe modes.

does not quite close #20803 yet since there are some more important
things to be done, such as opening the previous corpus, continuing
fuzzing after finding bugs, storing the length of the inputs, etc.
2025-02-11 13:39:20 -08:00
Rafael Batiati
33f0d458cf
std.elf: fix panic while parsing header
When parsing an invalid (e.g., corrupted) ELF header, `@enumFromInt` can panic casting the exhaustive enum `ET`.
2025-02-11 21:12:44 +00:00
saurabh
4162f401cb
std.fmt: Add unit tests for all methods in the Parser struct 2025-02-11 13:34:56 +02:00
nikneym
408c817e1e linux/IoUring: add register_files_sparse 2025-02-11 13:19:05 +03:00
nikneym
6f6b85e298 linux/io_uring_sqe: add prep_files_update 2025-02-11 13:18:27 +03:00
nikneym
ecfd9cef7d linux/io_uring_sqe: add prep_cancel_fd 2025-02-11 13:17:54 +03:00
Andrew Kelley
1d8857bbe3
Merge pull request #22695 from alexrp/glibc-2-41
glibc 2.41
2025-02-10 17:32:55 -08:00
rpkak
34644511bb std.fmt: remove placeholders from binary 2025-02-10 22:52:17 +01:00
Alex Rønne Petersen
d4c85079c5
Merge pull request #22834 from krkk/hi-this-is-my-first-PR-and-heres-my-breaking-change-haha
std.c: Improve the description of getnameinfo() arguments: optional pointers and specialized `flags` type
2025-02-10 10:44:21 +01:00
andrewkraevskii
6fa7d5d4ad std.mem: add missing check to lastIndexOfLinear 2025-02-10 09:27:26 +01:00
Meghan Denny
9142482372
std.ArrayList: popOrNull() -> pop() [v2] (#22720) 2025-02-10 04:21:31 +00:00
Linus Groh
75df7e502c std.c: Fix definition of stack_t on OpenBSD
The size field is not supposed to be signed.
See: https://man.openbsd.org/sigaltstack.2
2025-02-09 22:17:35 +01:00
Karol Kosek
2ccfb1dafd std.c: Use std.c.NI as the flags type in getnameinfo
std.c.NI was never used in the source, so let's finally use it and make
the function more clear!

This is a breaking change, although a minor one: If you previously passed 0 here
(meaning no flags), then now you have to pass an empty struct (.{}) instead.
Otherwise, you probably used @bitCast() shenanigans here (like
@bitCast(c.NI { .NUMERICHOST = true }) and that will still work, but you can
also get rid of the @bitCast() now!
2025-02-09 16:40:21 +01:00
Karol Kosek
18ffd48b60 std.c: Support optional addr and host arguments in getnameinfo
The POSIX spec allows passing null here
https://pubs.opengroup.org/onlinepubs/9799919799/functions/getnameinfo.html
2025-02-09 16:06:38 +01:00
Meghan Denny
933ba935c5
std.BoundedArray: popOrNull() -> pop() [v2] (#22723) 2025-02-09 11:46:15 +00:00
Pat Tullmann
138d30bb47 wasi: fix wasm-wasi-musl constants
Zig's copy of the `SYMLINK_{NO,}FOLLOW` constants from wasi-musl was
wrong, as were the `IFIFO` and `IFSOCK` file type flags.  Fix these up,
and add comments pointing to exactly where they come from (as the
wasi-musl source has lots of unused, different definitions of these
constants).

Add tests for the Zig convention that WASM preopen 3 is the current
working directory.   This is true for WASM with or without libc.

Enable several fs and posix tests that are now passing (not necessarily
because of this change) on wasm targets.

Fixes #20890.
2025-02-09 09:08:11 +01:00
Linus Groh
0af492a272
Merge pull request #22820 from linusg/uefi-tweaks 2025-02-09 08:03:54 +00:00
Andrew Kelley
604ed5281c
Merge pull request #22823 from ziglang/SmpAllocator-freelist-accounting
std.heap.SmpAllocator: back to simple free implementation
2025-02-08 21:27:22 -08:00
Don
b3a11018ae Read System.keychain as well as SystemRootCertificates.keychain for MacOS CA Bundle 2025-02-09 04:16:56 +01:00
Linus Groh
0660f5b521 std.os.uefi: Drop 'Efi' prefix from type names
The UEFI spec only does this because C doesn't have namespaces, we don't
have that problem. Most type names were already omitting the prefix.
2025-02-09 02:30:32 +00:00
Linus Groh
0a7502e886 std.os.uefi: Adjust casing of remaining enum fields
Work towards #2101.
2025-02-09 02:23:53 +00:00
Linus Groh
0874be1492 std.os.uefi: Adjust casing to match style guide in a few places 2025-02-09 02:23:02 +00:00
Andrew Kelley
42dbd35d3e std.heap.SmpAllocator: back to simple free
In practice this is fine because eventually alloc wins the race and
grabs that massive freelist.
2025-02-08 16:46:56 -08:00
Andrew Kelley
b09e3efad4 std.heap.SmpAllocator: alternate freelist accounting
Freelist length accounting in alloc had a negative impact, especially
with the integer type bumped up to u16, so I changed the system to be
based on counting slabs rather than total allocations.
2025-02-08 16:20:51 -08:00
Andrew Kelley
bb5a4036e8 std.heap.SmpAllocator; fix freelist accounting 2025-02-08 15:07:03 -08:00
Linus Groh
88d42b6ae9 std.os.uefi: Add missing SystemTable revision constants 2025-02-08 21:02:17 +00:00
Linus Groh
43cc656ea6 std.Target: Bump UEFI max version to 2.11
This is the most recent version, released in December 2024.
https://uefi.org/specs/UEFI/2.11/
2025-02-08 21:02:17 +00:00
Andrew Kelley
ea1ce2df9b
Merge pull request #22808 from ziglang/fast-gpa
introduce std.heap.SmpAllocator
2025-02-08 04:54:38 -08:00
Tristan Ross
3fe981e1ad std.os.uefi: fix allocators compiling 2025-02-08 12:33:36 +01:00
Meghan Denny
a8af36ab10 std.ArrayHashMap: popOrNul() -> pop() 2025-02-07 17:52:19 -08:00
Meghan Denny
84d2c6dc72 std.MultiArrayList: popOrNull() -> pop() 2025-02-07 17:50:09 -08:00
Andrew Kelley
bfabb703e3 don't try to test SmpAllocator in single threaded mode 2025-02-07 15:36:00 -08:00
Andrew Kelley
1754e014f5 std.heap.SmpAllocator: rotate on free sometimes
* slab length reduced to 64K
* track freelist length with u8s
* on free(), rotate if freelist length exceeds max_freelist_len

Prevents memory leakage in the scenario where one thread only allocates
and another thread only frees.
2025-02-07 14:41:49 -08:00
Andrew Kelley
a9d3005616 std.heap.SmpAllocator: fix detection of slab end 2025-02-07 14:41:49 -08:00
Andrew Kelley
3246150d45 std.heap.SmpAllocator: fix getCpuCount logic
it was always returning max_cpu_count
2025-02-07 14:41:49 -08:00
Andrew Kelley
88e2e60e88 std.heap.SmpAllocator: simplify by putting freelist node at start 2025-02-07 14:41:49 -08:00
Andrew Kelley
1ffae59fec std.heap.SmpAllocator: fix using wrong size class indices 2025-02-07 14:41:49 -08:00
Andrew Kelley
839c453d88 std.heap.SmpAllocator: eliminate the global mutex 2025-02-07 14:41:49 -08:00
Andrew Kelley
60765a9ee2 std.heap.SmpAllocator: implement searching on alloc
rotate a couple times before resorting to mapping more memory.
2025-02-07 14:41:49 -08:00
Andrew Kelley
84bf7a6701 std.heap.SmpAllocator: 256K slab_len
and no need for special handling of wasi and windows since we don't ask
for anything more than page-aligned.
2025-02-07 12:20:12 -08:00
Andrew Kelley
3d7c5cf64a std.heap: test smp_allocator 2025-02-07 12:20:12 -08:00
Andrew Kelley
51c4ffa410 add std.heap.SmpAllocator
An allocator intended to be used in -OReleaseFast mode when
multi-threading is enabled.
2025-02-07 12:20:12 -08:00
Andrew Kelley
6a6e72fff8
Merge pull request #20511 from archbirdplus
runtime page size detection
rework GeneralPurposeAllocator to reduce active mapping count
Allocator VTable API update
2025-02-07 06:21:51 -08:00
Andrew Kelley
2d4954ad63
Merge pull request #22717 from jacobly0/x86_64-rewrite
x86_64: rewrite `@truncate`
2025-02-07 04:06:50 -08:00
Alex Rønne Petersen
42e48b83b1
Merge pull request #22787 from Rexicon226/add-hint
std.c: add `JIT` hint to macos `MAP`
2025-02-07 11:57:39 +01:00
Kouosi Takayama
1ac97013db fix: getEndPos return end position 2025-02-07 07:20:35 +01:00