Received: by 10.223.185.116 with SMTP id b49csp4079593wrg; Tue, 13 Feb 2018 12:23:15 -0800 (PST) X-Google-Smtp-Source: AH8x227uEb6BSKz6cja4hl00r6rCkdwhVxQV8YycBhRMd6OJbi+A23Vwotf98+OvANFBZio4AfvT X-Received: by 10.98.34.139 with SMTP id p11mr2413425pfj.119.1518553395421; Tue, 13 Feb 2018 12:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518553395; cv=none; d=google.com; s=arc-20160816; b=sA8VNQ1W7vSJzBe/mIyWfsRIv4QKBZU9gjXXLXyNw3mA4ZHgtx2HcIto6q9WVeXpsu KxThApqRufbJLo6+1985g0FbsyZT+55US76NzyXI7FPsW8qu8O42m9xkPsugeZU5eJ56 VxNgOXF8SGR8mU8GGTX3+cDvQzLO5GbmigUMVk1CB82KEX2SVmdCQl/MqURp8pQDr/1s guV9EsDbcOXGIbFNouVD3uWZIEXM7lNKbJOW32CXBrRPxy1h64YeTXzYo+nhSAa75VeY kTZiy/1NLg77rKpyDt5MhJpEsHTXq2q8k5i2bOcYF9/EmWIg7gMmlAaa1e7MvBhjirn8 UtKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=ErYYp3JpP7odkAhvQTC9xmUCF/Grzv21oHGwBUjyQak=; b=mq+49lL/fP8KfpJc3kg4cZucGpcDuaogPIYnaVWJIP9A4p8db264NTS8tWYhDJQ3B4 c4APqO4YlIgSDd8NkAsUxBiTw4uO0Gv/xUZG/DKhtS0hPmJLGRn1wMRGBc/glzkK1kz+ jVexYsX/ZUZbN4GV4dyuUSkrqazSW11ccO/fLEyEIOYdD9vRMsegN51wUMC2EdTMdyhC hLkAMbxqf6Xq/BM9lAY1znRLqkelW7sm4/xiwPh/xnZfKg80Gy9y8gf/kpiV9MRCutBU V25dB8X8L5SGKTeVM2/lV4dCACLLaiyy7/r5Y+XTW6qmRtlkRLiQsT/u5zLrmkPzj8Ub 4rSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si1539477pge.759.2018.02.13.12.22.58; Tue, 13 Feb 2018 12:23:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965692AbeBMUWP (ORCPT + 99 others); Tue, 13 Feb 2018 15:22:15 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:52933 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965610AbeBMUWN (ORCPT ); Tue, 13 Feb 2018 15:22:13 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1elh5g-0004C9-4c; Tue, 13 Feb 2018 13:22:12 -0700 Received: from 174-19-85-160.omah.qwest.net ([174.19.85.160] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1elh5Q-0004UI-Ju; Tue, 13 Feb 2018 13:22:10 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Davidlohr Bueso Cc: akpm@linux-foundation.org, mhocko@kernel.org, mtk.manpages@gmail.com, keescook@chromium.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180213174136.6346-1-dave@stgolabs.net> Date: Tue, 13 Feb 2018 14:21:31 -0600 In-Reply-To: <20180213174136.6346-1-dave@stgolabs.net> (Davidlohr Bueso's message of "Tue, 13 Feb 2018 09:41:33 -0800") Message-ID: <878tbw3ak4.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1elh5Q-0004UI-Ju;;;mid=<878tbw3ak4.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=174.19.85.160;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/F3x3BY5wZaHfrIIdTmSpd9Ie0yWRIOko= X-SA-Exim-Connect-IP: 174.19.85.160 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa02.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02 autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 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 * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Davidlohr Bueso X-Spam-Relay-Country: X-Spam-Timing: total 13703 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.1 (0.0%), b_tie_ro: 2.1 (0.0%), parse: 1.26 (0.0%), extract_message_metadata: 31 (0.2%), get_uri_detail_list: 4.2 (0.0%), tests_pri_-1000: 8 (0.1%), tests_pri_-950: 2.0 (0.0%), tests_pri_-900: 1.67 (0.0%), tests_pri_-400: 41 (0.3%), check_bayes: 38 (0.3%), b_tokenize: 15 (0.1%), b_tok_get_all: 10 (0.1%), b_comp_prob: 5 (0.0%), b_tok_touch_all: 3.4 (0.0%), b_finish: 0.81 (0.0%), tests_pri_0: 587 (4.3%), check_dkim_signature: 0.98 (0.0%), check_dkim_adsp: 7 (0.1%), tests_pri_500: 13022 (95.0%), poll_dns_idle: 12964 (94.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH -next 0/3] sysvipc: introduce STAT_ALL commands 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Davidlohr Bueso writes: > Hi, > > The following patches adds the discussed[1] new command for shm > as well as for sems and msq as they are subject to the same discrepancies > for ipc object permission checks between the syscall and via procfs. > These new commands are justified in that (1) we are stuck with this > semantics as changing syscall and procfs can break userland; and (2) some > users can benefit from performance (for large amounts of shm segments, > for example) from not having to parse the procfs interface. > > Once (if) merged, I will submit the necesary manpage updates. But I'm > thinking something like: I am just going to kibitz for a moment. Could we name this _STAT_ANY or _STAT_NOPERM instead of _STAT_ALL. I keep thinking a name with _ALL in it should affect all ipc opbjects of a given type, not simply work any ipc object regardless of permissions. Eric > diff --git a/man2/shmctl.2 b/man2/shmctl.2 > index 7bb503999941..bb00bbe21a57 100644 > --- a/man2/shmctl.2 > +++ b/man2/shmctl.2 > @@ -41,6 +41,7 @@ > .\" 2005-04-25, mtk -- noted aberrant Linux behavior w.r.t. new > .\" attaches to a segment that has already been marked for deletion. > .\" 2005-08-02, mtk: Added IPC_INFO, SHM_INFO, SHM_STAT descriptions. > +.\" 2018-02-13, dbueso: Added SHM_STAT_ALL description. > .\" > .TH SHMCTL 2 2017-09-15 "Linux" "Linux Programmer's Manual" > .SH NAME > @@ -242,6 +243,18 @@ However, the > argument is not a segment identifier, but instead an index into > the kernel's internal array that maintains information about > all shared memory segments on the system. > +.TP > +.BR SHM_STAT_ALL " (Linux-specific)" > +Return a > +.I shmid_ds > +structure as for > +.BR SHM_STAT . > +However, the > +.I shm_perm.mode > +is not checked for read access for > +.IR shmid , > +resembing the behaviour of > +/proc/sysvipc/shm. > .PP > The caller can prevent or allow swapping of a shared > memory segment with the following \fIcmd\fP values: > @@ -287,7 +300,7 @@ operation returns the index of the highest used entry in the > kernel's internal array recording information about all > shared memory segments. > (This information can be used with repeated > -.B SHM_STAT > +.B SHM_STAT/SHM_STAT_ALL > operations to obtain information about all shared memory segments > on the system.) > A successful > @@ -328,7 +341,7 @@ isn't accessible. > \fIshmid\fP is not a valid identifier, or \fIcmd\fP > is not a valid command. > Or: for a > -.B SHM_STAT > +.B SHM_STAT/SHM_STAT_ALL > operation, the index value specified in > .I shmid > referred to an array slot that is currently unused. > > > Thanks! > > [1] https://lkml.org/lkml/2017/12/19/220 > > Davidlohr Bueso (3): > ipc/shm: introduce shmctl(SHM_STAT_ALL) > ipc/sem: introduce shmctl(SEM_STAT_ALL) > ipc/msg: introduce shmctl(MSG_STAT_ALL) > > include/uapi/linux/msg.h | 1 + > include/uapi/linux/sem.h | 1 + > include/uapi/linux/shm.h | 5 +++-- > ipc/msg.c | 17 ++++++++++++----- > ipc/sem.c | 17 ++++++++++++----- > ipc/shm.c | 23 ++++++++++++++++++----- > security/selinux/hooks.c | 3 +++ > 7 files changed, 50 insertions(+), 17 deletions(-)