From a600e574610742073727851ab1d04de85e1b5429 Mon Sep 17 00:00:00 2001 From: Nick Bofferding Date: Wed, 18 Apr 2018 22:13:49 -0500 Subject: SBE Update: Don't alter HBB partition when customizing SBE image This change creates a scratch copy of the HBBL (bootloader) partition during SBE image customization because the data is potentially altered prior to customizing it into the SBE image. If the partition data is altered directly, that can trigger a storage exception when HBBL's memory pages are read only. Change-Id: I00f220170c69401d4dcefd294e96aacccc7baff8 Resolves: #133 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57442 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins CI-Ready: Nicholas E. Bofferding Reviewed-by: Michael Baiocchi Reviewed-by: Martin Gloff Reviewed-by: ILYA SMIRNOV Reviewed-by: Marshall J. Wilks Reviewed-by: Daniel M. Crowell --- src/usr/sbe/sbe_update.C | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C index cf27fac16..4cdb67d1c 100644 --- a/src/usr/sbe/sbe_update.C +++ b/src/usr/sbe/sbe_update.C @@ -2078,8 +2078,14 @@ namespace SBE err->reasonCode() ); break; } - const void* hbblPnorPtr = reinterpret_cast( - pnorInfo.vaddr); + + // Create a working copy of HBBL since it may need to be modified + // and it's not legal to update code partitions + uint8_t pHbbl[MAX_HBBL_SIZE]={0}; + memcpy(pHbbl, + reinterpret_cast(pnorInfo.vaddr), + sizeof(pHbbl)); + const void* hbblPnorPtr = reinterpret_cast(pHbbl); // Use max hbbl size and not the PNOR size. The PNOR size can grow // to add a secure header, but the code size limit is still 20K. -- cgit v1.2.1