From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F43C2D0E5 for ; Wed, 25 Mar 2020 19:04:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 169FB20714 for ; Wed, 25 Mar 2020 19:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbgCYTEg (ORCPT ); Wed, 25 Mar 2020 15:04:36 -0400 Received: from monster.unsafe.ru ([5.9.28.80]:43518 "EHLO mail.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbgCYTEg (ORCPT ); Wed, 25 Mar 2020 15:04:36 -0400 Received: from comp-core-i7-2640m-0182e6 (ip-89-102-33-211.net.upcbroadband.cz [89.102.33.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.unsafe.ru (Postfix) with ESMTPSA id 495E5C61AE0; Wed, 25 Mar 2020 19:04:31 +0000 (UTC) Date: Wed, 25 Mar 2020 20:04:29 +0100 From: Alexey Gladkov To: Alexey Dobriyan Cc: Linus Torvalds , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexander Viro , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , "Eric W . Biederman" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Oleg Nesterov Subject: Re: [PATCH RESEND v9 3/8] proc: move hide_pid, pid_gid from pid_namespace to proc_fs_info Message-ID: <20200325190429.73k52amlfjer7epa@comp-core-i7-2640m-0182e6> References: <20200324204449.7263-1-gladkov.alexey@gmail.com> <20200324204449.7263-4-gladkov.alexey@gmail.com> <20200325180015.GA18706@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200325180015.GA18706@avx2> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: On Wed, Mar 25, 2020 at 09:00:15PM +0300, Alexey Dobriyan wrote: > On Tue, Mar 24, 2020 at 02:21:59PM -0700, Linus Torvalds wrote: > > On Tue, Mar 24, 2020 at 1:46 PM Alexey Gladkov wrote: > > > > > > +/* definitions for hide_pid field */ > > > +enum { > > > + HIDEPID_OFF = 0, > > > + HIDEPID_NO_ACCESS = 1, > > > + HIDEPID_INVISIBLE = 2, > > > +}; > > > > Should this enum be named... > > > > > struct proc_fs_info { > > > struct pid_namespace *pid_ns; > > > struct dentry *proc_self; /* For /proc/self */ > > > struct dentry *proc_thread_self; /* For /proc/thread-self */ > > > + kgid_t pid_gid; > > > + int hide_pid; > > > }; > > > > .. and then used here instead of "int"? > > > > Same goes for 'struct proc_fs_context' too, for that matter? > > > > And maybe in the function declarations and definitions too? In things > > like 'has_pid_permissions()' (the series adds some other cases later, > > like hidepid2str() etc) > > > > Yeah, enums and ints are kind of interchangeable in C, but even if it > > wouldn't give us any more typechecking (except perhaps with sparse if > > you mark it so), it would be documenting the use. > > > > Or am I missing something? > > > > Anyway, I continue to think the series looks fine, bnut would love to > > see it in -next and perhaps comments from Al and Alexey Dobriyan.. > > Patches are OK, except the part where "pid" is named "pidfs" and > the suffix doesn't convey any information. I will fix this in the final version. > mount -t proc -o subset=pid,sysctl,misc I have not yet figured out how to implement this. I mean subset=meminfo,misc. -- Rgrds, legion