Fix an issue in function (was_last_boot_error(void)).
In begin_launch() , there is a was_last_boot_error().In was_last_boot_error() , 
there is a read_tb_error_code().
When read_tb_error_code() runs successfully and the value of parameter error is 
TB_ERR_NONE,the was_last_boot_error()
will return true.This results in displaying "TBOOT: last boot has error" in 
tboot log.

Signed-off-by: Shi Wangyi<shiwan...@gohighsec.com>

--- a/tboot/common/tb_error.c   Wed Jan 04 14:53:13 2017 -0800
+++ b/tboot/common/tb_error.c   Wed Jan 18 14:40:51 2017 +0800
@@ -181,7 +181,7 @@
 
     /* check TB_LAUNCH_ERR_IDX */
     if ( read_tb_error_code(&error) ) {
-        if ( error != TB_ERR_FIXED )
+        if ( error != TB_ERR_FIXED && error != TB_ERR_NONE )
             return true;
     }

Thanks
Wangyi
 
From: Sun, Ning
Date: 2017-01-18 02:36
To: shiwan...@gohighsec.com; tboot-devel
Subject: RE: [tboot-devel] an issue in function (was_last_boot_error(void))
This is good catch, can you please sign off your patch?
 
Thanks,
-ning
 
From: shiwan...@gohighsec.com [mailto:shiwan...@gohighsec.com] 
Sent: Sunday, January 15, 2017 10:08 PM
To: tboot-devel <tboot-devel@lists.sourceforge.net>
Subject: [tboot-devel] an issue in function (was_last_boot_error(void))
 
Hi,

There is an issue in function (was_last_boot_error(void)).
In begin_launch() , there is a was_last_boot_error().In was_last_boot_error() , 
there is a read_tb_error_code().
When read_tb_error_code() runs successfully and the value of parameter error is 
TB_ERR_NONE,the was_last_boot_error()
will return true.This results in displaying "TBOOT: last boot has error" in 
tboot log.
 
Here is a patch against 1.9.5 which corrects the problem:
---------------------------------------------------------------------------
diff -urNp a/tboot/common/tb_error.c b/tboot/common/tb_error.c 
--- a/tboot/common/tb_error.c   2017-01-12 22:20:13.000000000 -0500
+++ b/tboot/common/tb_error.c   2017-01-16 00:39:14.000000000 -0500
@@ -193,7 +193,7 @@ bool was_last_boot_error(void)
 
     /* check TB_LAUNCH_ERR_IDX */
     if ( read_tb_error_code(&error) ) {
-        if ( error != TB_ERR_FIXED )
+        if ( error != TB_ERR_FIXED && error != TB_ERR_NONE )
             return true;
     }


Thanks
Wangyi
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to