Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934881AbcJFTf5 (ORCPT ); Thu, 6 Oct 2016 15:35:57 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:36829 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934676AbcJFTfu (ORCPT ); Thu, 6 Oct 2016 15:35:50 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrei Vagin Cc: , , , Serge Hallyn , Kees Cook References: <1471291822-539-1-git-send-email-avagin@openvz.org> <20161006175146.GA25935@outlook.office365.com> Date: Thu, 06 Oct 2016 14:33:53 -0500 In-Reply-To: <20161006175146.GA25935@outlook.office365.com> (Andrei Vagin's message of "Thu, 6 Oct 2016 10:51:47 -0700") Message-ID: <87wphlclwe.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1bsESK-0001dm-3b;;;mid=<87wphlclwe.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=75.170.125.99;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+yUMH67oYp8370b9wjKcOwHX6XSoRejpM= X-SA-Exim-Connect-IP: 75.170.125.99 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 0.5 XM_Body_Dirty_Words Contains a dirty word X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Andrei Vagin X-Spam-Relay-Country: X-Spam-Timing: total 408 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 7 (1.7%), b_tie_ro: 6 (1.4%), parse: 0.85 (0.2%), extract_message_metadata: 26 (6.4%), get_uri_detail_list: 1.98 (0.5%), tests_pri_-1000: 19 (4.8%), tests_pri_-950: 1.82 (0.4%), tests_pri_-900: 4.5 (1.1%), tests_pri_-400: 54 (13.2%), check_bayes: 52 (12.6%), b_tokenize: 26 (6.4%), b_tok_get_all: 12 (3.0%), b_comp_prob: 4.4 (1.1%), b_tok_touch_all: 4.3 (1.0%), b_finish: 1.18 (0.3%), tests_pri_0: 286 (70.1%), check_dkim_signature: 0.92 (0.2%), check_dkim_adsp: 3.8 (0.9%), tests_pri_500: 4.4 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/2 v2] userns: show current values of user namespace counters X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2993 Lines: 81 Andrei Vagin writes: > Hello Eric, > > What do you think about this series? It should be useful to know current > usage for user counters. I am in favor of knowing the values. Unless there is a good reason not to we should export the values with a read-only sysctl. I believe that is what other similar limits do. As for having per process knowledge I think that is probably something we want to solve for these sysctls as well. I don't think I saw anyone looking at this code from the perspective of information leaks. I think we need to ask that question, as similar interfaces have been problematic from an information leak point of view. In short I what you are trying to do here is valuable, I just want to make certain we have a maintainable pattern when we export these. Eric > > Thanks, > Andrei > > On Mon, Aug 15, 2016 at 01:10:20PM -0700, Andrei Vagin wrote: >> Recently Eric added user namespace counters. User namespace counters is >> a feature that allows to limit the number of various kernel objects a >> user can create. These limits are set via /proc/sys/user/ sysctls on a >> per user namespace basis and are applicable to all users in that >> namespace. >> >> User namespace counters are not in the upstream tree yet, >> you can find them in Eric's tree: >> https://git.kernel.org/cgit/linux/kernel/git/ebiederm/user-namespace.git/log/?h=for-testing >> >> This patch adds /proc//userns_counts files to provide current usage >> of user namespace counters. >> >> > cat /proc/813/userns_counts >> user_namespaces 101000 1 >> pid_namespaces 101000 1 >> ipc_namespaces 101000 4 >> net_namespaces 101000 2 >> mnt_namespaces 101000 5 >> mnt_namespaces 100000 1 >> >> The meanings of the columns are as follows, from left to right: >> >> Name Object name >> UID User ID >> Usage Current usage >> >> The full documentation is in the second patch. >> >> v2: - describe this file in Documentation/filesystems/proc.txt >> - move and rename into /proc//userns_counts >> >> Cc: Serge Hallyn >> Cc: Kees Cook >> Cc: "Eric W. Biederman" >> Signed-off-by: Andrei Vagin >> >> Andrei Vagin (1): >> kernel: show current values of user namespace counters >> >> Kirill Kolyshkin (1): >> Documentation: describe /proc//userns_counts >> >> Documentation/filesystems/proc.txt | 30 +++++++++++ >> fs/proc/array.c | 55 ++++++++++++++++++++ >> fs/proc/base.c | 1 + >> fs/proc/internal.h | 1 + >> include/linux/user_namespace.h | 8 +++ >> kernel/ucount.c | 102 +++++++++++++++++++++++++++++++++++++ >> 6 files changed, 197 insertions(+) >> >> -- >> 2.5.5