From 5d8dd9af9d7a4df742ebbd8cdf20c58a8e95b05f Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Mon, 19 Aug 2013 08:56:23 -0500 Subject: Catch overrun of HSVC attributes in HDAT Ran into a problem integrating a new HB release that would have been a lot easier to debug if this code had been there. Change-Id: I3c420172bcff25a7042d3ee603f179273ba88761 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5827 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/usr/runtime/populate_attributes.C | 67 +++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) (limited to 'src/usr/runtime/populate_attributes.C') diff --git a/src/usr/runtime/populate_attributes.C b/src/usr/runtime/populate_attributes.C index 061283faf..1370a51a2 100644 --- a/src/usr/runtime/populate_attributes.C +++ b/src/usr/runtime/populate_attributes.C @@ -241,11 +241,47 @@ errlHndl_t populate_system_attributes( void ) RUNTIME::RC_INVALID_SECTION, sys_data_addr, sys_data_size ); + // most likely this is a HB code bug + errhdl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_HIGH); + // but it could also be a FSP bug in setting up the HDAT data + errhdl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE, + HWAS::SRCI_PRIORITY_HIGH); + // save some of the HDAT data for FFDC + RUNTIME::add_host_data_ffdc( RUNTIME::HSVC_SYSTEM_DATA, errhdl ); + break; } + else if( sizeof(system_data_t) > sys_data_size ) + { + TRACFCOMP( g_trac_runtime, "Not enough space allocated by HDAT for HostServices System Data" ); + /*@ + * @errortype + * @reasoncode RUNTIME::RC_NOT_ENOUGH_SPACE + * @moduleid RUNTIME::MOD_RUNTIME_POP_SYS_ATTR + * @userdata1 Required size + * @userdata2 Available size + * @devdesc Not enough space allocated by HDAT for + * HostServices System Data + */ + errhdl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + RUNTIME::MOD_RUNTIME_POP_SYS_ATTR, + RUNTIME::RC_NOT_ENOUGH_SPACE, + sizeof(system_data_t), + sys_data_size ); + // need to update the FSP code + errhdl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE, + HWAS::SRCI_PRIORITY_HIGH); + + // save some of the HDAT data for FFDC + RUNTIME::add_host_data_ffdc( RUNTIME::HSVC_SYSTEM_DATA, errhdl ); + + break; + } + system_data_t* sys_data = reinterpret_cast(sys_data_addr); memset( sys_data, 'A', sizeof(system_data_t) ); - //@fixme - Should test that we aren't going out of bounds // These variables are used by the HSVC_LOAD_ATTR macros directly uint64_t* _num_attr = NULL; //pointer to numAttr in struct @@ -361,9 +397,36 @@ errlHndl_t populate_node_attributes( uint64_t i_nodeNum ) node_data_size ); break; } + else if( sizeof(node_data_t) > node_data_size ) + { + TRACFCOMP( g_trac_runtime, "Not enough space allocated by HDAT for HostServices Node Data" ); + /*@ + * @errortype + * @reasoncode RUNTIME::RC_NOT_ENOUGH_SPACE + * @moduleid RUNTIME::MOD_RUNTIME_POP_NODE_ATTR + * @userdata1 Required size + * @userdata2 Available size + * @devdesc Not enough space allocated by HDAT for + * HostServices Node Data + */ + errhdl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + RUNTIME::MOD_RUNTIME_POP_NODE_ATTR, + RUNTIME::RC_NOT_ENOUGH_SPACE, + sizeof(node_data_t), + node_data_size ); + // need to update the FSP code + errhdl->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE, + HWAS::SRCI_PRIORITY_HIGH); + + // save some of the HDAT data for FFDC + RUNTIME::add_host_data_ffdc( RUNTIME::HSVC_NODE_DATA, errhdl ); + + break; + } + node_data_t* node_data = reinterpret_cast(node_data_addr); memset( node_data, 'A', sizeof(node_data) ); - //@fixme - Should test that we aren't going out of bounds // These variables are used by the HSVC_LOAD_ATTR macros directly uint64_t* _num_attr = NULL; //pointer to numAttr in struct -- cgit v1.2.1