[coreboot-gerrit] Patch set updated for coreboot: kconfig_lint: Fix checks when running in taint mode

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Fri Feb 19 19:18:24 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13751

-gerrit

commit 7432b06b90b7b3be05e1e4ebeffd0e2db732921e
Author: Martin Roth <martinroth at google.com>
Date:   Fri Feb 19 10:24:25 2016 -0700

    kconfig_lint: Fix checks when running in taint mode
    
    The builders run perl scripts in taint mode, and some of the checks
    that the kconfig lint script were running were tainted, causing
    the script to terminate early when running on the servers.
    
    This checks to see if taint mode is enabled, and untaints the path
    if it is.  All exernal tools (git & grep) must be in /bin or /usr/bin.
    This also removes the check for unused kconfig files if taint mode
    is enabled.
    
    Change-Id: I8d1e1c32275f759d085759fb5d8a6c85d4f99539
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 util/lint/kconfig_lint | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index b5a62d3..e8445b2 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -26,6 +26,12 @@ use File::Find;
 use Getopt::Long;
 use Getopt::Std;
 
+# If taint mode is enabled, Untaint the path - git and grep must be in /bin or /usr/bin
+if ( ${^TAINT} ) {
+    $ENV{'PATH'} = '/bin:/usr/bin';
+    delete @ENV{ 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
+}
+
 my $suppress_error_output   = 0;      # flag to prevent error text
 my $suppress_warning_output = 0;      # flag to prevent warning text
 my $show_note_output        = 0;      # flag to show minor notes text
@@ -76,9 +82,6 @@ sub Main {
     #load the Kconfig tree, checking what we can and building up all the hash tables
     build_and_parse_kconfig_tree("$root_dir/Kconfig");
 
-    #run checks based on the data that was found
-    find( \&check_if_file_referenced, $root_dir );
-
     load_config($config_file) if ($config_file);
 
     check_defaults();
@@ -91,6 +94,14 @@ sub Main {
     check_is_enabled();
     check_selected_symbols();
 
+    #run checks based on the data that was found
+    if ( ( !$suppress_warning_output ) && ( ${^TAINT} == 0 ) ) {
+
+        # the find function is tainted - only run it if taint checking
+        # is disabled and warnings are enabled.
+        find( \&check_if_file_referenced, $root_dir );
+    }
+
     print_wholeconfig();
 
     if ($errors_found) {



More information about the coreboot-gerrit mailing list