Skip to content

Commit cfaaa99

Browse files
committed
soc: ironside: add min and max values for update
The update will fail if the address is outside of this range. This failure might trigger a bad state where the device is non-trivial to recover. Signed-off-by: Håkon Amundsen <[email protected]>
1 parent 36bc2f3 commit cfaaa99

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

samples/boards/nordic/nrf_ironside/update/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config UPDATE_BLOB_ADDRESS
55
hex "Address of the update blob"
6-
default 0xe100000
6+
default 0x0e100000
77
help
88
Address of the update blob. The default value matches the placement of the
99
update blobs delivered with the IronSide SE firmware.

soc/nordic/ironside/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ config NRF_IRONSIDE_UPDATE_SERVICE
4949
help
5050
Service used to update the IronSide SE firmware.
5151

52+
config NRF_IRONSIDE_UPDATE_SERVICE_MIN_ADDRESS
53+
hex
54+
default 0x0e100000
55+
help
56+
Minimum value of address passed to the update service.
57+
The update needs to be located within MRAM11.
58+
59+
config NRF_IRONSIDE_UPDATE_SERVICE_MAX_ADDRESS
60+
hex
61+
default 0x0e1d8000
62+
help
63+
Maximum value of address passed to the update service.
64+
The biggest update (USLOT) occupies 160kB, so this address is set so that a 160kB
65+
update would still be within the limit of MRAM11 (0x0e200000).
66+
67+
5268
config NRF_IRONSIDE_BOOT_REPORT
5369
bool "IronSide boot report"
5470
depends on $(dt_nodelabel_exists,ironside_se_boot_report)

soc/nordic/ironside/include/nrf_ironside/update.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct ironside_update_blob {
6262
* @param update Pointer to update blob
6363
*
6464
* @retval 0 on a successful request (although the update itself may still fail).
65+
* @retval -EFAULT if the address of the update is outside of the accepted range.
6566
* @retval -IRONSIDE_UPDATE_ERROR_NOT_PERMITTED if missing access to the update candidate.
6667
* @retval -IRONSIDE_UPDATE_ERROR_SICR_WRITE_FAILED if writing update parameters to SICR failed.
6768
* @retval Positive error status if reported by IronSide call (see error codes in @ref call.h).

soc/nordic/ironside/update.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
#include <errno.h>
67
#include <nrf_ironside/update.h>
78
#include <nrf_ironside/call.h>
89

@@ -11,6 +12,11 @@ int ironside_update(const struct ironside_update_blob *update)
1112
int err;
1213
struct ironside_call_buf *const buf = ironside_call_alloc();
1314

15+
if ((uintptr_t)update < CONFIG_NRF_IRONSIDE_UPDATE_SERVICE_MIN_ADDRESS ||
16+
(uintptr_t)update > CONFIG_NRF_IRONSIDE_UPDATE_SERVICE_MAX_ADDRESS) {
17+
return -EFAULT;
18+
}
19+
1420
buf->id = IRONSIDE_CALL_ID_UPDATE_SERVICE_V0;
1521
buf->args[IRONSIDE_UPDATE_SERVICE_UPDATE_PTR_IDX] = (uintptr_t)update;
1622

0 commit comments

Comments
 (0)