Commit Graph
34717 Commits
Author SHA1 Message Date
Jacob Young 77810f2882 InternPool: fix optimization assertion failure 2024-07-10 22:56:12 -04:00
Jacob Young c79d3e4aab Compilation: fix leak 2024-07-10 22:05:52 -04:00
Jacob Young c2316c5228 InternPool: make global_error_set thread-safe 2024-07-10 21:39:55 -04:00
Jacob Young 98f3a262a7 InternPool: fix extra mutation races 2024-07-10 19:03:07 -04:00
Jacob Young 2c89f3b654 InternPool: make maps thread-safe 2024-07-10 19:02:55 -04:00
Jacob Young afa66fa392 InternPool: make tracked_insts thread-safe 2024-07-10 14:42:50 -04:00
Jacob Young f290b54f89 InternPool: make files more thread-safe 2024-07-10 11:20:08 -04:00
Jacob Young 8f292431b0 InternPool: fix undefined decl fully qualified name
This is now possible after moving `File.Index` to `*File` mapping into
intern pool.
2024-07-10 11:20:08 -04:00
Jacob Young 3d2dfbe828 InternPool: add FileIndex to *File mapping 2024-07-10 11:20:08 -04:00
mlugg f93a10f664 Air: store param names directly instead of referencing Zir 2024-07-10 11:20:08 -04:00
Jacob Young 3aa48bf859 InternPool: fix race on struct flags 2024-07-10 11:10:49 -04:00
Jacob Young 9cf42b1036 InternPool: fix race on FuncInstance.branch_quota 2024-07-10 11:10:49 -04:00
Jacob Young 667b4f9054 Zcu: cache fully qualified name on Decl
This avoids needing to mutate the intern pool from backends.
2024-07-10 11:10:49 -04:00
kcbanner 95d9292a7a dwarf: use StackIterator.MemoryAccessor to check memory accesses instead of isValidMemory 2024-07-10 10:46:35 -04:00
Jacob Young 1f6b3d1664 Merge pull request #20551 from mochalins/std_thread_pool_fix
fix: Update `spawn`'s `runFn` signature
2024-07-10 05:19:58 -04:00
mochalins f58ee387c7 fix: Use std.os.windows.poll rather than libc 2024-07-10 01:35:01 -04:00
Andrew Kelley 9363e995fc std.Progress: slightly better atomic memcpy
Let's at least do aligned usize loads/stores where possible.
2024-07-10 00:28:44 -04:00
mochalins c8e0095362 test: Add spawn behavior test 2024-07-09 21:15:29 -04:00
mochalins 6446596ba1 fix: Update spawn's' runFn signature 2024-07-09 21:15:29 -04:00
Andrew Kelley b3b923e51f Merge pull request #20561 from jacobly0/debug-segfaults
debug: prevent segfaults on linux
2024-07-09 21:03:36 -04:00
Jacob Young c5283eb49b InternPool: implement thread-safe allocated lists 2024-07-09 17:29:01 -04:00
Jora Troosh 13070448f5 std: fix typos (#20560) 2024-07-09 14:25:42 -07:00
Tw 49f2cca872 bpf: sync map/prog/attach type with latest linux kernel
Note that the original `cgroup_storage` MapType has been deprecated,
so renamed to `cgroup_storage_deprecated`.

Signed-off-by: Tw <tw19881113@gmail.com>
2024-07-09 17:16:51 -04:00
Jacob Young 1824bee579 Progress: suppress tsan races
This removes the undefined behavior, but not the actual races.

Closes #20477
2024-07-09 16:40:28 -04:00
Krzysztof Wolicki 0cc42d090f std.fs.Dir: Rename OpenDirOptions to OpenOptions (#20542)
* std.fs.Dir: Rename OpenDirOptions to OpenOptions
https://ziglang.org/documentation/master/#Avoid-Redundant-Names-in-Fully-Qualified-Namespaces

* std.fs.Dir: Add deprecated alias `OpenDirOptions`
2024-07-09 13:36:38 -07:00
Igor Anić c1e7eb7389 crypto.Certificate: case insensitive host name check
This makes comparing host name with dns name from certificate case
insensitive.

I found a few domains (from the
[cloudflare](https://radar.cloudflare.com/domains) list of top domains)
for which tls.Client fails to connect. Error is:

```zig
error: TlsInitializationFailed
Code/zig/lib/std/crypto/Certificate.zig:336:9: 0x1177b1f in verifyHostName (http_get_std)
        return error.CertificateHostMismatch;
Code/zig/lib/std/crypto/tls23/handshake_client.zig:461:25: 0x11752bd in parseServerCertificate (http_get_std)
                        try subject.verifyHostName(opt.host);
```
In its certificate this domains have host names which are not strictly
lower case. This is what checkHostName is comparing:

 |host_name            |  dns_name                |
 |------------------------------------------------|
 |ey.com               | EY.COM                   |
 |truist.com           | Truist.com               |
 |wscampanhas.bradesco | WSCAMPANHAS.BRADESCO     |
 |dell.com             | Dell.com                 |

From
[RFC2818](https://datatracker.ietf.org/doc/html/rfc2818#section-2.4):
>  Matching is performed using the matching rules specified by
   [RFC2459].
From [RFC2459](https://datatracker.ietf.org/doc/html/rfc2459#section-4.2.1.7):
> When comparing URIs, conforming implementations
> MUST compare the scheme and host without regard to case, but assume
> the remainder of the scheme-specific-part is case sensitive.

Testing with:

```
const std = @import("std");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    const allocator = gpa.allocator();

    const args = try std.process.argsAlloc(allocator);
    defer std.process.argsFree(allocator, args);

    if (args.len > 1) {
        const domain = args[1];

        var client: std.http.Client = .{ .allocator = allocator };
        defer client.deinit();

        // Add https:// prefix if needed
        const url = brk: {
            const scheme = "https://";
            if (domain.len >= scheme.len and std.mem.eql(u8, domain[0..scheme.len], scheme))
                break :brk domain;

            var url_buf: [128]u8 = undefined;
            break :brk try std.fmt.bufPrint(&url_buf, "https://{s}", .{domain});
        };

        const uri = try std.Uri.parse(url);
        var server_header_buffer: [16 * 1024]u8 = undefined;
        var req = try client.open(.GET, uri, .{ .server_header_buffer = &server_header_buffer });
        defer req.deinit();

        try req.send();
        try req.wait();
    }
}
```
`$ zig run example/main.zig -- truist.com `
2024-07-09 16:35:41 -04:00
Ian Johnson 2511830442 Autodoc: only group structs under "namespaces"
The old heuristic of checking only for the number of fields has the
downside of classifying all opaque types, such as `std.c.FILE`, as
"namespaces" rather than "types".
2024-07-09 15:58:03 -04:00
Jacob Young 1b34ae19be debug: prevent segfaults on linux 2024-07-09 12:53:19 -04:00
mlugg 47846bc17c Zcu: fix passing exported decls with compile errors to the backend 2024-07-09 12:53:19 -04:00
PauloCampana 854e86c567 build_runner: fix oob access 2024-07-08 16:59:38 -04:00
Andrew Kelley 89f1bfa5b4 Merge pull request #20526 from der-teufel-programming/fix-comp-errs
Fix a few compilation errors
2024-07-08 16:58:32 -04:00
Andrew Kelley ab4eeb770a Merge pull request #20528 from jacobly0/tsip
InternPool: begin conversion to thread-safe data structure
2024-07-08 16:00:28 -04:00
Jacob Young 65ced4a334 Compilation: put supported codegen backends on a separate thread
(There are no supported backends.)
2024-07-08 11:00:38 -04:00
Jacob Young c36e2bb980 InternPool: fix multi-thread build 2024-07-08 07:02:53 -04:00
Jacob Young 14192019ff InternPool: fix dumping of simple types 2024-07-07 23:45:33 -04:00
Jacob Young 1abc904075 InternPool: start documenting new thread-safe fields 2024-07-07 23:23:30 -04:00
Jacob Young 166402c16b bootstrap: fix build 2024-07-07 22:59:52 -04:00
Jacob Young bdae01ab04 InternPool: implement and use thread-safe list for extra and limbs 2024-07-07 22:59:52 -04:00
Jacob Young 49b25475ad InternPool: remove usage of data with simple indices
This allows them to be atomically replaced.
2024-07-07 22:59:52 -04:00
Jacob Young 383cffbfae InternPool: temporarily disable multi-threaded behavior
This reduces the cost of the new data structure until the multi-threaded
behavior is actually used.
2024-07-07 22:59:52 -04:00
Jacob Young 92ddb959a7 InternPool: implement and use thread-safe list for items 2024-07-07 22:59:52 -04:00
Jacob Young 8293ff94cf InternPool: implement and use thread-safe list for strings 2024-07-07 22:59:52 -04:00
Jacob Young 3e1b190fe6 InternPool: replace garbage with an arena
This was just a badly implemented arena anyway.
2024-07-07 22:59:52 -04:00
Jacob Young c8b9364b30 InternPool: use thread-safe hash map for strings 2024-07-07 22:59:52 -04:00
Jacob Young cda716ecc4 InternPool: implement thread-safe hash map 2024-07-07 22:59:52 -04:00
Jacob Young ca02266157 Zcu: pass PerThread to intern pool string functions 2024-07-07 22:59:52 -04:00
Jacob Young 525f341f33 Zcu: introduce PerThread and pass to all the functions 2024-07-07 22:59:52 -04:00
Shun Sakai 8f20e81b88 std.crypto.pwhash: Add recommended parameters (#20527)
These parameters according to the OWASP cheat sheet.
2024-07-07 20:18:33 +00:00
Krzysztof Wolicki 7205756a69 Step.TranslateC: fix defineCMacro 2024-07-07 12:28:28 +02:00
Krzysztof Wolicki 815022c87b std.coff: fix setAlignment 2024-07-07 12:16:14 +02:00