[oi-dev] valgrind and epoll(5) illumos issue

Andreas Wacknitz A.Wacknitz at gmx.de
Sat Apr 10 14:28:41 UTC 2021


Am 10.04.21 um 11:32 schrieb stes at PANDORA.BE:
> The original Squeak (Smalltalk-80) runtime (similar to squeak-4) uses signal driven,
> non-blocking I/O using select(3c).
>
> An interesting ongoing recent project in the world of Squeak,
> is to add epoll(7) support to squeak-5;
> so basically a developer added epoll(5) for event-driven I/O.
>
> https://illumos.org/man/5/epoll
>
> This is not really OpenIndiana specific but since I use squeak on OpenIndiana, I'm asking here.
>
> The configure script detects that OI supports epoll (via /usr/include/sys/epoll.h),
> and it enables the support which compiles fine, and it basically seems to work fine, I think.
>
> However when I run the executable using the valgrind tool
>
> # pkg info -r valgrind
>            Name: developer/debug/valgrind
>         Summary: Valgrind: instrumentation framework and tools to detect memory
>                  and threading problems
>
> Then I run into the following issue.
>
> In illumos-gate/usr/src/uts/common/sys/devpoll.h the following is defined
>
> $ grep DPIOC uts/common/sys/devpoll.h
> #define		DPIOC	(0xD0 << 8)
> #define	DP_POLL		(DPIOC | 1)	/* poll on fds cached via /dev/poll */
> #define	DP_ISPOLLED	(DPIOC | 2)	/* is this fd cached in /dev/poll */
> #define	DP_PPOLL	(DPIOC | 3)	/* ppoll on fds cached via /dev/poll */
> #define	DP_EPOLLCOMPAT	(DPIOC | 4)	/* turn on epoll compatibility */
>
> Now valgrind reports the following :
>
> ==8531== Warning: noted but unhandled ioctl 0xd004 with no size/direction hints.
> ==8531==    This could cause spurious value errors to appear.
> ==8531==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper
>   wrapper.
> ==8531== Syscall param write(buf) points to uninitialised byte(s)
> ==8531==    at 0xFFFD5D8AA: __write (in /lib/amd64/libc.so.1)
> ==8531==    by 0xFFFD30670: epoll_ctl (in /lib/amd64/libc.so.1)
>
> Note that the unhandled ioctl is 0xd004 which is the DP_EPOLLCOMPAT I suspect.
>
> So OpenIndiana valgrind has no 'wrapper' for DP_EPOLLCOMPAT.
>
> Also valgrind complains about the uninitialized bytes in epoll_ctl,
> which perhaps are due to :
>
> illumos-gate/usr/src/lib/libc/port/sys/epoll.c
>
> int
> epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
> {
>          dvpoll_epollfd_t epoll[2];
>
>          res = write(epfd, epoll, sizeof (epoll[0]) * (i + 1));
>
>
> I am not sure but valgrind may be complaining about passing epoll argument to write().
>
> Perhaps this could be patched at the OpenIndiana level,
> but ideally the Illumos contributors could contact valgrind.org to patch valgrind,
> and/or the illumos sources (if required).
>
> Also that would fix the issue for all Illumos based distributions, not just for OpenIndiana,
> provided OpenIndiana would then incorporate/update its valgrind package.
>
> I'm asking it here on OI-dev because OI is what I happen to use when observing this,
> but has anyone perhaps seen this/or already fixed it perhaps ?
>
> Thanks,
> David Stes
>
> _______________________________________________
> oi-dev mailing list
> oi-dev at openindiana.org
> https://openindiana.org/mailman/listinfo/oi-dev
We have an open PR for an update on valgrind:
https://github.com/OpenIndiana/oi-userland/pull/5765
Maybe you want to take over?

Regards,
Andreas



More information about the oi-dev mailing list