-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
libs/libc/modlib/modlib_bind.c: Fix system crash if modlib_bind fails #15830
Conversation
libs/libc/modlib/modlib_bind.c
Outdated
@@ -1076,6 +1076,8 @@ int modlib_bind(FAR struct module_s *modp, | |||
} | |||
#endif | |||
|
|||
errout_with_addrenv: |
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.
remove indent
Addrenv is changed to the newly created process' one in the beginning of modlib_bind, and needs to be changed always when returning from the function; also in error cases. Signed-off-by: Jukka Laitinen <[email protected]>
28154c1
to
feb82cc
Compare
@nuttxpr test milkv_duos:nsh |
[Experimental Bot, please feedback here] Build and Test Successful (milkv_duos:nsh)
|
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.
Tested OK on Real Hardware: Oz64 SG2000 RISC-V SBC. Thanks :-)
Summary
Addrenv is changed to the newly created process' one in the beginning of modlib_bind, and needs to be changed back always when returning from the function; also in error cases.
This fixes a system crash in case where linking of a new process fails in modlib_bind. In the error case the modlib_bind returned with error code, but with wrong address environment.
Impact
Fixes a crashing bug in platforms using CONFIG_ARCH_ADDRENV.
Testing
Tested on imx93 and mpfs platforms.