-
Notifications
You must be signed in to change notification settings - Fork 709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find_last_sector_idx never returning #2151
Comments
This code works fine on zephyr and mynewt so you have a problem with your deprecated and unsupported mbedos code which is outside the scope of MCUboot |
swap_scratch.c is part of bootutil and has nothing to do with mbed. @multiplemonomials asked to restart the mbed-ce support in pull/2152 becasue we have our community fork of mbed-os. |
The code above adds sector sizes to a count value and that code is definitely coming from mbed, mcuboot has to query it somehow so your mbed code has an issue there (i.e. maybe it is returning 0 if you enter an infinite loop)
Interesting, if they're willing to maintain support for it and look into the issue then that's fine |
I do not see any mbed references in this code:
|
@multiplemonomials can you check if this can be closed? |
@lefebvresam Do you have a project that reproduces this issue that is based on current master branch of mcuboot (i.e. one that uses the CMake build system)? If so I can give it a shot on my STM32U5 board and see if I can reproduce the error |
@multiplemonomials This was in the context of version extraction. In the beginning there was no initialization of state and boot status which led to unlogical decisions in the calling tree. After doing such initalization as proposed in the patch, this problem was not occuring anymore. However, I never went into the deep details of checking primary/secundary slot size in this piece of code and I still find it a strange construction which can potentially lead to hanging software. I should recommend to revise this code and put some additional checks or assertions to avoid hanging behavior. |
If you want to reproduce you can cherry pick from here I think. Taking into account the remarks above. |
After calling
boot_read_image_header(&state, 0, &hdr, &status);
there is a callfind_swap_count(state, swap_size);
andfind_last_sector_idx(state, copy_size);
with copy_size = 76040.This code part is never converging and crashes (line 481 of swap_scratch.c):
It should look more logical that this must be:
Then I have only one iteration:
The piece of code should better have a check to assert before crashing/hanging.
Reproduction:
The text was updated successfully, but these errors were encountered: