From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48704 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932296AbeCSK7k (ORCPT ); Mon, 19 Mar 2018 06:59:40 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2JAxXLg140322 for ; Mon, 19 Mar 2018 06:59:39 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gt858s8x2-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 19 Mar 2018 06:59:38 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Mar 2018 10:59:24 -0000 Subject: Re: [PATCH] ima: Avoid using not initialized IMA From: Mimi Zohar To: James Morris Cc: Petr Vorel , linux-integrity@vger.kernel.org, Dmitry Kasatkin Date: Mon, 19 Mar 2018 06:59:19 -0400 In-Reply-To: References: <20180316232827.3791-1-pvorel@suse.cz> <1521336476.3503.74.camel@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Message-Id: <1521457159.3503.93.camel@linux.vnet.ibm.com> Sender: linux-integrity-owner@vger.kernel.org List-ID: On Mon, 2018-03-19 at 15:43 +1100, James Morris wrote: > On Sat, 17 Mar 2018, Mimi Zohar wrote: > > > On Sat, 2018-03-17 at 00:28 +0100, Petr Vorel wrote: > > > IMA requires have it's hash algorithm to be compiled-in due it's early > > > use. Default IMA algorithm is protected by Kconfig to be compiled-in. > > > > > > ima_hash kernel parameter allows to choose hash algorithm. When > > > specified algorithm not available or available as module, IMA > > > initialization fails, but mknodat syscall expect it and calls > > > ima_post_path_mknod(). This leads to to kernel oops: > > > > > > $ grep CONFIG_CRYPTO_MD4 .config > > > CONFIG_CRYPTO_MD4=m > > > > > > [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4 > > > ... > > > [ 1.545190] ima: Can not allocate md4 (reason: -2) > > > > The hash algorithm specified on the boot command line needs to be > > builtin. For whatever reason it isn't builtin, rather than skipping > > measurements, a better solution I think would be to fallback to the > > builtin hash algorithm. > > What if this falls back to a hash which is not secure enough? It should fallback to the Kconfig selected hash algorithm as defined in CONFIG_IMA_DEFAULT_HASH. Mimi