Skip to content
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

OS_ModuleUnload() for statically loaded module may segfault #637

Closed
jphickey opened this issue Oct 30, 2020 · 0 comments · Fixed by #638 or #652
Closed

OS_ModuleUnload() for statically loaded module may segfault #637

jphickey opened this issue Oct 30, 2020 · 0 comments · Fixed by #638 or #652
Assignees
Labels
Milestone

Comments

@jphickey
Copy link
Contributor

Describe the bug
Calling OS_ModuleUnload() on a statically loaded module will still attempt to call dlclose() but the handle is NULL because no module was loaded. At least on Linux/Glibc this actually causes a segmentation fault.

To Reproduce
Using the CFE framework switch any app (e.g. sample_app) from a regular dynamic app to a static app.
Build and run CFE, then shutdown with CTRL+C.
The shutdown ends up calling OS_DeleteAllObjects() which in turn will trigger this bug - one gets a segfault instead of a clean exit.

Expected behavior
Should shutdown cleanly.

System observed on:
Ubuntu 20.04

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey added the bug label Oct 30, 2020
@jphickey jphickey self-assigned this Oct 30, 2020
jphickey added a commit to jphickey/osal that referenced this issue Oct 30, 2020
Ensure that the handle is not NULL before invoking dlclose().
In particular the handle will be NULL for static modules.
jphickey added a commit to jphickey/osal that referenced this issue Nov 2, 2020
Mark static modules with a flag, and check that flag at unload.
If flag is set, then skip unload low level implementation.
jphickey added a commit to jphickey/osal that referenced this issue Nov 4, 2020
Mark static modules with a different type, and check that type at unload.
Only call unload low level implementation if type is dynamic.
astrogeco added a commit that referenced this issue Nov 10, 2020
Fix #637, fix OS_ModuleUnload for static modules
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#637, Remove old CFE_ARINC653-related tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants