summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2014-01-14 13:27:17 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-01-15 16:36:07 -0600
commit1519b0b4786367a4855edfd24844b896293d5d80 (patch)
tree6f623748e529c8b8a7bf3aa958c320f349108296
parent728120d7abd9c4d7ebfca8b212a2bdc4a4f93b4e (diff)
downloadblackbird-hostboot-1519b0b4786367a4855edfd24844b896293d5d80.tar.gz
blackbird-hostboot-1519b0b4786367a4855edfd24844b896293d5d80.zip
Potential buffer overrun in trace collection.
Change-Id: I8352c37f3789c684df24b75e85abca9fddfa314f Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/8054 Tested-by: Jenkins Server Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/usr/errl/errlentry.H8
-rw-r--r--src/usr/trace/buffer.C6
-rw-r--r--src/usr/vpd/ipvpd.C12
3 files changed, 18 insertions, 8 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H
index 2050deda8..78a084a7f 100644
--- a/src/include/usr/errl/errlentry.H
+++ b/src/include/usr/errl/errlentry.H
@@ -46,6 +46,7 @@
// I n c l u d e s
/*****************************************************************************/
#include <stdint.h>
+#include <limits.h>
#include <vector>
#include <errl/hberrltypes.H>
#include <errl/errlsctn.H>
@@ -426,12 +427,17 @@ public:
* @param[in] i_name Trace buffer name
* @param[in] i_max Size of trace to capture.
*
+ * @note: 'i_max = 0' implies to collect all of the trace available for
+ * that component. This is actually dangerous in Hostboot because
+ * our trace buffer are not hard-limited. The default of this
+ * function will be 1K to keep us at a reasonable limit.
+ *
* @return A Boolean indication of success. False likely means
* the trace buffer name given is not found. However, check the ERRL
* trace buffer for the cause of the failure.
*/
bool collectTrace(const char i_name[],
- const uint64_t i_max = 0);
+ const uint64_t i_max = KILOBYTE);
/**
* @brief Remove the back trace user detail data
diff --git a/src/usr/trace/buffer.C b/src/usr/trace/buffer.C
index a405f54c7..425df2ac7 100644
--- a/src/usr/trace/buffer.C
+++ b/src/usr/trace/buffer.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* COPYRIGHT International Business Machines Corp. 2012,2014 */
/* */
/* p1 */
/* */
@@ -484,6 +484,10 @@ namespace TRACE
continue;
}
}
+ else // This entry was too big to fit, so roll back one.
+ {
+ entry = entry->prev;
+ }
break;
}
diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C
index 57cebf13e..527946287 100644
--- a/src/usr/vpd/ipvpd.C
+++ b/src/usr/vpd/ipvpd.C
@@ -293,7 +293,7 @@ errlHndl_t IpVpdFacade::translateRecord ( ipVpdRecord i_record,
0x0,
true /*Add HB SW Callout*/ );
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
break;
}
@@ -358,7 +358,7 @@ errlHndl_t IpVpdFacade::translateKeyword ( ipVpdKeyword i_keyword,
err->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE,
HWAS::SRCI_PRIORITY_MED);
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
break;
}
@@ -483,7 +483,7 @@ errlHndl_t IpVpdFacade::findRecordOffset ( const char * i_record,
HWAS::SRCI_PRIORITY_LOW);
// Add trace to the log so we know what record was being requested.
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
}
// Return the offset found, after byte swapping it.
@@ -701,7 +701,7 @@ errlHndl_t IpVpdFacade::findKeywordAddr ( const char * i_keywordName,
HWAS::SRCI_PRIORITY_LOW);
// Add trace so we see what record was being compared
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
break;
}
@@ -836,7 +836,7 @@ errlHndl_t IpVpdFacade::findKeywordAddr ( const char * i_keywordName,
HWAS::SRCI_PRIORITY_LOW);
// Add trace so we know what Record/Keyword was missing
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
}
TRACSSCOMP( g_trac_vpd,
@@ -987,7 +987,7 @@ errlHndl_t IpVpdFacade::checkBufferSize( size_t i_bufferSize,
err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
HWAS::SRCI_PRIORITY_LOW);
- err->collectTrace( "VPD" );
+ err->collectTrace( "VPD", 256 );
}
OpenPOWER on IntegriCloud