Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp210847imj; Thu, 14 Feb 2019 18:47:35 -0800 (PST) X-Google-Smtp-Source: AHgI3Iac7+zD0jubi5mqRoVHXwqK5EQm3Q6apXRIUsgrKIy/5Fo5AJYv8TMCIxjWgS3/g9BqsO1U X-Received: by 2002:a17:902:2be8:: with SMTP id l95mr7770130plb.270.1550198855673; Thu, 14 Feb 2019 18:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198855; cv=none; d=google.com; s=arc-20160816; b=pD70BSmW4JvqTnoNaATue1SrKk/qYC+CMlvYEsxtJe7e+8+CXPYQRsomwjzxS0SAns EuX9E+ZhIBJ6C9wWSBSxXC3jG1jScoubHU+gmGSQDUdObFp2BjXbyyZ/eKJSpZLEPfWe sUUmgi4kgmHnpZM2r/XBMFbB12iUtlDpOm5szVUh5KnQWa4HvDq4W6iQNNQkHVSNT443 5UcdP61bq3cguS3B8P/EYfEoWlI0Z0Gr/RWghSjI4+NTnztQN1Tdjrem7/6QaDqt6pUS ql55ldn8oWTot95Vdb2zMqctVr3aCJkbfYN40JpTBbu3kkmRQhyU05ywwEPyXt6jUGuI t9uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=umf53IkhWXx2b30Ctamnr/M6yGWCCeVBdPH7bTBZ7Ys=; b=YAc06WN6HHJAQU8ozp5zPq1li3s+zUiupyD7pe5hzyxpdVGmUmd4V+qyn5Ffe1bZqk bApr7cAbG3/j242pePTZOjae6eeeIwKq3h2SQBzYGuXRresuaWVpJi8dKp3GJqAzhN3b g3qJHQISn9lmEqR4roW4PEW+PJqQnakFvLtEA4C7dnkgX5K+tJrFaG0ZYeXv39/0qRrP JHxUVUKxBV+4LMWLrSzZfMu3ybdM/LwpgsIVdGid1QfhwMUCe4cdpym4zHSfdgl1QcEQ NJK0gjRVI+naUzdo8/GUZUtcy42Tl1A+uxlu8OZdMV4mSvAUZHkmZNLIKtNB+GYoGjaX brdQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12si608262pgh.257.2019.02.14.18.47.19; Thu, 14 Feb 2019 18:47:35 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729970AbfBOCp5 (ORCPT + 99 others); Thu, 14 Feb 2019 21:45:57 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40816 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728509AbfBOCp4 (ORCPT ); Thu, 14 Feb 2019 21:45:56 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1F2i27R009636 for ; Thu, 14 Feb 2019 21:45:55 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qnfed9vw7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Feb 2019 21:45:55 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Feb 2019 02:45:52 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 15 Feb 2019 02:45:48 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1F2jl9o19529894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 02:45:47 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3049BAE04D; Fri, 15 Feb 2019 02:45:47 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5642DAE051; Fri, 15 Feb 2019 02:45:45 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.92.50]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 15 Feb 2019 02:45:45 +0000 (GMT) Subject: Re: [PATCH v3 1/2] ima: fix build error redeclaration of enumerator From: Mimi Zohar To: Anders Roxell , 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 Date: Thu, 14 Feb 2019 21:45:34 -0500 In-Reply-To: <1550165329.3980.8.camel@linux.ibm.com> References: <20190213221625.7551-1-anders.roxell@linaro.org> <1550165329.3980.8.camel@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19021502-0020-0000-0000-00000317017F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021502-0021-0000-0000-000021683302 Message-Id: <1550198734.4107.53.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-15_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902150017 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Signed-off-by: Anders Roxell > > 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 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