Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1038334ybb; Fri, 3 Apr 2020 17:00:18 -0700 (PDT) X-Google-Smtp-Source: APiQypLVda9imGLVFLHsn/Z75xO7fchtzQd0CsZjXsqYQA3L/BbNKXPInrfoQu/3A1ZYwE23wKGB X-Received: by 2002:aca:c552:: with SMTP id v79mr4967306oif.156.1585958417825; Fri, 03 Apr 2020 17:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585958417; cv=none; d=google.com; s=arc-20160816; b=h+bOIiU0ZBAmzM+VqFnssi442FSyj5nBr2QxCtoxeuxtl9Ccg1KtODYBsmcV7Wp63X 417RkOHgAPXPfKKm0ZHUI3LGS0iqGrSWVO9k2u0yVE07Ilurjn2IYf/aied8aHlxFPgs 5qeL3q09AsIud0tBEEwDfgIvH3bGt58jkudu1dSuHPbkida63l7NkUAa6ko/lPDSGykv bMSyH1I0rSFv0CwT076QGJSITzNPSfJPm1bvXcaUSfmhIVpLnJpWyEIWNlFHbMw47UIa 2QA5rQIDOut6MyO0hynSihjrsi2HlgBwNGCOsT5Fkz1QL9UUodLI4SOzbAXtU2l1pFK3 I6pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YCa/Qs0yPmh3XTwnN4PsbMB277OSr9D+GN0maXxjMHA=; b=qpi2lzDBdFILd2gd47B2GCLgdfMfh5kuZSD+3idvYIrkz9ZzIxQWlraxqONjpMFffi olnl40EIYQ3i7hz6oYof5aklm6ZP15doTdGyr6S3OQGSkoEORo+gcuNPmuNWJSs5lTCk SditJ4uoFruVRIU47wlS0xihLLZG3TwQKplDPibCwcwbMCG7a5H7uCaI7OaShQyoMcvY S+o5GW6FDCnuf85tQEl52Ja3+/wGN0FD2ckaiRexptRfkNMDfmqk+xoTQ3rxLI9z35EZ SZKZpNokrfkLBEASDlQZwEZIr/+/LdJ4tWv7htoZt2hd/IIe/rSIi1kjYi7a8lZAet7r ycfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bbhh3fmX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x64si4362566oig.34.2020.04.03.17.00.04; Fri, 03 Apr 2020 17:00:17 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b=Bbhh3fmX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbgDCX72 (ORCPT + 99 others); Fri, 3 Apr 2020 19:59:28 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:53314 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbgDCX71 (ORCPT ); Fri, 3 Apr 2020 19:59:27 -0400 Received: by mail-pj1-f67.google.com with SMTP id l36so3783997pjb.3 for ; Fri, 03 Apr 2020 16:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YCa/Qs0yPmh3XTwnN4PsbMB277OSr9D+GN0maXxjMHA=; b=Bbhh3fmXAiGdRNFedcwh3XwyQ26GhP6Z9oRxi/DD0ElrQbHJt8FP23Due9BPsALnlu cdsBGZMeu1Kd8/vgELs72HvtyNixfzg4EaDAo5O2ENQpAqF+HriRbxrU9MqmUByE9IP0 IyiltCvmyvjnf3QdBrKiVqJ2X8ZPSJrLSlitI= 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; bh=YCa/Qs0yPmh3XTwnN4PsbMB277OSr9D+GN0maXxjMHA=; b=rUgNpUis/hY7UrrFMcD7U3WQ7TW3vKiqoLAkdOdlOXSfStz4D6tlcMMjNbynhfF6GR f4GoBDX0kfmJ4cgGOrvesBIboHBTbnEHD7lFBQfUn5EHSb6URF00yfE0d4qi5SmFhq35 Rxl16AyQlEnf6g9MgLjJfjoCeXYaLZkWYMMI8oavLwmlkEOAWwf3WAnEhWqZPFL8v/v4 qKlo7fRb0cWvtKj4pUwdDwYztX1YDORsqD80aRmHlf7fuTXHaafwpiaLVpQX/DYgiXHU oTxk9qQ9Ohry5aJt5FFfiG+eDTuUWXNqV2RffcvzNzkVSubGARuPa5QNrMPI6fd7Iyyb a3Uw== X-Gm-Message-State: AGi0PuZnKiJSg/jiwa5JGpzEcCQ/mENRBRx81k+oBT6YgPwkNg8CCA9y cOxvBJtt5ppEOYMPYwtPDWOtcA== X-Received: by 2002:a17:90a:21ac:: with SMTP id q41mr12995017pjc.41.1585958365843; Fri, 03 Apr 2020 16:59:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m3sm6071311pgt.27.2020.04.03.16.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 16:59:24 -0700 (PDT) Date: Fri, 3 Apr 2020 16:59:23 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: Alexey Gladkov , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexander Viro , Alexey Dobriyan , Alexey Gladkov , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Linus Torvalds , Oleg Nesterov Subject: Re: [PATCH v10 7/9] proc: move hidepid values to uapi as they are user interface to mount Message-ID: <202004031658.8D0C048E3@keescook> References: <20200327172331.418878-1-gladkov.alexey@gmail.com> <20200327172331.418878-8-gladkov.alexey@gmail.com> <875zehkeob.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875zehkeob.fsf@x220.int.ebiederm.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 11:58:28AM -0500, Eric W. Biederman wrote: > > I will just say that I do not understand exporting this to the uapi > headers. Why do we want to export the enumeration names? > > I understand that the values are uapi. This looks like it will make it > difficult to make changes that rename enumeration values to make > the code more readable. > > Given that this patchset goes immediately to using string enumerated > values, I also don't understand the point of exporting > HIDEPID_NOT_PTRACEABLE. I don't think we need to ever let > people use the numeric value. > > My sense is that if we are switching to string values we should > just leave the existing numeric values as backwards compatiblity > and not do anything to make them easier to use. Yeah, that's what I had suggested too. Let's not export this to UAPI. -Kees > > Eric > > > Alexey Gladkov writes: > > > Suggested-by: Alexey Dobriyan > > Reviewed-by: Alexey Dobriyan > > Signed-off-by: Alexey Gladkov > > --- > > include/linux/proc_fs.h | 9 +-------- > > include/uapi/linux/proc_fs.h | 13 +++++++++++++ > > 2 files changed, 14 insertions(+), 8 deletions(-) > > create mode 100644 include/uapi/linux/proc_fs.h > > > > diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h > > index afd38cae2339..d259817ec913 100644 > > --- a/include/linux/proc_fs.h > > +++ b/include/linux/proc_fs.h > > @@ -7,6 +7,7 @@ > > > > #include > > #include > > +#include > > > > struct proc_dir_entry; > > struct seq_file; > > @@ -27,14 +28,6 @@ struct proc_ops { > > unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); > > }; > > > > -/* definitions for hide_pid field */ > > -enum { > > - HIDEPID_OFF = 0, > > - HIDEPID_NO_ACCESS = 1, > > - HIDEPID_INVISIBLE = 2, > > - HIDEPID_NOT_PTRACEABLE = 4, /* Limit pids to only ptraceable pids */ > > -}; > > - > > /* definitions for proc mount option pidonly */ > > enum { > > PROC_PIDONLY_OFF = 0, > > diff --git a/include/uapi/linux/proc_fs.h b/include/uapi/linux/proc_fs.h > > new file mode 100644 > > index 000000000000..dc6d717aa6ec > > --- /dev/null > > +++ b/include/uapi/linux/proc_fs.h > > @@ -0,0 +1,13 @@ > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > +#ifndef _UAPI_PROC_FS_H > > +#define _UAPI_PROC_FS_H > > + > > +/* definitions for hide_pid field */ > > +enum { > > + HIDEPID_OFF = 0, > > + HIDEPID_NO_ACCESS = 1, > > + HIDEPID_INVISIBLE = 2, > > + HIDEPID_NOT_PTRACEABLE = 4, > > +}; > > + > > +#endif -- Kees Cook