8520 Commits

Author SHA1 Message Date
fn ⌃ ⌥
04dad64dbe std.zig.Ast: Fix docs for FnProto and FnProtoOne 2023-12-29 07:52:11 -08:00
Marcius
ff17b11692 refact: rectifified a typo in docs of stringify.zig 2023-12-28 00:06:30 +02:00
Veikka Tuominen
94c63f31f2
Merge pull request #18328 from ExpidusOS/feat/uefi-time
std: add support for getting the time in UEFI
2023-12-26 01:03:10 +02:00
Veikka Tuominen
cd30277142
Merge pull request #18309 from castholm/windows-argv
More accurate argv parsing/serialization on Windows
2023-12-26 00:54:13 +02:00
AlliedEnvy
1b0e913e0f std.hash_map: clarify error when Context is missing pub hash/eql 2023-12-23 16:15:19 +02:00
Frank Denis
21ae64852a
std.crypto.kem.kyber: mitigate KyberSlash (#18316)
On some architectures, including AMD Zen CPUs, dividing a secret
by a constant denominator may not be a constant-time operation.

And most Kyber implementations, including ours, could leak the
hamming weight of the shared secret because of this. See:

https://kyberslash.cr.yp.to

Multiplications aren't guaranteed to be constant-time either, but
at least on the CPUs we currently support, it is.
2023-12-22 15:57:16 +00:00
Vitalijus Valantiejus
fd98fc1c5f std.fmt: fix formatting of array pointers
- Clean up array formatting code. Remove buggy formatting of array
pointers, deference pointer to reuse existing array formatting logic.
- Change default specifier for array pointers to be "{any}", to be
consistent with slices.
- Allow using "{x}" and "{e}" for arrays and slices for all number
types, including u8.

Fixes #18185
2023-12-22 16:35:28 +02:00
Ryan Liptak
70b248497a fs: Add tests for deleteTree not following symlinks
In theory this is part of https://github.com/ziglang/zig/issues/18335, but these tests already pass since deleteTree does not depend on `OpenDirOptions.no_follow` behavior for these test cases:

- `deleteTree` always tries to delete the initial path as a file first, which will succeed on symlinks because `deleteFile` doesn't follow symlinks
- `deleteTree` when iterating a directory will get the type of symlinks as .sym_link, not as .directory (even if the symlink points to a directory), meaning it will never try to open a symlink as a directory.
2023-12-22 13:47:19 +02:00
Carl Åstholm
60982ea5bd Correct CreateProcessW parameter types 2023-12-22 12:23:27 +02:00
Veikka Tuominen
d787b78d2c
Merge pull request #18326 from squeek502/stat-symlink
`File.stat`: Support detection of `Kind.sym_link` on Windows
2023-12-22 12:06:10 +02:00
Ryan Liptak
f5d0664e78 Make 'stat of a symlink' test case not rely on OpenDirOptions.no_follow behavior
The `no_follow` behavior happened to allow opening a file descriptor of a symlink itself on Windows, but that behavior may change in the future. Instead, we implement the opening of the symlink as a file descriptor manually (and per-platform) in the test case.
2023-12-21 17:47:32 -08:00
Tristan Ross
97fd100471
os.uefi: add ns to epoch 2023-12-20 20:05:16 -08:00
Ryan Liptak
dd189a354b Fix Stat.ctime docs, and correct its value on Windows
ctime is last file status/metadata change, not creation time. Note that this mistake was not made in the `File.metadata`/`File.Metadata` implementation, which allows getting the actual creation time.

Closes #18290
2023-12-20 19:43:28 +02:00
Tristan Ross
23adf09579
time: add uefi support 2023-12-20 09:24:10 -08:00
Tristan Ross
a86cd91389
os.uefi: add time to epoch conversion 2023-12-19 23:42:47 -08:00
Ryan Liptak
11a398af3e File.stat: Support detection of Kind.sym_link on Windows
Requires an extra NtQueryInformationFile call when FILE_ATTRIBUTE_REPARSE_POINT is set to determine if it's actually a symlink or some other kind of reparse point (https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags). This is something that `File.Metadata.kind` was already doing, so the same technique is used in `stat`.

Also, replace the std.os.windows.DeviceIoControl call in `metadata` with NtQueryInformationFile (NtQueryInformationFile is what gets called during kernel32.GetFileInformationByHandleEx with FileAttributeTagInfo, verified using NtTrace).
2023-12-19 23:36:23 -08:00
Andrew Kelley
cd7960ea75 std: disable flaky tcp server test
Tracking issue: #18315
2023-12-19 12:01:09 -07:00
Carl Åstholm
4d9c4ab82c More accurate argv-to-command-line serialization when spawning child processes on Windows
The old implementation had a bug in it in that it didn't quote empty strings, but it also didn't properly follow the special quoting rules required for the first argument (the executable name). This new implementation serializes the argv correctly such that it can be parsed by the `CommandLineToArgvW` algorithm.
2023-12-18 23:58:26 +01:00
Carl Åstholm
13f78e24b8 Update ArgIterator on Windows to follow standard Windows parsing rules
This adds `ArgIteratorWindows`, which faithfully replicates the quoting and escaping behavior observed in `CommandLineToArgvW` and should make Zig applications play better with processes that abuse these quirks.
2023-12-18 22:55:46 +01:00
Artem Kolichenkov
90a19f7411
std.net: add explicit error sets for IP parsing
Inferred errors in switch statements prevented IP address parsing at comptime.
Adding explicit error sets fixes it.

Closes #18276
2023-12-16 16:15:51 +00:00
Carl Åstholm
779b8e2598 Expose -f(no-)formatted-panics to the build system 2023-12-16 04:08:05 +02:00
Jan Philipp Hafer
70664547ce std.net.test: cleanup socket stream 2023-12-15 21:15:35 +02:00
Jakub Konka
5d12622469 lib/std/Build/CheckObject: split dyld info into subsections for easier scoped testing 2023-12-13 13:53:05 +01:00
Jakub Konka
f26459e594 lib/std/Build/CheckObject: update all tests to new API 2023-12-13 12:06:25 +01:00
Jakub Konka
c4519d6bba lib/std/Build/CheckObject: implement for Wasm 2023-12-13 11:41:51 +01:00
Jakub Konka
92cca7fbf1 lib/std/Build/CheckObject: implement for ELF 2023-12-13 11:38:57 +01:00
Jakub Konka
2492488501 lib/std/Build/CheckObject: introduce scoped checks; implement for MachO 2023-12-13 11:22:46 +01:00
Jakub Konka
a38af5f542 lib/std/Build/CheckObject: fix parsing and dumping special dylib lookup values 2023-12-13 01:29:01 +01:00
loris
37458cc886 allow sqe entries up to 32768 2023-12-12 06:49:19 +02:00
Loris Cro
26e27f5f64 std.Build.Cache: add HexDigest type 2023-12-11 23:08:03 +01:00
Eric Eastwood
5c1428ea9d
Add getPtrConstAssertContains(...) for compatibility with a const std.EnumMap
This way people can use `const` with a `std.EnumMap`
and be able to `getPtrAssertContains(...)` like the
would with a mutable `var` instance.

Aligns with the existing `getPtr(...)`/`getPtrConst(...)`
methods.
2023-12-11 22:04:43 +00:00
Travis Staloch
5bbacb0c8c fmt.parseWithSign(): prevent edge case overflows
previously when T was smaller than 8 bits, it was possible for base
to overflow T (because base is a u8).  this patch prevents this by
accumulating into a U rather than T which is at least 8 bits wide.

this is the best way i could think of to maintain performance.  this
will only affect parsing of integers less than 8 bits by adding one
additional cast at return.  additionally, this patch may be slightly
slower to return an error for integers less than 8 bits which overflow
because it will accumulate a few more digits before the overflow check
at return.

* add tests which previously overflowed when they shouldn't have

closes #18157
2023-12-11 17:49:22 +02:00
xdBronch
a817e27c7d use linux.perf_event_open directly 2023-12-11 17:48:18 +02:00
Jakub Konka
5c0d58b71f
Merge pull request #18243 from ziglang/check-macho-more
lib/std/Build/CheckObject: dump more Mach-O info
2023-12-10 09:48:50 +01:00
Jakub Konka
a2d8e03931 lib/std/Build/CheckObject: dump Mach-O dyld_info_only bind, weak-bind and lazy-bind data 2023-12-10 00:50:52 +01:00
Jakub Konka
5bda88f9a3 lib/std/Build/CheckObject: dump Mach-O dyld_info_only rebase data 2023-12-10 00:14:53 +01:00
Jakub Konka
40952b4cdb lib/std/Build/CheckObject: dump Mach-O dyld_info_only exports data 2023-12-09 10:57:12 +01:00
Jakub Konka
eb70c8801e lib/std/Build/CheckObject: dump Mach-O symbol attributes 2023-12-09 09:38:23 +01:00
Veikka Tuominen
69195d0cd4 AstGen: add error for using inline loops in comptime only scopes 2023-12-08 16:54:32 -08:00
Jakub Konka
36981d46a3 lib/std/Build/CheckObject: dump Mach-O header 2023-12-08 20:31:45 +01:00
Carter Snook
d270020114
std.os.dl_iterate_phdr: remove u16 error cast 2023-12-08 16:10:33 +02:00
yunsh1
7e4177a4b1 fmt: Skip extra newline if doc_comment exists 2023-12-08 16:05:46 +02:00
Meghan Denny
6a12fd62c1 std: make std.unicode.initComptime() a comptime-known function
resolved a TODO :)
2023-12-08 15:59:17 +02:00
xdBronch
7a46c20a79 switch to mem.span
Co-authored-by: erikarvstedt <36110478+erikarvstedt@users.noreply.github.com>
2023-12-08 15:58:08 +02:00
xdBronch
e9bd10cfda add getName helper to inotify_event 2023-12-08 15:58:08 +02:00
Jakub Konka
56deb5b054 macho: rename flag to EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 2023-12-06 23:29:08 +01:00
Jakub Konka
79316ee10b lib/std/macho: add missing LC defs and missing N_NO_DEAD_STRIP desc for nlists 2023-12-06 22:25:44 +01:00
Frank Denis
f276bb107e verify_buffer is not expected to be sentinel-terminated 2023-12-01 20:04:52 +01:00
Frank Denis
9831dc9e0c TLS: The 0x1306 TLS identifier was updated to TLS_AEGIS_256_SHA512
Following the recommendations from [1], the AEGIS specification
and the TLS registry [2] were updated to recommend SHA512 for the
traffic secrets.

[1] https://eprint.iacr.org/2023/913.pdf
[2] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
2023-12-01 18:00:15 +01:00
Jacob Young
bf5ab54510 test: test with -fstrip and fix failures
Closes #17513
2023-12-01 04:34:50 +00:00