-
Notifications
You must be signed in to change notification settings - Fork 231
Extend prevent-late-fallback by lock-counter #1732
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1732 +/- ##
==========================================
- Coverage 84.51% 84.49% -0.03%
==========================================
Files 76 76
Lines 22385 22599 +214
==========================================
+ Hits 18918 19094 +176
- Misses 3467 3505 +38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8c35bbb
to
65208dc
Compare
65208dc
to
cc71a48
Compare
71c4606
to
5c3cfc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zentax-dev Thank you for the contribution!
I had a look at the code and left some comments where I think the feature still deserves some rework. I guess most are just about proper wording/naming and error handling.
You should also point out in the documentation when and why boot counter locking might be preferable to the existing 'mark bad other' solution we have.
aab499f
to
5d18924
Compare
Thanks for the feedback, think I got everything now. Forced pushed the changes |
5d18924
to
aa96409
Compare
aa96409
to
9875dd0
Compare
6314e02
to
aaaf0c5
Compare
aaaf0c5
to
acc361d
Compare
The new option for prevent late fallback adds the possibility to lock the attempts counter. It is a global setting and is not bound to any specific slot. When activated, the counter of the slot that is marked good will be locked and not decrease and increase anymore. It will be unlocked again, when the slot is marked active. The config option does not have any influence on which slot is bootet, it will just stop decrementing the remaining attempts counter in the bootloader. Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
Forward the counter locking option to the barebox bootloader. So the barebox can then stop decrementing the remaining_attempts counter. It inhibits fall-back to a previous version of the system, which can happen if a system is rebootet too frequently before a slot is marked good again and the remaining_attempts counter is incrememented. As a side effect, it inhibits excessive write cycles on the storage medium. This also needs changes to barebox, see [1]. [1] https://lists.infradead.org/pipermail/barebox/2025-June/051393.html Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
The setting is currently only supported by barebox. Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
The attempts counter will be locked/frozen, after it is marked good and will be unlocked/unfrozen again when it is marked active. Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
This adds the option to print the current state of prevent-late-fallback and also to enable and disable sets the lock-counter via userspace. The possibility to get/set it via D-Bus is not yet implemented and will be added separately. Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
It is best to show problems with inconsistent configuration early. When counter locking is enabled in rauc, it must also be set in the bootloader. Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
6ea2c5f
to
20120bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no further comments on the series and haven't looked deep enough to put a checkmark on it.
I'll mark your remarks as resolved then |
@ejoerns would be nice if you could review this again |
This feature allows to lock the the
remaining_attempts
counter.When
remaining_attempts
is locked, the bootloader should not decremented and incremented the variable anymore during each boot.It is active when a slot is marked good and inactive when a slot is marked active.
This way it prevents fallback to an earlier version, whilst inhibiting additional write cycles to the target medium.
The status can be printed out with
barebox-state
andrauc status
.In a prelimary talk with @ejoerns the decision was made to not add this to the D-Bus interface yet. It will be added in a future pull request.
This feature also needs to be supported by the bootloader.
So far, a patch has been handed in for barebox to support this feature, see