From patchwork Wed Jan 16 02:57:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia Zhang X-Patchwork-Id: 10765365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3D9913B4 for ; Wed, 16 Jan 2019 02:58:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF5762B55D for ; Wed, 16 Jan 2019 02:58:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A069B2B596; Wed, 16 Jan 2019 02:58:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42E422B55D for ; Wed, 16 Jan 2019 02:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727883AbfAPC6K (ORCPT ); Tue, 15 Jan 2019 21:58:10 -0500 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:52058 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfAPC6K (ORCPT ); Tue, 15 Jan 2019 21:58:10 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=zhang.jia@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TIKLIeS_1547607465; Received: from localhost(mailfrom:zhang.jia@linux.alibaba.com fp:SMTPD_---0TIKLIeS_1547607465) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Jan 2019 10:57:45 +0800 From: Jia Zhang To: pvorel@suse.cz, zohar@linux.ibm.com Cc: linux-integrity@vger.kernel.org, ltp@lists.linux.it, zhang.jia@linux.alibaba.com Subject: [PATCH v3 1/6] ima/ima_boot_aggregate: Fix the definition of event log Date: Wed, 16 Jan 2019 10:57:36 +0800 Message-Id: <1547607461-11233-2-git-send-email-zhang.jia@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1547607461-11233-1-git-send-email-zhang.jia@linux.alibaba.com> References: <1547607461-11233-1-git-send-email-zhang.jia@linux.alibaba.com> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to [1], the structure of event log should be packed, and certain fields should be 32-bit unsigned integer. Fortunately, keeping natural alignment seems to make everything working as expected all the time. [1] page 17,18 @https://trustedcomputinggroup.org/wp-content/uploads/TCG_EFI_Protocol_1_22_Final-v05.pdf Signed-off-by: Jia Zhang Reviewed-by: Mimi Zohar Reviewed-by: Mimi Zohar --- testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c index f6e7be0..d85d222 100644 --- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c +++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c @@ -53,10 +53,10 @@ int main(int argc, char *argv[]) struct { struct { u_int32_t pcr; - int type; - unsigned char digest[SHA_DIGEST_LENGTH]; - u_int16_t len; - } header; + u_int32_t type; + u_int8_t digest[SHA_DIGEST_LENGTH]; + u_int32_t len; + } header __attribute__ ((packed)); char *data; } event; struct {