From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "Christian König" <christian.koenig@amd.com>,
dri-devel@lists.freedesktop.org,
"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>
Subject: Re: [RFC 3/3] drm: Update file owner during use
Date: Thu, 12 Jan 2023 18:49:35 +0000 [thread overview]
Message-ID: <c80fbf23-00db-3ba2-9af0-2b7fe440bc63@linux.intel.com> (raw)
In-Reply-To: <Y782AC5kl6+vVKHP@phenom.ffwll.local>
On 11/01/2023 22:19, Daniel Vetter wrote:
> On Tue, Jan 10, 2023 at 01:14:51PM +0000, Tvrtko Ursulin wrote:
>>
>> On 06/01/2023 18:00, Daniel Vetter wrote:
>>> On Fri, Jan 06, 2023 at 03:53:13PM +0100, Christian König wrote:
>>>> Am 06.01.23 um 11:53 schrieb Daniel Vetter:
>>>>> On Fri, Jan 06, 2023 at 11:32:17AM +0100, Christian König wrote:
>>>>>> Am 05.01.23 um 13:32 schrieb Daniel Vetter:
>>>>>>> [SNIP]
>>>>>>>> For the case of an master fd I actually don't see the reason why we should
>>>>>>>> limit that? And fd can become master if it either was master before or has
>>>>>>>> CAP_SYS_ADMIN. Why would we want an extra check for the pid/tgid here?
>>>>>>> This is just info/debug printing, I don't see the connection to
>>>>>>> drm_auth/master stuff? Aside from the patch mixes up the master opener and
>>>>>>> the current user due to fd passing or something like that.
>>>>>> That's exactly why my comment meant as well.
>>>>>>
>>>>>> The connect is that the drm_auth/master code currently the pid/tgid as
>>>>>> indicator if the "owner" of the fd has changed and so if an access should be
>>>>>> allowed or not. I find that approach a bit questionable.
>>>>>>
>>>>>>> Note that we cannot do that (I think at least, after pondering this some
>>>>>>> more) because it would break the logind master fd passing scheme - there
>>>>>>> the receiving compositor is explicitly _not_ allowed to acquire master
>>>>>>> rights on its own. So the master priviledges must not move with the fd or
>>>>>>> things can go wrong.
>>>>>> That could be the rational behind that, but why doesn't logind then just
>>>>>> pass on a normal render node to the compositor?
>>>>> Because the compositor wants the kms node. We have 3 access levels in drm
>>>>>
>>>>> - render stuff
>>>>> - modeset stuff (needs a card* node and master rights for changing things)
>>>>> - set/drop master (needs root)
>>>>>
>>>>> logind wants to give the compositor modeset access, but not master
>>>>> drop/set access (because vt switching is controlled by logind).
>>>>>
>>>>> The pid check in drm_auth is for the use-case where you start your
>>>>> compositor on a root vt (or setuid-root), and then want to make sure
>>>>> that after cred dropping, set/drop master keeps working. Because in that
>>>>> case the vt switch dance is done by the compositor.
>>>>>
>>>>> Maybe we should document this stuff a bit better :-)
>>>>
>>>> Maybe add a friendly warning? E.g. like "Don't touch it, it works!" :)
>>>
>>> I think Tvrtko just volunteered for that :-) Maybe addition in the
>>> drm-uapi.rst section would be good that fills out the gaps we have.
>>
>> I can attempt to copy, paste and tidy what you wrote here, albeit with less
>> than full degree of authority. Assuming into the existing comment above
>> drm_master_check_perm?
>
> I'd put it into the DOC: section in drm_auth.c so it shows up in the
> drm-uapi.rst docs. Or do a new one if you want to split this out and then
> include it in the drm-uapi.rst.
>
>> But in terms of where my series is going next I would need some
>> clarification in the other sub-thread.
>
> Maybe I'm lost on what the leftover confusion is? This one seemed to be
> it?
The question of whether you are now okay with my approach to track
file_priv->pid if !was_master, or your counter-proposal to have
file_priv->pid and file_priv->"render_user_pid" is still relevant.
If the latter then what semantics have been settled at, one-shot
transition or not?
I had an issue with one-shot and even didn't fully understand what you
did not like about my proposal.
Regards,
Tvrtko
next prev parent reply other threads:[~2023-01-12 18:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 13:34 [RFC 0/3] File owner follows use Tvrtko Ursulin
2022-11-30 13:34 ` [RFC 1/3] drm: Replace DRM_DEBUG with drm_dbg_core in file and ioctl handling Tvrtko Ursulin
2022-12-02 8:38 ` Christian König
2022-11-30 13:34 ` [RFC 2/3] drm: Track clients by tgid and not tid Tvrtko Ursulin
2022-11-30 13:34 ` [RFC 3/3] drm: Update file owner during use Tvrtko Ursulin
2022-11-30 14:18 ` Daniel Vetter
2022-12-01 11:09 ` Tvrtko Ursulin
2022-12-02 9:01 ` Christian König
2023-01-05 12:32 ` Daniel Vetter
2023-01-06 10:32 ` Christian König
2023-01-06 10:53 ` Daniel Vetter
2023-01-06 14:53 ` Christian König
2023-01-06 18:00 ` Daniel Vetter
2023-01-10 13:14 ` Tvrtko Ursulin
2023-01-11 22:19 ` Daniel Vetter
2023-01-12 18:49 ` Tvrtko Ursulin [this message]
2023-01-06 13:18 ` Tvrtko Ursulin
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=c80fbf23-00db-3ba2-9af0-2b7fe440bc63@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/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