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=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 57904C2D0E7 for ; Wed, 25 Mar 2020 18:00:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3566E20777 for ; Wed, 25 Mar 2020 18:00:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pcB8/P4N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727541AbgCYSAW (ORCPT ); Wed, 25 Mar 2020 14:00:22 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38751 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgCYSAW (ORCPT ); Wed, 25 Mar 2020 14:00:22 -0400 Received: by mail-wm1-f66.google.com with SMTP id l20so3818965wmi.3; Wed, 25 Mar 2020 11:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=H2vECe2orURQBDgSGUswq0Em3Lt1cG8LhmyDWMenie4=; b=pcB8/P4NNmGc9jdx2cKv4xLm0LYKUe/enar+zNO7y4vivuI8tC96COsdPMsSERrJYl 8PVqD0Ryt1WAvO9bHnakhvnUfsIgChkC7qbdx86g7WKZuyOUA3mnnQ+he6x9gSy+4cpx c6Q6vhS8Mm4rJylbtRie9w3bHOiCVzrhIRvJEdtRumQ5g7sTuldciIcsSt+D//krTaVi VwHm1SINNqM+sRZows4xI9xhUJ9uh1lwV4NKyK/Ng5sr3WIS2jMszdmOFH+lEufdeQxy yKgiUcMYDK6gAYDYTJBA3p14X99t6sm/bK7aD6+jXW/YVjBnPSxkU4iCFIq5tDotccO5 IGwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=H2vECe2orURQBDgSGUswq0Em3Lt1cG8LhmyDWMenie4=; b=TcSH5A6/97JRlRPCmaJ8jynyv8j2g2TLuWBBso7yKok0vJP78KyUSTEqFiux4JFbhY 4/QhAG2jk6jrP7MSU6nhIi99yACOwjf+Hv+5GFq2zWj6m+/9dacjtq18qGB8dOvWtinh Uzkq5xtkzBrlAHV798RS6U6xSGzv7Aeh1xFzdbNHb6j8X9eZAFmKXeXQGNbMA8JDXEPt R10oF7J1yHPcpaTBgZO6F9VQcH3G1MQ1T4JHbSV1t7Sfr5mftvbLrjQ5+9Q2cNoAi9Ya 0Q89jUb5Oh571kbQ+2I7whLueIj/8lmDTBaWw9ruoPsme7QLvo6P2yvvdvvXe7WG81Uv P7pA== X-Gm-Message-State: ANhLgQ0GgDWwQd2V+OTfVWeaHQsJEIagg3y7FNXzjMtPxvXKrcLzF2Bu EIf+wl/VrXToP88imKr9PQ== X-Google-Smtp-Source: ADFU+vskQBpU1fwag571AUWx4l8lwesSLXv4/Nn4D9x3DELZa5yjkr7FUq1vp/cSRcIq8i0IZhnnuQ== X-Received: by 2002:a7b:cb42:: with SMTP id v2mr4697972wmj.170.1585159219122; Wed, 25 Mar 2020 11:00:19 -0700 (PDT) Received: from avx2 ([46.53.251.45]) by smtp.gmail.com with ESMTPSA id y200sm10085730wmc.20.2020.03.25.11.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 11:00:18 -0700 (PDT) Date: Wed, 25 Mar 2020 21:00:15 +0300 From: Alexey Dobriyan To: Linus Torvalds Cc: Alexey Gladkov , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexander Viro , Alexey Gladkov , 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: <20200325180015.GA18706@avx2> References: <20200324204449.7263-1-gladkov.alexey@gmail.com> <20200324204449.7263-4-gladkov.alexey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: 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. mount -t proc -o subset=pid,sysctl,misc Reviewed-by: Alexey Dobriyan