Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/std/Build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ pub fn create(
.graph = graph,
.build_root = build_root,
.cache_root = cache_root,
.debug_stack_frames_count = std.Build.debug_stack_frames_count, // strange: errors out as undeclared without the prefixes
Copy link
Author

@CorruptedVor CorruptedVor Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also errors out when running the std lib test suite
how do I fix this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jedisct1 any ideas on this? I could just hardcode 8, but that seems like a bug waiting to happen.

.verbose = false,
.verbose_link = false,
.verbose_cc = false,
Expand Down
2 changes: 1 addition & 1 deletion lib/std/math/big/int.zig
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ pub const Mutable = struct {

@memset(rma.limbs[0..req_limbs], 0);

llmulacc(.add, allocator, rma.limbs, a_limbs, b_limbs);
llmulacc(.add, allocator, rma.limbs[0..req_limbs], a_limbs, b_limbs);
rma.normalize(@min(req_limbs, a.limbs.len + b.limbs.len));
rma.positive = (a.positive == b.positive);
rma.truncate(rma.toConst(), signedness, bit_count);
Expand Down
18 changes: 12 additions & 6 deletions lib/std/os/linux/IoUring.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,9 @@ pub const BufferGroup = struct {
pub fn get(self: *BufferGroup, cqe: linux.io_uring_cqe) ![]u8 {
const buffer_id = try cqe.buffer_id();
const used_len = @as(usize, @intCast(cqe.res));
return self.get_by_id(buffer_id)[0..used_len];
const buf = self.get_by_id(buffer_id)[0..used_len];
std.valgrind.memcheck.makeMemDefinedIfAddressable(buf);
return buf;
}

// Release buffer from CQE to the kernel.
Expand Down Expand Up @@ -2178,7 +2180,7 @@ test "write_fixed/read_fixed" {
defer file.close();
const fd = file.handle;

var raw_buffers: [2][11]u8 = undefined;
var raw_buffers = std.mem.zeroes([2][11]u8);
// First buffer will be written to the file.
@memset(&raw_buffers[0], 'z');
raw_buffers[0][0.."foobar".len].* = "foobar".*;
Expand Down Expand Up @@ -2704,6 +2706,8 @@ test "statx" {
.BADF => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
// buf is initialized after a successful copy_cqe
std.valgrind.memcheck.makeMemDefinedIfAddressable(std.mem.sliceAsBytes(std.mem.asBytes(&buf)));
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xaaaaaaaa,
.res = 0,
Expand Down Expand Up @@ -3206,6 +3210,7 @@ test "provide_buffers: read" {
const buffer_len = 128;

var buffers: [4][buffer_len]u8 = undefined;
std.valgrind.memcheck.makeMemDefinedIfAddressable(std.mem.sliceAsBytes(&buffers));

// Provide 4 buffers

Expand Down Expand Up @@ -3338,6 +3343,7 @@ test "remove_buffers" {
const buffer_len = 128;

var buffers: [4][buffer_len]u8 = undefined;
std.valgrind.memcheck.makeMemDefinedIfAddressable(std.mem.sliceAsBytes(&buffers));

// Provide 4 buffers

Expand Down Expand Up @@ -4052,7 +4058,7 @@ test "waitid" {
posix.exit(7);
}

var siginfo: posix.siginfo_t = undefined;
var siginfo = std.mem.zeroes(posix.siginfo_t);
_ = try ring.waitid(0, .PID, pid, &siginfo, posix.W.EXITED, 0);

try testing.expectEqual(1, try ring.submit());
Expand Down Expand Up @@ -4416,9 +4422,7 @@ fn expect_buf_grp_cqe(
try testing.expectEqual(posix.E.SUCCESS, cqe.err());

// get buffer from pool
const buffer_id = try cqe.buffer_id();
const len = @as(usize, @intCast(cqe.res));
const buf = buf_grp.get_by_id(buffer_id)[0..len];
const buf = try buf_grp.get(cqe);
try testing.expectEqualSlices(u8, expected, buf);

return cqe;
Expand Down Expand Up @@ -4599,6 +4603,8 @@ fn testSendRecv(ring: *IoUring, send_fd: posix.socket_t, recv_fd: posix.socket_t
try testing.expectEqual(posix.E.SUCCESS, cqe.err());
recv_len += @intCast(cqe.res);
}
// if this is not the case, the check fails
std.valgrind.memcheck.makeMemDefinedIfAddressable(&buffer_recv);

// inspect recv buffer
try testing.expectEqualSlices(u8, buffer_send, buffer_recv[0..buffer_send.len]);
Expand Down
3 changes: 2 additions & 1 deletion lib/std/os/linux/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ test "fadvise" {
defer file.close();

var buf: [2048]u8 = undefined;
std.valgrind.memcheck.makeMemDefinedIfAddressable(&buf);
try file.writeAll(&buf);

const ret = linux.fadvise(file.handle, 0, 0, linux.POSIX_FADV.SEQUENTIAL);
Expand Down Expand Up @@ -244,7 +245,7 @@ test "futex v1" {
try expectEqual(0, rc);

// CMP_REQUEUE - val3 mismatch
rc = linux.futex(&lock.raw, .{ .cmd = .CMP_REQUEUE, .private = true }, 2, .{ .val2 = 0 }, null, 99);
rc = linux.futex(&lock.raw, .{ .cmd = .CMP_REQUEUE, .private = true }, 2, .{ .val2 = 0 }, &lock.raw, 99);
try expectEqual(.AGAIN, linux.E.init(rc));

// CMP_REQUEUE - requeue (but no waiters, so ... not much)
Expand Down