examples/configdata: exercise unregister/register lifetime - #3787
Merged
xiaoxiang781216 merged 1 commit intoSep 18, 2026
Merged
xiaoxiang781216 merged 1 commit into
xiaoxiang781216 merged 1 commit into
Conversation
arnavsharma990
force-pushed
the
fix-20166-configdata-unregister-test
branch
3 times, most recently
from
September 16, 2026 19:31
b2f6bb9 to
ce8e575
Compare
xiaoxiang781216
previously approved these changes
Sep 17, 2026
Add a regression test for apache/nuttx#20166 to the configdata example, which runs automatically in every sim:configdata build. After the normal configdata test loops, close the long-lived descriptor and run a full lifetime cycle on /dev/config: - mtdconfig_unregister() must succeed, - the unregistered device must no longer be openable (ENOENT), - the same MTD device must be registerable again and usable, - a final unregister must succeed, leaving the device unregistered. Before the driver fix this crashes deterministically: the old mtdconfig_unregister_by_path() freed the private device structure before closing its temporary file, so the subsequent open() faults in mm_malloc on the corrupted heap (SIGSEGV observed on sim right after unregister returns). With the fix the whole example, 934706/934706 checks included, completes cleanly. The test uses only generic configdata APIs, so it also passes unchanged under CONFIG_MTD_CONFIG_NVS, whose open/close callbacks are no-ops. Assisted-by: Claude:claude-opus Signed-off-by: Arnav Sharma <2006arnavsharma@gmail.com>
arnavsharma990
force-pushed
the
fix-20166-configdata-unregister-test
branch
from
September 17, 2026 09:23
ce8e575 to
52dd39b
Compare
xiaoxiang781216
approved these changes
Sep 18, 2026
jerpelea
approved these changes
Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Regression test for apache/nuttx#20166. Extends the
configdataexample(which already runs as the init entrypoint of
sim:configdata) with afull
/dev/configlifetime cycle after the normal test loops: close,unregister (must succeed), verify
open()failsENOENT, re-registerthe same MTD (must succeed), verify usable, final unregister.
Pre-fix this crashes deterministically (heap UAF in
mtdconfig_unregister_by_path()); post-fix the example completescleanly. Uses only generic configdata APIs, so it is neutral under
CONFIG_MTD_CONFIG_NVS.Impact
Test-only change, runs automatically in
sim:configdatabuilds.Testing
sim:configdatarun completes, 934706/934706 pass.