From: Elizabeth Figura <zfigura@codeweavers.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: "Mike Lothian" <mike@fireburn.co.uk>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
dri-devel@lists.freedesktop.org, "Arnd Bergmann" <arnd@arndb.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
wine-devel@winehq.org, "André Almeida" <andrealmeid@igalia.com>,
"Wolfram Sang" <wsa@kernel.org>,
"Arkadiusz Hiler" <ahiler@codeweavers.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Andy Lutomirski" <luto@kernel.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
"Waiman Long" <longman@redhat.com>,
"Boqun Feng" <boqun.feng@gmail.com>
Subject: Re: [PATCH] ntsync: Set the permissions to be 0666
Date: Fri, 14 Feb 2025 19:24:00 -0600 [thread overview]
Message-ID: <3611179.iIbC2pHGDl@camazotz> (raw)
In-Reply-To: <20250215010333.GO3028674@frogsfrogsfrogs>
On Friday, 14 February 2025 19:03:33 CST Darrick J. Wong wrote:
> On Fri, Feb 14, 2025 at 04:15:25PM -0600, Elizabeth Figura wrote:
> > On Friday, 14 February 2025 12:45:39 CST Darrick J. Wong wrote:
> > > On Fri, Feb 14, 2025 at 12:13:03PM -0600, Elizabeth Figura wrote:
> > > > On Friday, 14 February 2025 07:06:20 CST Greg Kroah-Hartman wrote:
> > > > > On Fri, Feb 14, 2025 at 12:28:00PM +0000, Mike Lothian wrote:
> > > > > > This allows ntsync to be usuable by non-root processes out of the box
> > > > >
> > > > > Are you sure you need/want that? If so, why? How did existing testing
> > > > > not ever catch this?
> > > >
> > > > Hi, sorry, this is of course my fault.
> > > >
> > > > We do need /dev/ntsync to be openable from user space for it to be
> > > > useful. I'm not sure what the most "correct" permissions are to have
> > > > in this case (when we don't specifically need read or write), but I
> > > > don't think I see a reason not to just set to 666 or 444.
> > > >
> > > > I originally assumed that the right way to do this was not to set the
> > > > mode on the kernel file but rather through udev; I believe I was using
> > > > the code for /dev/loop-control or /dev/fuse as an example, which both
> > > > do that. So I (and others who tested) had just manually set up udev
> > > > rules for this, with the eventual intent of adding a default rule to
> > > > systemd like the others. I only recently realized that doing something
> > > > like this patch is possible and precedented.
> > > >
> > > > I don't know what the best way to address this is, but this is
> > > > certainly the simplest.
> > >
> > > Paranoid defaults in the kernel, and then a udev rule to relax the mode
> > > at runtime. You could also have logind scripts to add add per-user
> > > allow acls to the device file at user session set up time... or however
> > > it is that /dev/sr0 has me on the allow list. I'm not sure how that
> > > happens exactly, but it works smoothly.
> > >
> > > I get far less complaining about relaxing posture than tightening it
> > > (==breaking things) after the fact.
> >
> > FWIW, it may be worth stressing that this is not a hardware device in
> > any sense, it's a software driver that only lives in a char device
> > (and dedicated module) for the sake of isolating the code. I can't
> > imagine any reason to control access per-user, although my experience
> > may not be enough to grant such imagination.
>
> Oh, I'm aware that ntsync is a driver for a software "device" that
> implements various Windows APIs and isn't real hardware. :)
>
> But, you might want prevent non-root systemd services (e.g. avahi) from
> being able to access /dev/ntsync if, say, someone breaches that, while
> at the same time allowing access to (say) logged-in users who can run
> Wine.
I see the idea, though I don't know if it's applicable in this case—the individual ntsync file descriptions are also supposed to be isolated from one another, so even a rogue avahi would still have another barrier towards compromising a Wine process. Of course you may be aware of that and be advocating for the more barriers the better.
I can't say what systemd will actually prefer in this case, but they do seem to have requested that the kernel change it... [1]
[1] https://github.com/systemd/systemd/pull/36384
next prev parent reply other threads:[~2025-02-15 1:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 12:28 [PATCH] ntsync: Set the permissions to be 0666 Mike Lothian
2025-02-14 13:06 ` Greg Kroah-Hartman
2025-02-14 18:13 ` Elizabeth Figura
2025-02-14 18:45 ` Darrick J. Wong
2025-02-14 22:15 ` Elizabeth Figura
2025-02-15 1:03 ` Darrick J. Wong
2025-02-15 1:24 ` Elizabeth Figura [this message]
2025-02-15 5:59 ` Greg Kroah-Hartman
2025-02-18 23:57 ` Elizabeth Figura
2025-02-19 14:22 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3611179.iIbC2pHGDl@camazotz \
--to=zfigura@codeweavers.com \
--cc=ahiler@codeweavers.com \
--cc=andrealmeid@igalia.com \
--cc=arnd@arndb.de \
--cc=boqun.feng@gmail.com \
--cc=corbet@lwn.net \
--cc=djwong@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=luto@kernel.org \
--cc=mike@fireburn.co.uk \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
--cc=wine-devel@winehq.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).