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

POSIX unnecessarily setting signal masks in global lock #673

Closed
jphickey opened this issue Dec 8, 2020 · 0 comments · Fixed by #678 or #690
Closed

POSIX unnecessarily setting signal masks in global lock #673

jphickey opened this issue Dec 8, 2020 · 0 comments · Fixed by #678 or #690
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Dec 8, 2020

Describe the bug
As part of the global lock the POSIX implementation is setting the signal mask of the parent process. However, the signal mask which is being set is the same mask that was already set in the parent process during the initialization.

To Reproduce
N/A

Expected behavior
The signal mask is already configured during initialization, so it should not be re-configured when locking/unlocking the global object tables.

Code snips
Locking:

if (pthread_sigmask(SIG_SETMASK, &POSIX_GlobalVars.MaximumSigMask, &previous) != 0)

Unlocking:

pthread_sigmask(SIG_SETMASK, &previous, NULL);

System observed on:
Ubuntu 20.04

Additional context
I have investigated and I cannot find any justification for this anymore. In older versions of OSAL the signal(s) were not blocked and therefore e.g. SIGINT, SIGALRM etc could be handled by any thread. In this design it was likely important to make sure that a timer/interrupt doesn't get processed while internal OSAL ops are being performed.

But In the current OSAL design all of these signals are blocked initially in the main task - which all normal tasks then inherit. So this is only resetting the same mask that was already configured.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Dec 8, 2020
jphickey added a commit to jphickey/osal that referenced this issue Dec 9, 2020
Removes the signal mask updates from the POSIX global lock (not needed).
Adds a condition variable to the structure, which can be used to
directly wake up a waiting task rather than requiring that task to poll
the global state.
jphickey added a commit to jphickey/osal that referenced this issue Dec 11, 2020
Removes the signal mask updates from the POSIX global lock (not needed).
Adds a condition variable to the structure, which can be used to
directly wake up a waiting task rather than requiring that task to poll
the global state.
astrogeco added a commit that referenced this issue Dec 17, 2020
@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
…ontext

Fix nasa#657, Add UT_Stub_RegisterContext to CFE_EVS_SendEvent and CFE_ES_WriteToSysLog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants