You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/12/14 11:20:19 UTC

[GitHub] [mynewt-mcumgr] de-nordic opened a new pull request #104: zephyr: Add support for image ROM address verification

de-nordic opened a new pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104


   The commit adds IMAGE_F_ROM_FIXED_ADDR flag that allows to use
   ih_load_addr to identify the flash address the image is intendant to
   start at.
   The code, that supports this flag, will reject image before attempting
   flash write if slot address differs from the base address of the image.
   The feature can be used to mark Direct-XIP images with slot address
   they are intended for.
   The CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT has been added
   to turn the featre on.
   
   Signed-off-by: Dominik Ermel <do...@nordicsemi.no>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] utzig merged pull request #104: zephyr: Add support for image ROM address verification

Posted by GitBox <gi...@apache.org>.
utzig merged pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] nvlsianpu commented on pull request #104: zephyr: Add support for image ROM address verification

Posted by GitBox <gi...@apache.org>.
nvlsianpu commented on pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104#issuecomment-744442489


   depends on https://github.com/mcu-tools/mcuboot/pull/898


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] de-nordic commented on a change in pull request #104: zephyr: Add support for image ROM address verification

Posted by GitBox <gi...@apache.org>.
de-nordic commented on a change in pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104#discussion_r543154980



##########
File path: cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
##########
@@ -495,6 +495,25 @@ img_mgmt_impl_upload_inspect(const struct img_mgmt_upload_req *req,
             return MGMT_ERR_ENOMEM;
         }
 
+
+#if defined(CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT)
+        if (hdr->ih_flags & IMAGE_F_ROM_FIXED_ADDR) {
+            rc = flash_area_open(action->area_id, &fa);
+            if (rc) {
+                *errstr = img_mgmt_err_str_flash_open_failed;
+                return MGMT_ERR_EUNKNOWN;
+            }
+
+            if (fa->fa_off != hdr->ih_load_addr) {
+                *errstr = img_mgmt_err_str_image_bad_flash_addr;
+                return MGMT_ERR_EINVAL;

Review comment:
       ![image](https://user-images.githubusercontent.com/56024351/102192101-95067680-3eba-11eb-8206-9c0ff17caac6.png)
   Sorry, fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] utzig commented on a change in pull request #104: zephyr: Add support for image ROM address verification

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104#discussion_r542926899



##########
File path: cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
##########
@@ -495,6 +495,25 @@ img_mgmt_impl_upload_inspect(const struct img_mgmt_upload_req *req,
             return MGMT_ERR_ENOMEM;
         }
 
+
+#if defined(CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT)
+        if (hdr->ih_flags & IMAGE_F_ROM_FIXED_ADDR) {
+            rc = flash_area_open(action->area_id, &fa);
+            if (rc) {
+                *errstr = img_mgmt_err_str_flash_open_failed;
+                return MGMT_ERR_EUNKNOWN;
+            }
+
+            if (fa->fa_off != hdr->ih_load_addr) {
+                *errstr = img_mgmt_err_str_image_bad_flash_addr;
+                return MGMT_ERR_EINVAL;

Review comment:
       This path leaves the flash area open.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-mcumgr] nvlsianpu commented on a change in pull request #104: zephyr: Add support for image ROM address verification

Posted by GitBox <gi...@apache.org>.
nvlsianpu commented on a change in pull request #104:
URL: https://github.com/apache/mynewt-mcumgr/pull/104#discussion_r542338231



##########
File path: cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
##########
@@ -495,6 +495,25 @@ img_mgmt_impl_upload_inspect(const struct img_mgmt_upload_req *req,
             return MGMT_ERR_ENOMEM;
         }
 
+
+#if defined(CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT)
+        if (hdr->ih_flags & IMAGE_F_ROM_DIRECT_ADDR) {
+            rc = flash_area_open(action->area_id, &fa);
+            if (rc) {
+                *errstr = img_mgmt_err_str_flash_open_failed;
+                return MGMT_ERR_EUNKNOWN;
+            }
+
+            if (fa->fa_off != hdr->ih_load_addr) {
+                *errstr = img_mgmt_err_str_image_bad_flash_addr;
+                return MGMT_ERR_EUNKNOWN;

Review comment:
       MGMT_ERR_EINVAL




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org