Re: [RFC PATCH 1/9] ntsync: Introduce the ntsync driver and character device.

From: Elizabeth Figura
Date: Thu Jan 25 2024 - 13:30:33 EST


On Thursday, 25 January 2024 10:47:49 CST Arnd Bergmann wrote:
> On Thu, Jan 25, 2024, at 04:42, Elizabeth Figura wrote:
> > On Wednesday, 24 January 2024 16:56:23 CST Elizabeth Figura wrote:
> >> On Wednesday, 24 January 2024 15:26:15 CST Andy Lutomirski wrote:
> >> > On Tue, Jan 23, 2024 at 4:59 PM Elizabeth Figura
<zfigura@xxxxxxxxxxxxxxx> wrote:
> >> [There is also a potential problem where some broken applications
> >> create a million (literally) sync objects. Making these into files runs
> >> into NOFILE. We did specifically push distributions and systemd to
> >> increase those limits because an older solution *did* use eventfds and
> >> *did* run into those limits. Since that push was successful I don't
> >> know if this is *actually* a concern anymore, but avoiding files is
> >> probably not a bad thing either.]
> >
> > Of course, looking at it from a kernel maintainer's perspective, it
> > wouldn't be insane to do this anyway. If we at some point do start to
> > care about cross- process isolation in this way, or if another NT
> > emulator wants to use this interface and does care about cross-process
> > isolation, it'll be necessary. At least it'd make sense to make them
> > separate files even if we don't implement granular permission handling
> > just yet.
>
> I can think of a few other possible benefits of going with
> per-mutex file descriptors:
>
> - being able to use poll() for waiting on them individually in
> combination with other file descriptor based events (socket,
> signalfd, pidfd, ...)

I can say for sure this isn't going to be useful for Wine, at least not with
the current design.

It also doesn't really mesh well with the NT design in the first place.
NTSYNC_IOC_WAIT_ANY differs from poll() in two major ways: it consumes state
of most object types, and (as coded here) it needs the owner thread ID to be
specifically passed for mutexes.


Anyway, as Alexandre has informed me I clearly have misunderstood our
requirements, so I'm going to try to put together something using files
instead.