Skip to content

Conversation

CorruptedVor
Copy link

this addresses some of the warnings in #24753

@jedisct1
Copy link
Contributor

That fix doesn't make sense.

Maybe move var ad = m; later, after m has been initialized instead.

@rpkak
Copy link
Contributor

rpkak commented Aug 13, 2025

I also just fixed the IOUring errors. This is my diff:

diff --git a/lib/std/os/linux/IoUring.zig b/lib/std/os/linux/IoUring.zig
index 62a87ac103..5c7e5ff1c2 100644
--- a/lib/std/os/linux/IoUring.zig
+++ b/lib/std/os/linux/IoUring.zig
@@ -1692,7 +1692,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.
@@ -4404,9 +4406,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;

@CorruptedVor
Copy link
Author

I also just fixed the IOUring errors. This is my diff:

I committed it, feel free to change the author

@rpkak
Copy link
Contributor

rpkak commented Aug 13, 2025

I also just fixed the IOUring errors. This is my diff:

I committed it, feel free to change the author

That's not important to me.

@rpkak
Copy link
Contributor

rpkak commented Aug 13, 2025

I think b349081 and fc1a66e can be reverted now.

@CorruptedVor
Copy link
Author

I think b349081 and fc1a66e can be reverted now.

Tested, reverting either increases the amount of valgrind errors.

@andrewrk andrewrk changed the title std lib test suite: silence valgrind warnings std lib test suite: fix illegal behavior found by valgrind Aug 13, 2025
@andrewrk
Copy link
Member

I edited the title to better reflect the task: fixing things, not suppressing warnings

@CorruptedVor CorruptedVor force-pushed the master branch 5 times, most recently from 30ee994 to 6894775 Compare August 14, 2025 08:12
.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.

@CorruptedVor
Copy link
Author

no valgrind errors on linux, tested with .debug_stack_frames_count = 8 (don't know how to fix that)
valgrind.txt

@CorruptedVor CorruptedVor force-pushed the master branch 5 times, most recently from 3a833f4 to 873e9ff Compare August 15, 2025 13:30
we don't care about the contents, we just need a file
the buffers are set to 0 after reading
provide_buffers: triggered when checking cqe.user_data
remove_buffers: expectEqualSlices
@andrewrk
Copy link
Member

I have a feeling this is never going to get merged. Please do one at a time, and no drafts

@andrewrk andrewrk closed this Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants