Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2182315ybz; Thu, 23 Apr 2020 13:06:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKcFb62pFijuqfS5iaQXsglDr5NkjBN1Oh1R/zfQry2Jy5UIDshCnjhv6s7Ob8dJBITGydg X-Received: by 2002:a05:6402:21d7:: with SMTP id bi23mr4125487edb.176.1587672401653; Thu, 23 Apr 2020 13:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587672401; cv=none; d=google.com; s=arc-20160816; b=B7q1gPjjoN9pFK1N8goxb8DUIjd8SC/DidO+cWkJFKUCfM5Mlbj5Qf09DZbHjXE2IW sJjBLt4IczOaKvVirSykqplZ5RrOveXYlcdtP2p3/WbpOkXzJezglPW/zZyq4CinwGVk t7Imv25Lx6VpWKlGM38+CvRN2pSnuJIe7bdY5CETGJNbUI9BRn5DznhOiJaMfRlGNJv7 ktX4P/8h7Sdsvy+XtJa33DP2hlAni6PEcyMC1RPuFNUBf3iHbC1TDDObmOuZtJW9C5Ne Or1uzmlOOf4dGUSciAy6blEPgPgWsSPWK//QOure5jwPfXpSxyFs+wgJmsih2MzG28Ca LmuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8EOSr0mRjwJ3c2jETb5Cv11Ww2B7x+8m26cNTabzq/Y=; b=EVC/R+71OIez1U3jLIqtbJ1kgI8RjpRo8LFZD3NpOtis6BIjj49nExUD43lxyhy1uR HTNnNBu5ANzEaHBmiA/uRzUDpa8nmAPGFHYxqm/OaaDqi6FPgkBQKxvZhctZ/9aKAU5a 7FwQdwPQTt+8OOllut5f9DjN2nv+z84e8qftdcPzSDQPrGLBWPV6tgDgWttUsw+BFcWD SYaczgBMhMEDquvXLN6Rmrom/Q3yrLh33oHOhZvCFz+55hP9UZ2xOM/ZACXA4Up+fv72 xdWsMkfydMuNfbSioRhxwxl2izfb9LSb1GeHQqtamcdcv7j3Q6QoTu87l5r7wF1R3roD rQlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si1873779ejd.76.2020.04.23.13.06.15; Thu, 23 Apr 2020 13:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbgDWUD4 (ORCPT + 99 others); Thu, 23 Apr 2020 16:03:56 -0400 Received: from raptor.unsafe.ru ([5.9.43.93]:48608 "EHLO raptor.unsafe.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgDWUDy (ORCPT ); Thu, 23 Apr 2020 16:03:54 -0400 Received: from comp-core-i7-2640m-0182e6.redhat.com (ip-89-102-33-211.net.upcbroadband.cz [89.102.33.211]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by raptor.unsafe.ru (Postfix) with ESMTPSA id 83BE120A0A; Thu, 23 Apr 2020 20:03:47 +0000 (UTC) From: Alexey Gladkov To: LKML Cc: 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" , "Eric W . Biederman" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Linus Torvalds , Oleg Nesterov , David Howells Subject: [PATCH v13 8/8] proc: use named enums for better readability Date: Thu, 23 Apr 2020 22:03:16 +0200 Message-Id: <20200423200316.164518-9-gladkov.alexey@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423200316.164518-1-gladkov.alexey@gmail.com> References: <20200423200316.164518-1-gladkov.alexey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.1 (raptor.unsafe.ru [5.9.43.93]); Thu, 23 Apr 2020 20:03:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Alexey Gladkov Reviewed-by: Alexey Dobriyan Reviewed-by: Kees Cook --- fs/proc/base.c | 2 +- fs/proc/inode.c | 2 +- fs/proc/root.c | 4 ++-- include/linux/proc_fs.h | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index a52a91e90c25..2868bff1a142 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -699,7 +699,7 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr) */ static bool has_pid_permissions(struct proc_fs_info *fs_info, struct task_struct *task, - int hide_pid_min) + enum proc_hidepid hide_pid_min) { /* * If 'hidpid' mount option is set force a ptrace check, diff --git a/fs/proc/inode.c b/fs/proc/inode.c index cbacac2e892b..f40c2532c057 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -166,7 +166,7 @@ void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock deactivate_super(old_sb); } -static inline const char *hidepid2str(int v) +static inline const char *hidepid2str(enum proc_hidepid v) { switch (v) { case HIDEPID_OFF: return "off"; diff --git a/fs/proc/root.c b/fs/proc/root.c index 288093261b7f..ffebed1999e5 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -32,9 +32,9 @@ struct proc_fs_context { struct pid_namespace *pid_ns; unsigned int mask; - int hidepid; + enum proc_hidepid hidepid; int gid; - int pidonly; + enum proc_pidonly pidonly; }; enum proc_param { diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 8bc31ba5cd9c..2cb424e6f36a 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -43,7 +43,7 @@ struct proc_ops { } __randomize_layout; /* definitions for hide_pid field */ -enum { +enum proc_hidepid { HIDEPID_OFF = 0, HIDEPID_NO_ACCESS = 1, HIDEPID_INVISIBLE = 2, @@ -51,7 +51,7 @@ enum { }; /* definitions for proc mount option pidonly */ -enum { +enum proc_pidonly { PROC_PIDONLY_OFF = 0, PROC_PIDONLY_ON = 1, }; @@ -61,8 +61,8 @@ struct proc_fs_info { struct dentry *proc_self; /* For /proc/self */ struct dentry *proc_thread_self; /* For /proc/thread-self */ kgid_t pid_gid; - int hide_pid; - int pidonly; + enum proc_hidepid hide_pid; + enum proc_pidonly pidonly; }; static inline struct proc_fs_info *proc_sb_info(struct super_block *sb) -- 2.25.3