lib: tst_taint: Ignore WARN taint flag if already set
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
This commit changes the library so that it ignores the taint warn flag if it was set prior to the test run. It turns out that the warn taint flag is not well defined and could be easily set on a freshly booted kernel for example when buggy BIOS is detected.
---
I haven't tested this, since I don't have a system where the flag is set at hand, but it's simple enough so that it should work as expected.
lib/tst_taint.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
lib/tst_taint.c +6 -1
@@ -82,8 +82,13 @@ void tst_taint_init(unsigned int mask)tst_res (TCONF ,"Kernel is too old for requested mask" ); taint_mask = mask; - taint =tst_taint_read (); + +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ; + } +if ((taint & mask) !=0 )tst_brk (TBROK ,"Kernel is already tainted: %u" , taint); }
Signature · 1 line
2.21.0
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
----- Original Message -----
Quoted 21 lines
This commit changes the library so that it ignores the taint warn flag if it was set prior to the test run. It turns out that the warn taint flag is not well defined and could be easily set on a freshly booted kernel for example when buggy BIOS is detected.
Signed-off-by Cyril Hrubis <[email protected]>CC Jan Stancek <[email protected]>CC Chang Yin <[email protected]>---
I haven't tested this, since I don't have a system where the flag is set at hand, but it's simple enough so that it should work as expected.
lib/tst_taint.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)lib/tst_taint.c +0
-0
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 89
Quoted 9 lines
lib/tst_taint.c +4
-1@@ -82,8 +82,13 @@ void tst_taint_init(unsigned int mask)tst_res (TCONF ,"Kernel is too old for requested mask" ); taint_mask = mask; - taint =tst_taint_read (); + +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ;
Shouldn't this rather mask it from taint_mask? Otherwise, won't you still get an error in tst_taint_check()?
Quoted 9 lines
lib/tst_taint.c +2
-1+ } +if ((taint & mask) !=0 )tst_brk (TBROK ,"Kernel is already tainted: %u" , taint); } --2.21.0
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
Hi!
Quoted 7 lines
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 89
Quoted 4 lines
lib/tst_taint.c +4
-0+ +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ;Shouldn't this rather mask it from
taint_mask? Otherwise, won't you still get an error intst_taint_check()?
Of course.
Quoted 3 lines
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 92
Quoted 3 lines
lib/tst_taint.c +2
-0+ } +if ((taint & mask) !=0 )
And this has to be changed so that we check the taint againts the taint_mask .
Quoted 6 lines
Quoted 6 lines
tst_brk(TBROK, "Kernel is already tainted: %u", taint);
}
--
2.21.0
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
Hi Cyril,
Per the discussion in history, I'm asking do you plan to draft patch v2 for it?
Or, do we have new thoughts on this?
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200413/ff112266/attachment.htm>
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
In reply to Cyril HrubisHi,
Quoted 25 lines · Cyril Hrubis
This commit changes the library so that it ignores the taint warn flag if it was set prior to the test run. It turns out that the warn taint flag is not well defined and could be easily set on a freshly booted kernel for example when buggy BIOS is detected.>
Signed-off-by Cyril Hrubis <[email protected]>CC Jan Stancek <[email protected]>CC Chang Yin <[email protected]>---
I haven't tested this, since I don't have a system where the flag is set at hand, but it's simple enough so that it should work as expected.
lib/tst_taint.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)lib/tst_taint.c +0
-1@@ -82,8 +82,13 @@ void tst_taint_init(unsigned int mask)tst_res (TCONF ,"Kernel is too old for requested mask" ); taint_mask = mask; -
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 94
Quoted 10 lines
lib/tst_taint.c +6
-0taint =tst_taint_read (); + +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ; + } +if ((taint & mask) !=0 )tst_brk (TBROK ,"Kernel is already tainted: %u" , taint); }
Tests may rely on TAINT_W to decide the result. If we need TAINT_W, we can only run the test when it was not set before. For example, testcases/cve/cve-2017-17053.c relies on this.
This may render this testcase unusable, or do I get this wrong?
Signature · 11 lines
Michael Moese <[email protected]> QA Engineer PGP Fingerprint: 4CCE 3896 F873 2CA5 2382 3C6F 6021 375C 8635 7E74 SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 N?rnberg Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Felix Imend?rffer
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
----- Original Message -----
Quoted 35 lines
Hi,
Quoted 32 lines · Cyril Hrubis
This commit changes the library so that it ignores the taint warn flag if it was set prior to the test run. It turns out that the warn taint flag is not well defined and could be easily set on a freshly booted kernel for example when buggy BIOS is detected.>
Signed-off-by Cyril Hrubis <[email protected]>CC Jan Stancek <[email protected]>CC Chang Yin <[email protected]>---
I haven't tested this, since I don't have a system where the flag is set at hand, but it's simple enough so that it should work as expected.
lib/tst_taint.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)lib/tst_taint.c +6
-1@@ -82,8 +82,13 @@ void tst_taint_init(unsigned int mask)tst_res (TCONF ,"Kernel is too old for requested mask" ); taint_mask = mask; - taint =tst_taint_read (); + +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ; + } +if ((taint & mask) !=0 )
Quoted 8 lines
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 94
Quoted 3 lines
lib/tst_taint.c +0
-0tst_brk (TBROK ,"Kernel is already tainted: %u" , taint); }Tests may rely on
TAINT_Wto decide the result.
If we needTAINT_W, we can only run the test when it was not set before. For example,testcases/cve/cve-2017-17053.crelies on this.
This may render this testcase unusable, or do I get this wrong?
Patch masks TAINT_W if that taint flag was set before test started. In such case, test can't determine result accurately anyway.
I wonder if there is more specific way for cve-2017-17053 to determine error condition. For example by inspecting new messages in dmesg.
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
Hi!
Quoted 2 lines
I wonder if there is more specific way for cve-2017-17053 to determine error condition. For example by inspecting new messages in dmesg.
We wanted to avoid that because the taint flags looked like a nice and simple solution...
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 lib: tst_taint: Ignore WARN taint flag if already set
In reply to Michael MoeseHi!
Quoted 17 lines
Quoted 17 lines
lib/tst_taint.c +6
-1@@ -82,8 +82,13 @@ void tst_taint_init(unsigned int mask)tst_res (TCONF ,"Kernel is too old for requested mask" ); taint_mask = mask; - taint =tst_taint_read (); + +if (mask &TST_TAINT_W && taint &TST_TAINT_W ) { +tst_res (TCONF ,"Ignoring already set kernel warning taint" ); + mask &= ~TST_TAINT_W ; + } +if ((taint & mask) !=0 )
Quoted 8 lines
lib/tst_taint.c void tst_taint_init(unsigned int mask) · line 94
Quoted 3 lines
lib/tst_taint.c +0
-0tst_brk (TBROK ,"Kernel is already tainted: %u" , taint); }Tests may rely on
TAINT_Wto decide the result. If we needTAINT_W, we can only run the test when it was not set before. For example,testcases/cve/cve-2017-17053.crelies on this.
This may render this testcase unusable, or do I get this wrong?
Only on systems where something set the flag already. Ideally that will not happen on many systems.
Signature · 2 lines
Cyril Hrubis [email protected]