linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Anders Roxell <anders.roxell@linaro.org>,
	dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com,
	ard.biesheuvel@linaro.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v3 1/2] ima: fix build error redeclaration of enumerator
Date: Thu, 14 Feb 2019 21:45:34 -0500	[thread overview]
Message-ID: <1550198734.4107.53.camel@linux.ibm.com> (raw)
In-Reply-To: <1550165329.3980.8.camel@linux.ibm.com>

On Thu, 2019-02-14 at 12:28 -0500, Mimi Zohar wrote:
> On Wed, 2019-02-13 at 23:16 +0100, Anders Roxell wrote:
> > Commit a893ea15d764 ("tpm: move tpm_chip definition to
> > include/linux/tpm.h") introduced a build error when both ima and efi is
> > enabled. What happens is that both headers (ima.h and efi.h) defines the
> > same 'NONE' constant, and it broke when they started getting included
> > from the same file.
> > 
> > In file included from ../security/integrity/ima/ima_fs.c:30:
> > ../security/integrity/ima/ima.h:176:7: error: redeclaration of enumerator "NONE"
> >   hook(NONE)   \
> >        ^~~~
> > ../security/integrity/ima/ima.h:188:34: note: in definition of macro "__ima_hook_enumify"
> >  #define __ima_hook_enumify(ENUM) ENUM,
> >                                   ^~~~
> > ../security/integrity/ima/ima.h:191:2: note: in expansion of macro "__ima_hooks"
> >   __ima_hooks(__ima_hook_enumify)
> >   ^~~~~~~~~~~
> > In file included from ../arch/arm64/include/asm/acpi.h:15,
> >                  from ../include/acpi/acpi_io.h:7,
> >                  from ../include/linux/acpi.h:47,
> >                  from ../include/linux/tpm.h:26,
> >                  from ../security/integrity/ima/ima.h:25,
> >                  from ../security/integrity/ima/ima_fs.c:30:
> > ../include/linux/efi.h:1723:2: note: previous definition of "NONE" was here
> >   NONE,
> >   ^~~~
> > make[4]: *** [../scripts/Makefile.build:277: security/integrity/ima/ima_fs.o] Error 1
> > 
> > Rework to prefix the ima enum with 'IMA_*'.
> > 
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> 
> Ok, this looks reasonable, but will have a minor clash with Gustavo's
> "security: mark expected switch fall-throughs and add a missing
> break".

This patch correctly didn't modify the IMA policy keywords, just the
enumeration, but now the <securityfs> policy file incorrectly displays
the "ima_" prefixed names.

Instead of maintaining an enumeration and the corresponding
stringified version of the enumeration, there is a single list with
two macros.  One of these macros needs to be modified.  Instead of
modifying the the hook names directly, I would probably modify the
enumeration macro.

#define __ima_hook_enumify(ENUM)        ENUM,

enum ima_hooks {
        __ima_hooks(__ima_hook_enumify)
};

and

#define __ima_hook_stringify(str)       (#str),

static const char *const func_tokens[] = {
        __ima_hooks(__ima_hook_stringify)
};

Mimi


  reply	other threads:[~2019-02-15  2:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 22:16 [PATCH v3 1/2] ima: fix build error redeclaration of enumerator Anders Roxell
2019-02-13 22:16 ` [PATCH v3 2/2] efi: " Anders Roxell
2019-02-14 17:28 ` [PATCH v3 1/2] ima: " Mimi Zohar
2019-02-15  2:45   ` Mimi Zohar [this message]
2019-02-15 22:32   ` James Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550198734.4107.53.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=anders.roxell@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bp@alien8.de \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=jmorris@namei.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).