Netdev List
 help / color / mirror / Atom feed
From: stsp <stsp2@yandex.ru>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Ondrej Mosnacek <omosnace@redhat.com>
Cc: Willem de Bruijn <willemb@google.com>,
	Jason Wang <jasowang@redhat.com>,
	Jakub Kicinski <kuba@kernel.org>,
	network dev <netdev@vger.kernel.org>,
	Linux Security Module list
	<linux-security-module@vger.kernel.org>,
	SElinux list <selinux@vger.kernel.org>
Subject: Re: Possible mistake in commit 3ca459eaba1b ("tun: fix group permission check")
Date: Wed, 29 Jan 2025 09:59:25 +0300	[thread overview]
Message-ID: <8b81a534-9c30-4123-bd7d-bf3a9d89dfcb@yandex.ru> (raw)
In-Reply-To: <67996154e30ce_d9324294c4@willemb.c.googlers.com.notmuch>

29.01.2025 01:59, Willem de Bruijn пишет:
> stsp wrote:
>> By doing that you indeed avoid
>> the problem of "completely
>> inaccessible tap". However, that
>> breaks my setup, as I really
>> intended to provide tap to the
>> owner and the unrelated group.
>> This is because, eg when setting
>> a CI job, you can add the needed
>> user to the needed group, but
>> you also need to re-login, which
>> is not always possible. :(
> Could you leave tun->owner unset?

That's exactly the problem: when
the user is not in the needed group,
then you need to unset _both_.
Unsetting only owner is not enough.
Adding the user to the group is not
enough because then you need to
re-login (bad for CI jobs).

I actually tried to address the
supplementary groups problem:
https://lore.kernel.org/lkml/20241108204102.1752206-1-stsp2@yandex.ru/T/
but nothing came out, so I have
to walk around multiple projects,
talking them into a new semantics
and representing the problems
like this one. If people instead
concentrate on solving the inability
to change the supplementary group
list, nothing like this would ever
happen. :)

>> Also completely ignoring group
>> when the user is set, is somewhat
>> questionable. At the very least,
>> perhaps then you need to explicitly
>> clear the group when the user
>> is set, to avoid the confusion.
>> Having "either user or group"
>> sounds like a sensible semantic,
>> but its a different semantic.
> True. I think that would have satisfied the intent of adding the
> group check at the time, and would have avoided this situation.
>
> But we indeed cannot retroactively restrict allowed behavior.
> As that will break users.
>
> Conversely, it might be that an existing user out there depends on
> the prior behavior that only a process that matches both user and
> group can use the device. Which might be reason for reverting the
> patch entirely.
But this is not an option too, let
me remind the previous situation:
1. If the user is in the group, then
    the group doesn't have any effect
    at all.
2. if the user is not in the group -
    no one can access the device.

"either-or" semantic is a direct fix
to that, as it represents case 1 and
fixes case 2. My semantic covers the
real-world situation of inability to
change the group list, but it needs
further tweaking and discussing.
Applying "either-or" may be feasible,
but the complete revert looks like
returning to a quite broken state.


  reply	other threads:[~2025-01-29  6:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27  9:10 Possible mistake in commit 3ca459eaba1b ("tun: fix group permission check") Ondrej Mosnacek
2025-01-27 10:00 ` stsp
2025-01-27 14:50   ` Willem de Bruijn
2025-01-27 14:58     ` stsp
2025-01-28 14:20     ` Ondrej Mosnacek
2025-01-28 14:45       ` stsp
2025-01-28 14:58         ` stsp
2025-01-28 15:04       ` Willem de Bruijn
2025-01-28 17:49         ` stsp
2025-01-28 22:59           ` Willem de Bruijn
2025-01-29  6:59             ` stsp [this message]
2025-01-29 14:12               ` Willem de Bruijn
2025-01-29 14:27                 ` stsp
2025-01-30 16:46                   ` Willem de Bruijn
2025-02-04  0:29                     ` Paul Moore
2025-02-04 16:18                       ` Ondrej Mosnacek
2025-02-04 19:40                         ` Paul Moore
2025-02-06  3:04                           ` Willem de Bruijn
2025-01-29 14:19       ` Willem de Bruijn

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=8b81a534-9c30-4123-bd7d-bf3a9d89dfcb@yandex.ru \
    --to=stsp2@yandex.ru \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.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