diff mbox series

[RFC,v2,3/4] ima/ima_boot_aggregate: Increase MAX_EVENT_SIZE to 8k

Message ID 20180314155731.5943-4-pvorel@suse.cz
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series Rewrite tests into new API + fixes | expand

Commit Message

Petr Vorel March 14, 2018, 3:57 p.m. UTC
This is needed as according IMA developers there are BIOS events larger
than 4k [1]. Actual size for TPM 1.2 is undefined, TPM 2.0 specifies:
"For software parsing the event log, the parser can choose an arbitrary
maximum size, but this specification recommends a maximum value for the
TCG_PCR_EVENT2.eventSize field of 1MB." [2].

So hope 8k is enough.

[1] http://lists.linux.it/pipermail/ltp/2018-January/006970.html
[2] http://lists.linux.it/pipermail/ltp/2018-January/007002.html

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mimi Zohar March 27, 2018, 7:44 p.m. UTC | #1
[Cc'ing George Wilson]

On Wed, 2018-03-14 at 16:57 +0100, Petr Vorel wrote:
> This is needed as according IMA developers there are BIOS events larger
> than 4k [1]. Actual size for TPM 1.2 is undefined, TPM 2.0 specifies:
> "For software parsing the event log, the parser can choose an arbitrary
> maximum size, but this specification recommends a maximum value for the
> TCG_PCR_EVENT2.eventSize field of 1MB." [2].
> 
> So hope 8k is enough.

Is there a way of making this value system dependent?  On my 
laptop this is fine, but for PowerVM w/TPM 1.2 I've been told this is
too small.

> [1] http://lists.linux.it/pipermail/ltp/2018-January/006970.html
> [2] http://lists.linux.it/pipermail/ltp/2018-January/007002.html
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>

> ---
>  testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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 f7ae77cb1..c52cea4c9 100644
> --- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
> +++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
> @@ -30,7 +30,7 @@ char *TCID = "ima_boot_aggregate";
>  #if HAVE_LIBCRYPTO
>  #include <openssl/sha.h>
> 
> -#define MAX_EVENT_SIZE 500
> +#define MAX_EVENT_SIZE 8192
>  #define EVENT_HEADER_SIZE 32
>  #define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)
>  #define NUM_PCRS 8		/*  PCR registers 0-7 in boot aggregate */
George Wilson March 27, 2018, 10:23 p.m. UTC | #2
Mimi Zohar <zohar@linux.vnet.ibm.com> wrote on 03/27/2018 02:44:15 PM:

> From: Mimi Zohar <zohar@linux.vnet.ibm.com>
> To: Petr Vorel <pvorel@suse.cz>, ltp@lists.linux.it
> Cc: linux-integrity@vger.kernel.org, George Wilson/Austin/IBM@IBMUS
> Date: 03/27/2018 02:44 PM
> Subject: Re: [RFC PATCH v2 3/4] ima/ima_boot_aggregate: Increase
MAX_EVENT_SIZE to 8k
>
> [Cc'ing George Wilson]
>
> On Wed, 2018-03-14 at 16:57 +0100, Petr Vorel wrote:
> > This is needed as according IMA developers there are BIOS events larger
> > than 4k [1]. Actual size for TPM 1.2 is undefined, TPM 2.0 specifies:
> > "For software parsing the event log, the parser can choose an arbitrary
> > maximum size, but this specification recommends a maximum value for the
> > TCG_PCR_EVENT2.eventSize field of 1MB." [2].
> >
> > So hope 8k is enough.
>
> Is there a way of making this value system dependent?  On my
> laptop this is fine, but for PowerVM w/TPM 1.2 I've been told this is
> too small.

Why not follow the spec?  PowerVM has enormous events because they
were allowed by the 1.2 spec.  The 2.0 spec recommends 1M so I think
they should be at least 1M.  Because they're large, they should really
be dynamically allocated.

>
> > [1] http://lists.linux.it/pipermail/ltp/2018-January/006970.html
> > [2] http://lists.linux.it/pipermail/ltp/2018-January/007002.html
> >
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
>
> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
>
> > ---
> >  testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c | 2
+-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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 f7ae77cb1..c52cea4c9 100644
> > --- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
> > +++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
> > @@ -30,7 +30,7 @@ char *TCID = "ima_boot_aggregate";
> >  #if HAVE_LIBCRYPTO
> >  #include <openssl/sha.h>
> >
> > -#define MAX_EVENT_SIZE 500
> > +#define MAX_EVENT_SIZE 8192
> >  #define EVENT_HEADER_SIZE 32
> >  #define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)
> >  #define NUM_PCRS 8      /*  PCR registers 0-7 in boot aggregate */
<html><body><p><tt><font size="2">Mimi Zohar &lt;zohar@linux.vnet.ibm.com&gt; wrote on 03/27/2018 02:44:15 PM:<br><br>&gt; From: Mimi Zohar &lt;zohar@linux.vnet.ibm.com&gt;</font></tt><br><tt><font size="2">&gt; To: Petr Vorel &lt;pvorel@suse.cz&gt;, ltp@lists.linux.it</font></tt><br><tt><font size="2">&gt; Cc: linux-integrity@vger.kernel.org, George Wilson/Austin/IBM@IBMUS</font></tt><br><tt><font size="2">&gt; Date: 03/27/2018 02:44 PM</font></tt><br><tt><font size="2">&gt; Subject: Re: [RFC PATCH v2 3/4] ima/ima_boot_aggregate: Increase MAX_EVENT_SIZE to 8k</font></tt><br><tt><font size="2">&gt; <br>&gt; [Cc'ing George Wilson]<br>&gt; <br>&gt; On Wed, 2018-03-14 at 16:57 +0100, Petr Vorel wrote:<br>&gt; &gt; This is needed as according IMA developers there are BIOS events larger<br>&gt; &gt; than 4k [1]. Actual size for TPM 1.2 is undefined, TPM 2.0 specifies:<br>&gt; &gt; &quot;For software parsing the event log, the parser can choose an arbitrary<br>&gt; &gt; maximum size, but this specification recommends a maximum value for the<br>&gt; &gt; TCG_PCR_EVENT2.eventSize field of 1MB.&quot; [2].<br>&gt; &gt; <br>&gt; &gt; So hope 8k is enough.<br>&gt; <br>&gt; Is there a way of making this value system dependent?  On my <br>&gt; laptop this is fine, but for PowerVM w/TPM 1.2 I've been told this is<br>&gt; too small.</font></tt><br><br><tt><font size="2">Why not follow the spec? &nbsp;PowerVM has enormous events because they</font></tt><br><tt><font size="2">were allowed by the 1.2 spec. &nbsp;The 2.0 spec recommends 1M so I think</font></tt><br><tt><font size="2">they should be at least 1M. &nbsp;Because they're large, they should really</font></tt><br><tt><font size="2">be dynamically allocated.</font></tt><br><tt><font size="2"><br>&gt; <br>&gt; &gt; [1] <a href="http://lists.linux.it/pipermail/ltp/2018-January/006970.html">http://lists.linux.it/pipermail/ltp/2018-January/006970.html</a><br>&gt; &gt; [2] <a href="http://lists.linux.it/pipermail/ltp/2018-January/007002.html">http://lists.linux.it/pipermail/ltp/2018-January/007002.html</a><br>&gt; &gt; <br>&gt; &gt; Signed-off-by: Petr Vorel &lt;pvorel@suse.cz&gt;<br>&gt; <br>&gt; Acked-by: Mimi Zohar &lt;zohar@linux.vnet.ibm.com&gt;<br>&gt; <br>&gt; &gt; ---<br>&gt; &gt; &nbsp;testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c | 2 +-<br>&gt; &gt; &nbsp;1 file changed, 1 insertion(+), 1 deletion(-)<br>&gt; &gt; <br>&gt; &gt; diff --git a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c b/testcases/kernel/security/integrity/<br>&gt; ima/src/ima_boot_aggregate.c<br>&gt; &gt; index f7ae77cb1..c52cea4c9 100644<br>&gt; &gt; --- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c<br>&gt; &gt; +++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c<br>&gt; &gt; @@ -30,7 +30,7 @@ char *TCID = &quot;ima_boot_aggregate&quot;;<br>&gt; &gt; &nbsp;#if HAVE_LIBCRYPTO<br>&gt; &gt; &nbsp;#include &lt;openssl/sha.h&gt;<br>&gt; &gt; <br>&gt; &gt; -#define MAX_EVENT_SIZE 500<br>&gt; &gt; +#define MAX_EVENT_SIZE 8192<br>&gt; &gt; &nbsp;#define EVENT_HEADER_SIZE 32<br>&gt; &gt; &nbsp;#define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)<br>&gt; &gt; &nbsp;#define NUM_PCRS 8 &nbsp; &nbsp; &nbsp;/* &nbsp;PCR registers 0-7 in boot aggregate */<br></font></tt><BR>
</body></html>
Petr Vorel March 29, 2018, 6:18 a.m. UTC | #3
Hi George,

> > Is there a way of making this value system dependent?  On my
> > laptop this is fine, but for PowerVM w/TPM 1.2 I've been told this is
> > too small.

> Why not follow the spec?  PowerVM has enormous events because they
> were allowed by the 1.2 spec.  The 2.0 spec recommends 1M so I think
> they should be at least 1M.  Because they're large, they should really
> be dynamically allocated.
Make sense. Lets try 1M.
Thanks a lot for your input.


Kind regards,
Petr
diff mbox series

Patch

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 f7ae77cb1..c52cea4c9 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
@@ -30,7 +30,7 @@  char *TCID = "ima_boot_aggregate";
 #if HAVE_LIBCRYPTO
 #include <openssl/sha.h>
 
-#define MAX_EVENT_SIZE 500
+#define MAX_EVENT_SIZE 8192
 #define EVENT_HEADER_SIZE 32
 #define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)
 #define NUM_PCRS 8		/*  PCR registers 0-7 in boot aggregate */