Skip to content

Commit

Permalink
applications: nrf_desktop: enable stack protection in mcuboot configs
Browse files Browse the repository at this point in the history
Enabled the CONFIG_HW_STACK_PROTECTION Kconfig option in the MCUboot
configurations of the relevant nRF Desktop targets.

Ref: NCSDK-26764

Signed-off-by: Kamil Piszczek <[email protected]>
  • Loading branch information
kapi-no committed Dec 3, 2024
1 parent 52ef82f commit ea19874
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

CONFIG_MAIN_STACK_SIZE=4096
Expand Down Expand Up @@ -55,6 +52,7 @@ CONFIG_BOOT_BANNER=n
CONFIG_NCS_BOOT_BANNER=n
CONFIG_ERRNO=n
CONFIG_ARM_MPU=n
CONFIG_HW_STACK_PROTECTION=n
CONFIG_BOOT_SERIAL_IMG_GRP_HASH=n

# Use minimal C library instead of the Picolib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

CONFIG_MAIN_STACK_SIZE=4096
Expand Down Expand Up @@ -59,6 +56,7 @@ CONFIG_BOOT_BANNER=n
CONFIG_NCS_BOOT_BANNER=n
CONFIG_ERRNO=n
CONFIG_ARM_MPU=n
CONFIG_HW_STACK_PROTECTION=n
CONFIG_BOOT_SERIAL_IMG_GRP_HASH=n

# Use minimal C library instead of the Picolib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

# Disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

CONFIG_SYSTEM_CLOCK_NO_WAIT=y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_HW_STACK_PROTECTION=y

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_HW_STACK_PROTECTION=y

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_HW_STACK_PROTECTION=y

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_HW_STACK_PROTECTION=y

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,13 @@ nRF Desktop
* :ref:`zephyr:nrf54l15dk_nrf54l15`
* :ref:`zephyr:nrf54h20dk_nrf54h20`

* MCUboot bootloader configurations to enable the :kconfig:option:`CONFIG_FPROTECT` Kconfig option that is used to protect the bootloader partition against memory corruption.
* MCUboot bootloader configurations to enable the following Kconfig options:

* :kconfig:option:`CONFIG_FPROTECT` - Used to protect the bootloader partition against memory corruption.
* :kconfig:option:`CONFIG_HW_STACK_PROTECTION` - Used to protect against stack overflows.

The :kconfig:option:`CONFIG_HW_STACK_PROTECTION` Kconfig option and its dependency (the :kconfig:option:`CONFIG_ARM_MPU` Kconfig option) might be disabled in case of targets with limited memory.

* MCUboot bootloader configuration for the MCUboot SMP build type and the nRF52840 Gaming Mouse target to enable the :kconfig:option:`CONFIG_ARM_MPU` Kconfig option that is required to enable hardware stack protection (:kconfig:option:`CONFIG_HW_STACK_PROTECTION`).

* Removed imply for partial erase feature of the nRF SoC flash driver (:kconfig:option:`CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE`) for the USB next stack (:ref:`CONFIG_DESKTOP_USB_STACK_NEXT <config_desktop_app_options>`).
Expand Down

0 comments on commit ea19874

Please sign in to comment.