Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp701785ybt; Fri, 26 Jun 2020 09:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMGyelaQjbJXmmXkDsfQnaJtK9RlDXruQwbkpCGr0WZVpdwLmm53DT4Zh7Z5ehl9opykKX X-Received: by 2002:a17:906:1102:: with SMTP id h2mr3200672eja.356.1593188889441; Fri, 26 Jun 2020 09:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593188889; cv=none; d=google.com; s=arc-20160816; b=W88Vq9exIleDy0j/Pt48iCZElDto0h7AhJfFXUUfohRvcuCXrF7eYEH9M9AxNhKMdp 7vSNU+fMBvDEYxOMkcaS7J2hKQTYEEC+gKy60U7wbsS/gJQVPTyWZ2iyJM7h8GOmMBEw kGa5ZwdaEq3q8A9baSEYxxmTriRChWbxSgVTztwUub4+ifVqB1C3tDxjW7Q7gwkbJ+8g ycA+yir1a+a2QdzVCVXnc+RlpYZRJM4NqQQ6D7T+Z6LhUED6UvB3WIpjK+t+yIWV/2Nk 3jG5oQa9lSztsqxnEb2JzGUp9L4fltd7m81pzDgOadFzhbnl3dNQqq0JyV2XWwz2eKWE AVvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9/4yQ9wzdMYlIWsH7godn+Od1tjRMVkquLG0kHXWsUc=; b=ouDXUjEi8/tf25JWieKUQWtKSASuzKPav/QqPpNK+HvR/qDkzK86g7UoojIcmAbrW5 Ssf8QauWzoplHsnFRns45ZDaozVqJTVeJnT22j2MpJgnYPH2la5TrLoqmbcq5JpSYoz3 J7ed1WX73ZQLX9yC60yv89rSkCjRItZo6Zq03+PEmmzeLAyPH9aJ211Jmw1rFwK+p97H FqMC/DLBOgkNEM878wsVTvbsyAyxvN/dNYGR3tI1Np9NiUPJ52vopljAh+khfU4DuuvH TY+DyU7KnbKCfXFgGWz4LPS2HXKFNIVNLflzLmJMyyUZUBWw7SnDKz6WehvbTCGCqXlk H7WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DvUWczyo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy5si9527956edb.554.2020.06.26.09.27.46; Fri, 26 Jun 2020 09:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DvUWczyo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729317AbgFZOqp (ORCPT + 99 others); Fri, 26 Jun 2020 10:46:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37578 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725792AbgFZOqp (ORCPT ); Fri, 26 Jun 2020 10:46:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593182803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9/4yQ9wzdMYlIWsH7godn+Od1tjRMVkquLG0kHXWsUc=; b=DvUWczyo2Jm2NpCthl9SK32fBmcEbDy+6WdC8wzDv77+tvIBMniWknow8iqpdicLbfz+z8 DkPQ2Ne/mP/E9bHR3uMb7Sh7EIICe0m2Y/94n+hpJPcpTXhgpBO7bKVYAd3yrVSiq9u6wE vMh9zfY9AEPPksOCyMPHkSo8p2nzXuY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-cCaW3d4sPHaV1pZ_8ts9ag-1; Fri, 26 Jun 2020 10:46:34 -0400 X-MC-Unique: cCaW3d4sPHaV1pZ_8ts9ag-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4894B804006; Fri, 26 Jun 2020 14:46:33 +0000 (UTC) Received: from localhost (ovpn-116-153.gru2.redhat.com [10.97.116.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDD331002395; Fri, 26 Jun 2020 14:46:32 +0000 (UTC) Date: Fri, 26 Jun 2020 11:46:31 -0300 From: Bruno Meneguele To: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zohar@linux.ibm.com, erichte@linux.ibm.com, nayna@linux.ibm.com Subject: Re: [PATCH v3 0/2] ima: make appraisal state runtime dependent on secure boot Message-ID: <20200626144631.GC2702@glitch> References: <20200623202640.4936-1-bmeneg@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200623202640.4936-1-bmeneg@redhat.com> X-PGP-Key: http://keys.gnupg.net/pks/lookup?op=get&search=0x3823031E4660608D X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lCAWRPmW1mITcIfM" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --lCAWRPmW1mITcIfM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Gentle ping for review. I also forgot to add the changelog for the patch, please see below. On Tue, Jun 23, 2020 at 05:26:38PM -0300, Bruno Meneguele wrote: > To switch APPRAISE_BOOTPARAM and ARCH_POLICY dependency from compile time= to > run time the secure boot checking code (specific to each arch) had to be > slightly modified to include, in the PowerPC arch, the Trusted Boot state= , > which is also relevant to the arch policy choice and also required the > ima_appraise to be enforced.=20 >=20 > With that I changed the checking order: instead of first check the > arch_policy and then the secure/trusted boot state, now we first check th= e > boot state, set ima_appraise to be enforced and then the existence of arc= h > policy. In other words, whenever secure/trusted boot is enabled, > (ima_appraise & IMA_APPRAISE_ENFORCE) =3D=3D true. >=20 > I've tested these patches in a x86_64 platform with and without secure bo= ot > enabled and in a PowerPC without secure boot enabled: >=20 > 1) with secure boot enabled (x86_64) and ima_policy=3Dappraise_tcb, the > ima_appraise=3D options were completly ignored and the boot always failed= with > "missing-hash" for /sbin/init, which is the expected result; >=20 > 2) with secure boot enabled (x86_64), but no ima_policy: >=20 > [ 1.396111] ima: Allocated hash algorithm: sha256 > [ 1.424025] ima: setting IMA appraisal to enforced > [ 1.424039] audit: type=3D1807 audit(1592927955.557:2): action=3Dmeasu= re func=3DKEXEC_KERNEL_CHECK res=3D1 > [ 1.424040] audit: type=3D1807 audit(1592927955.557:3): action=3Dmeasu= re func=3DMODULE_CHECK res=3D1 >=20 > 3) with secure boot disabled (PowerPC and x86_64) and > "ima_policy=3Dappraise_tcb ima_appraise=3Dfix", audit messages were trigg= ered > with "op=3Dappraisal_data cause=3Dmissing-hash" but the system worked fin= e due > to "fix". Changelog: v2: - pr_info() message prefix correction v3: - extend secure boot arch checker to also consider trusted boot - enforce IMA appraisal when secure boot is effectively enabled (Nayna) - fix ima_appraise flag assignment by or'ing it (Mimi) >=20 > Bruno Meneguele (2): > arch/ima: extend secure boot check to include trusted boot > ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime >=20 > arch/powerpc/kernel/ima_arch.c | 5 +++-- > arch/s390/kernel/ima_arch.c | 2 +- > arch/x86/kernel/ima_arch.c | 4 ++-- > include/linux/ima.h | 4 ++-- > security/integrity/ima/Kconfig | 2 +- > security/integrity/ima/ima_main.c | 2 +- > security/integrity/ima/ima_policy.c | 20 ++++++++++++++------ > 7 files changed, 24 insertions(+), 15 deletions(-) >=20 > --=20 > 2.26.2 >=20 --=20 bmeneg=20 PGP Key: http://bmeneg.com/pubkey.txt --lCAWRPmW1mITcIfM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEdWo6nTbnZdbDmXutYdRkFR+RokMFAl72CkcACgkQYdRkFR+R okOBfAgAxpegp05PIswZixkunEPtvXqxm1Zxc0cVJOm6gsrj1kXj6RoQZBMdJYPb EL3uajD23pHhZuTR9A3vPMcsHrEuB0PQsMtD3mfBjdf0QNvbOWT4uLqaDlMYeMTm QFVcpxXjZ905/3f8dEsi0k6DqfGVj+OPIm/j2qauEMwvYvpNBo7z3UMrkm2RuZQW BfVncYCPcDCT6ahedthkNjshBwK5WVZKJ7DaH92U+lNH7wF61AAPTPs/AanrXgpu xT6lx/s0aZojzA7W+nhzC/6k7rhQJoZKxRX1wQYmtcxuabK85VHeWxRe1R+qfiNH fcE9qfW+aG4xKC5ZSlsWbMVTzxZFwQ== =HW86 -----END PGP SIGNATURE----- --lCAWRPmW1mITcIfM--