Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Nikolay Borisov <kernel-6AxghH7DbtA@public.gmane.org>
Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>,
	Linux Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Alexander Viro
	<viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	Eric Paris <eparis-FjpueFixGhCM4zKIHC2jIg@public.gmane.org>,
	John McCutchan
	<john-jueV0HHMeujJJrXXpGQQMAC/G2K4zDHf@public.gmane.org>
Subject: Re: [PATCH] inotify: Convert to using per-namespace limits
Date: Mon, 10 Oct 2016 17:39:07 -0500	[thread overview]
Message-ID: <87r37n25is.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <CAJFSNy7q39M_=fZ2nOzPEhLcQ3o6B6ELFE-jsbkRuxsst1G1JQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> (Nikolay Borisov's message of "Tue, 11 Oct 2016 00:54:04 +0300")

Nikolay Borisov <kernel-6AxghH7DbtA@public.gmane.org> writes:

> On Mon, Oct 10, 2016 at 11:49 PM, Eric W. Biederman
> <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> wrote:
>> Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org> writes:
>>
>>> On Mon 10-10-16 09:44:19, Nikolay Borisov wrote:
>>>> On 10/07/2016 09:14 PM, Eric W. Biederman wrote:
>>>> > Nikolay Borisov <kernel-6AxghH7DbtA@public.gmane.org> writes:
>>>> >
>>>> >> This patchset converts inotify to using the newly introduced
>>>> >> per-userns sysctl infrastructure.
>>>> >>
>>>> >> Currently the inotify instances/watches are being accounted in the
>>>> >> user_struct structure. This means that in setups where multiple
>>>> >> users in unprivileged containers map to the same underlying
>>>> >> real user (i.e. pointing to the same user_struct) the inotify limits
>>>> >> are going to be shared as well, allowing one user(or application) to exhaust
>>>> >> all others limits.
>>>> >>
>>>> >> Fix this by switching the inotify sysctls to using the
>>>> >> per-namespace/per-user limits. This will allow the server admin to
>>>> >> set sensible global limits, which can further be tuned inside every
>>>> >> individual user namespace.
>>>> >>
>>>> >> Signed-off-by: Nikolay Borisov <kernel-6AxghH7DbtA@public.gmane.org>
>>>> >> ---
>>>> >> Hello Eric,
>>>> >>
>>>> >> I saw you've finally sent your pull request for 4.9 and it
>>>> >> includes your implementatino of the ucount infrastructure. So
>>>> >> here is my respin of the inotify patches using that.
>>>> >
>>>> > Thanks.  I will take a good hard look at this after -rc1 when things are
>>>> > stable enough that I can start a new development branch.
>>>> >
>>>> > I am a little concerned that the old sysctls have gone away.  If no one
>>>> > cares it is fine, but if someone depends on them existing that may count
>>>> > as an unnecessary userspace regression.  But otherwise skimming through
>>>> > this code it looks good.
>>>>
>>>> So this indeed this is real issue and I meant to write something about
>>>> it. Anyway, in order to preserve those sysctl what can be done is to
>>>> hook them up with a custom sysctl handler taking the ns from the proc
>>>> mount and the euid of current? I think this is a good approach, but
>>>> let's wait and see if anyone will have objections to completely
>>>> eliminating those sysctls.
>>>
>>> Well, I believe just discarding those sysctls is not an option - I'm pretty
>>> sure there are scripts out there which tune these sysctls and those would
>>> stop working. IMO not acceptable regression.
>>
>> Nikolay there is your objection.
>>
>> So since it should be straight forward let's preserve the existing
>> sysctls.  Then this change doesn't need to prove there are no scripts
>> that tweak those sysctls.
>>
>> We are just talking changing the values in the initial user namespace so
>> it should be completely compatible and straight forward to implement
>> unless I am missing something.
>
> Well I'm not so sure about this. Let's say those sysctls are going to
> modify the ucount values in the init_user_ns. That's fine, however for
> which particular user should they do this ? Should it be hardcoded for
> kuid 0? or current_euid? I personally think they should be changing
> the values for the current_euid.

Unless I have missed something the limits are per user namespace.  The
counts are per user in that namespace.  Certainly that is what the rest
of the ucount infrastructure is doing.

At which point having the existing sysctls simply update the limit in
the initial user namespace should result in no change.

Eric

  parent reply	other threads:[~2016-10-10 22:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 10:46 [PATCH] inotify: Convert to using per-namespace limits Nikolay Borisov
     [not found] ` <1475837161-4626-1-git-send-email-kernel-6AxghH7DbtA@public.gmane.org>
2016-10-07 18:14   ` Eric W. Biederman
2016-10-09  5:55   ` [lkp] [inotify] 1109954e99: BUG kmalloc-512 (Not tainted): Freepointer corrupt kernel test robot
     [not found] ` <8737k86n7q.fsf@x220.int.ebiederm.org>
     [not found]   ` <8737k86n7q.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-10-10  6:44     ` [PATCH] inotify: Convert to using per-namespace limits Nikolay Borisov
     [not found]       ` <57FB38C3.9090803-6AxghH7DbtA@public.gmane.org>
2016-10-10 16:40         ` Jan Kara
     [not found]           ` <20161010164046.GG24081-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2016-10-10 20:49             ` Eric W. Biederman
     [not found]               ` <87eg3o3p6l.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-10-10 21:54                 ` Nikolay Borisov
     [not found]               ` <CAJFSNy7q39M_=fZ2nOzPEhLcQ3o6B6ELFE-jsbkRuxsst1G1JQ@mail.gmail.com>
     [not found]                 ` <CAJFSNy7q39M_=fZ2nOzPEhLcQ3o6B6ELFE-jsbkRuxsst1G1JQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-10 22:39                   ` Eric W. Biederman [this message]
2016-10-11  7:36             ` [PATCH v2] " Nikolay Borisov
     [not found]               ` <1476171382-11911-1-git-send-email-kernel-6AxghH7DbtA@public.gmane.org>
2016-10-14  2:31                 ` [lkp] [inotify] 464e1236c3: BUG kmalloc-512 (Not tainted): Freepointer corrupt kernel test robot
2016-10-24  6:47                 ` [PATCH v2] inotify: Convert to using per-namespace limits Nikolay Borisov
     [not found]                   ` <674564a4-ff05-b4d6-4a98-8cfc2e609325-6AxghH7DbtA@public.gmane.org>
2016-10-27 15:46                     ` Eric W. Biederman
2016-12-08  1:40                     ` Eric W. Biederman
     [not found]                       ` <87twafci52.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2016-12-08  6:58                         ` Nikolay Borisov
     [not found]                           ` <e86b3a4f-51d5-ea61-93f3-883fe2dbcf34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-08  8:14                             ` Nikolay Borisov
     [not found]                               ` <100ecab5-6656-9ed6-c0f4-b9c97eae506a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-09  5:38                                 ` Eric W. Biederman
2016-12-09  2:50                             ` Eric W. Biederman
2016-10-24  7:48                 ` Jan Kara
2016-11-14  6:04                 ` Serge E. Hallyn

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=87r37n25is.fsf@x220.int.ebiederm.org \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=eparis-FjpueFixGhCM4zKIHC2jIg@public.gmane.org \
    --cc=jack-AlSwsSmVLrQ@public.gmane.org \
    --cc=john-jueV0HHMeujJJrXXpGQQMAC/G2K4zDHf@public.gmane.org \
    --cc=kernel-6AxghH7DbtA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.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