| Summary: | io_pgetevents is not supported | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | rafael |
| Component: | general | Assignee: | Paul Floyd <pjfloyd> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | david.sloan, pjfloyd |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | initial patch | ||
|
Description
rafael
2020-04-27 21:20:12 UTC
I have hit the same bug on Ubuntu 24.04 running valgrind version 3.22.0, and did not see a fix in git.
Steps to reproduce:
missing-syscall.c
```C
#include <assert.h>
#include <fcntl.h>
#include <libaio.h>
#include <unistd.h>
int main()
{
const char *msg = "hello world\n";
struct iocb iocb = {};
struct io_event event;
io_context_t ctx = 0;
struct iocb *iocbp;
int rc, fd;
rc = io_setup(1, &ctx);
assert(rc == 0);
fd = open("test.txt", O_CREAT | O_RDWR, 0666);
assert(fd >= 0);
io_prep_pwrite(&iocb, fd, (void *)msg, 12, 0);
iocbp = &iocb;
rc = io_submit(ctx, 1, &iocbp);
assert(rc == 1);
rc = io_getevents(ctx, 1, 1, &event, NULL);
assert(rc = 1);
close(fd);
io_destroy(ctx);
}
```
```
gcc -g -Og missing-syscall.c -o test-valgrind -laio
valgrind ./test-valgrind
```
output:
```
==39192== Memcheck, a memory error detector
==39192== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==39192== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==39192== Command: ./test-valgrind
==39192==
--39192-- WARNING: unhandled amd64-linux syscall: 333
--39192-- You may be able to write your own handler.
--39192-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--39192-- Nevertheless we consider this a bug. Please report
--39192-- it at http://valgrind.org/support/bug_reports.html.
==39192==
==39192== HEAP SUMMARY:
==39192== in use at exit: 0 bytes in 0 blocks
==39192== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==39192==
==39192== All heap blocks were freed -- no leaks are possible
==39192==
==39192== For lists of detected and suppressed errors, rerun with: -s
==39192== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
```
(In reply to David Sloan from comment #1) > I have hit the same bug on Ubuntu 24.04 running valgrind version 3.22.0, and > did not see a fix in git. It works for me on Fedora 41. But that's using sys_io_getevents rather than sys_io_pgetevents SYSCALL[5989,1](208) sys_io_getevents ( 139871270969344, 1, 1, 0x1ffefff850, 0x0 ) --> [async] ... SYSCALL[5989,1](208) ... [async] --> Success(0x1) It looks like the same interface but with an extra const struct __aio_sigset* usig argument. Created attachment 179731 [details]
initial patch
I haven't tested it yet properly, but could you try this patch?
(In reply to Paul Floyd from comment #3) > Created attachment 179731 [details] > initial patch > > I haven't tested it yet properly, but could you try this patch? This works on my system, thanks! Tested on valgrind: commit f697142e15c44c2d3e3910ae436a6597e8782aea (HEAD -> master, origin/master, origin/HEAD) I've written a test for this and cleaned up the error messages a bit - there were a few errors in the untested code. Buildbot says I need to improve the configure.ac test the the syscall. There is only the amd64 wrapper for the moment. I couldn't see the syscall number for ppc. The value was wrong for arm64, now corrected. Added x86 s390 mips32, mips64 and riscv64 as well as amd64. commit 19c00de89e0fa21c62a5c0c0d1b1cc081f4ce00a (HEAD -> master, origin/master, origin/HEAD, bug420682) Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Fri Mar 28 21:45:15 2025 +0100 Bug 420682 - io_pgetevents is not supported |