From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030382AbcDMLx4 (ORCPT ); Wed, 13 Apr 2016 07:53:56 -0400 Received: from e28smtp02.in.ibm.com ([125.16.236.2]:43285 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934575AbcDMLxy (ORCPT ); Wed, 13 Apr 2016 07:53:54 -0400 X-IBM-Helo: d28relay04.in.ibm.com X-IBM-MailFrom: zohar@linux.vnet.ibm.com X-IBM-RcptTo: linux-doc@vger.kernel.org;linux-kernel@vger.kernel.org;linux-security-module@vger.kernel.org Message-ID: <1460548401.3256.58.camel@linux.vnet.ibm.com> Subject: Re: [PATCH v4 5/6] fs: provide function to report enum strings From: Mimi Zohar To: Kees Cook Cc: Al Viro , James Morris , Joe Perches , Andy Shevchenko , Andrew Morton , "Serge E. Hallyn" , Jonathan Corbet , Kalle Valo , Mauro Carvalho Chehab , Guenter Roeck , Jiri Slaby , Paul Moore , Stephen Smalley , Casey Schaufler , Andreas Gruenbacher , Rasmus Villemoes , Ulf Hansson , Vitaly Kuznetsov , linux-security-module , LKML , "linux-doc@vger.kernel.org" Date: Wed, 13 Apr 2016 07:53:21 -0400 In-Reply-To: References: <1460480085-32263-1-git-send-email-keescook@chromium.org> <1460480085-32263-6-git-send-email-keescook@chromium.org> <20160412223117.GP25498@ZenIV.linux.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 16041311-0005-0000-0000-00000BEA6DD8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-04-12 at 15:38 -0700, Kees Cook wrote: > On Tue, Apr 12, 2016 at 3:31 PM, Al Viro wrote: > > On Tue, Apr 12, 2016 at 09:54:44AM -0700, Kees Cook wrote: > >> Providing human-readable (and audit-parsable) strings for the READING_* > >> enums is needed by some LSMs. > >> > >> Signed-off-by: Kees Cook > >> --- > >> fs/exec.c | 19 +++++++++++++++++++ > >> include/linux/fs.h | 1 + > >> 2 files changed, 20 insertions(+) > > > > What the devil is that doing in fs/exec.c, of all places? > > Since that's where the kernel_read* functions that use the enum live, > it seemed like the right place to put the string function too. I'm > happy to move it where ever folks think it's best to live. Al, The problem is keeping the enum and corresponding string in sync. As soon as the enum definition is separated from the string definition, it will become a problem. I've tried to use _stringify() to initialize both the enum and the string, but it is ugly. Perhaps someone else has a better, prettier method. Mimi