summaryrefslogtreecommitdiffstats
path: root/src/usr/errl
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2017-10-20 21:13:34 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-11-03 09:45:20 -0400
commit07d75753d59419ea6ba9ee3bd930e0aa8e7e7fd5 (patch)
tree78633da60312ff8cfd54807f787219036e976621 /src/usr/errl
parent47f275a6bd3b2104a82d9786122afd6fe25f05de (diff)
downloadtalos-hostboot-07d75753d59419ea6ba9ee3bd930e0aa8e7e7fd5.tar.gz
talos-hostboot-07d75753d59419ea6ba9ee3bd930e0aa8e7e7fd5.zip
Secure Boot: Enforce PNOR section component IDs
- In secure mode, bootloader will enforce that HBB component ID is set - In secure mode, Hostboot will enforce that PNOR component IDs are set Change-Id: I04f3bbc45417b3229003c56e1083e1fc31c01cd7 RTC: 179422 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48711 Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/errl')
-rw-r--r--src/usr/errl/errludstring.C56
-rw-r--r--src/usr/errl/plugins/errludparserfactoryerrl.H11
-rw-r--r--src/usr/errl/plugins/errludstring.H104
3 files changed, 163 insertions, 8 deletions
diff --git a/src/usr/errl/errludstring.C b/src/usr/errl/errludstring.C
index 43943774d..888a303b6 100644
--- a/src/usr/errl/errludstring.C
+++ b/src/usr/errl/errludstring.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -54,5 +56,57 @@ ErrlUserDetailsString::~ErrlUserDetailsString()
}
+// ErrlUserDetailsStringSet implementation
+
+ErrlUserDetailsStringSet::ErrlUserDetailsStringSet()
+{
+ // Set up ErrlUserDetails instance variables
+ iv_CompId = ERRL_COMP_ID;
+ iv_Version = ERRL_UDT_STRING_SET_VER_1;
+ iv_SubSection = ERRL_UDT_STRING_SET;
+
+ // override the default of false.
+ iv_merge = true;
}
+void ErrlUserDetailsStringSet::add(
+ const char* const i_pDescriptionString,
+ const char* const i_pString)
+{
+ // [Object Memory Layout]
+ //
+ // Offset Size Description
+ // =========================================================================
+ // 0 X Existing object contents before this call, where X=0 if
+ // this is the first add call to the object
+ // X Y NULL terminated description string describing the string
+ // being logged, where Y=strlen(this string) + length (1) of
+ // NULL terminator.
+ // X+Y Z NULL terminated FFDC string, where Z=strlen(this string) +
+ // length (1) of NULL terminator.
+
+ // Absorb API errors on error path and instead substitue error string for
+ // any input that is nullptr
+ const char* const pDescriptionString = (i_pDescriptionString == nullptr) ?
+ "BUG! Invalid description" : i_pDescriptionString;
+ const char* const pString = (i_pString == nullptr) ? "BUG! Invalid string" :
+ i_pString;
+
+ const auto currentSize = static_cast<size_t>(getUsrBufSize());
+ const auto descriptionSize = strlen(pDescriptionString)+1;
+ const auto stringSize = strlen(pString)+1;
+ const auto newSize = currentSize + descriptionSize + stringSize;
+ char* const pBuf = reinterpret_cast<char*>(
+ reallocUsrBuf(newSize));
+ strcpy(pBuf+currentSize, pDescriptionString);
+ strcpy(pBuf+currentSize+descriptionSize,pString);
+}
+
+ErrlUserDetailsStringSet::~ErrlUserDetailsStringSet()
+{
+
+}
+
+} // End of ERRORLOG namespace
+
+
diff --git a/src/usr/errl/plugins/errludparserfactoryerrl.H b/src/usr/errl/plugins/errludparserfactoryerrl.H
index 1db49a8dc..ebe7acb47 100644
--- a/src/usr/errl/plugins/errludparserfactoryerrl.H
+++ b/src/usr/errl/plugins/errludparserfactoryerrl.H
@@ -58,6 +58,7 @@ public:
ErrlUserDetailsParserFactoryErrl()
{
registerParser<ErrlUserDetailsParserString>(ERRL_UDT_STRING);
+ registerParser<ErrlUserDetailsParserStringSet>(ERRL_UDT_STRING_SET);
registerParser<ErrlUserDetailsParserTarget>(ERRL_UDT_TARGET);
registerParser<ErrlUserDetailsParserBackTrace>(ERRL_UDT_BACKTRACE);
registerParser<ErrlUserDetailsParserAttribute>(ERRL_UDT_ATTRIBUTE);
@@ -68,10 +69,16 @@ public:
private:
- // Disabled
- ErrlUserDetailsParserFactoryErrl(const ErrlUserDetailsParserFactoryErrl &);
+ // Parser isn't compiled with c++11 in all environments, and therefore
+ // "delete" of unused interfaces (like below) is not supported, nor are
+ // functions with move semantics
+
+ // Disable compiler provided default functions
+ ErrlUserDetailsParserFactoryErrl(
+ const ErrlUserDetailsParserFactoryErrl &);
ErrlUserDetailsParserFactoryErrl & operator=(
const ErrlUserDetailsParserFactoryErrl &);
+
};
}
diff --git a/src/usr/errl/plugins/errludstring.H b/src/usr/errl/plugins/errludstring.H
index 51f91d5f8..9fbd185f1 100644
--- a/src/usr/errl/plugins/errludstring.H
+++ b/src/usr/errl/plugins/errludstring.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -79,14 +81,106 @@ public:
}
}
-private:
- // Disabled
- ErrlUserDetailsParserString(const ErrlUserDetailsParserString &);
+ private:
+
+ // Parser isn't compiled with c++11 in all environments, and therefore
+ // "delete" of unused interfaces (like below) is not supported, nor are
+ // functions with move semantics
+
+ // Disable compiler provided default functions
+ ErrlUserDetailsParserString(
+ const ErrlUserDetailsParserString &);
ErrlUserDetailsParserString & operator=(
const ErrlUserDetailsParserString &);
+
+};
+
+/**
+ * @class ErrlUserDetailsParserStringSet
+ *
+ * Parses string set user details from an error log
+ */
+class ErrlUserDetailsParserStringSet : public ErrlUserDetailsParser
+{
+
+ public:
+
+ /**
+ * @brief Constructor
+ */
+ ErrlUserDetailsParserStringSet()
+ {
+ }
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ErrlUserDetailsParserStringSet()
+ {
+ }
+
+ /**
+ * @brief Parses string set user details data from an error log
+ *
+ * @param i_version Version of the data
+ * @param i_parse ErrlUsrParser object for outputting information
+ * @param i_pBuffer Pointer to buffer containing detail data
+ * @param i_buflen Length of the buffer
+ */
+ virtual void parse(
+ errlver_t i_version,
+ ErrlUsrParser& i_parser,
+ void* i_pBuffer,
+ const uint32_t i_buflen) const
+ {
+ // [Input Buffer Memory Layout]
+ //
+ // The input buffer contains N sequentially packed pairs of variable
+ // length, NULL terminated strings, where each string pair is also
+ // sequentially packed and the sum of the lengths of all such pairs
+ // exactly equals the input buffer length. Each string pair is
+ // formatted as below, beginning from either the start of the buffer or
+ // the end of the previous string pair:
+ //
+ // Offset Size Description
+ // =====================================================================
+ // 0 Y NULL terminated description string describing the
+ // significance of the string to follow, Y=strlen(this
+ // string) + length (1) of NULL terminator.
+ // Y Z NULL terminated FFDC string, where Z=strlen(this
+ // string) + length (1) of NULL terminator.
+
+ const char* pBuf = static_cast<const char*>(i_pBuffer);
+ const size_t len = static_cast<size_t>(i_buflen);
+ const char* pBufEnd = pBuf + len;
+ while(pBuf < pBufEnd)
+ {
+ const size_t descriptionStringSize = strlen(pBuf) + 1;
+ const char* const pDescriptionString = pBuf;
+ pBuf += descriptionStringSize;
+
+ const size_t stringSize = strlen(pBuf) + 1;
+ const char* const pString = pBuf;
+ pBuf += stringSize;
+
+ i_parser.PrintString(pDescriptionString,pString);
+ }
+ }
+
+ private:
+
+ // Parser isn't compiled with c++11 in all environments, and therefore
+ // "delete" of unused interfaces (like below) is not supported, nor are
+ // functions with move semantics
+
+ // Disable compiler provided default functions
+ ErrlUserDetailsParserStringSet(
+ const ErrlUserDetailsParserStringSet&);
+ ErrlUserDetailsParserStringSet & operator=(
+ const ErrlUserDetailsParserStringSet&);
};
-}
+} // End ERRLOG namespace
#endif
OpenPOWER on IntegriCloud