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

[MME] Crash due to a race condition #2916

Merged
merged 1 commit into from
Jan 25, 2024
Merged

[MME] Crash due to a race condition #2916

merged 1 commit into from
Jan 25, 2024

Conversation

acetcom
Copy link
Member

@acetcom acetcom commented Jan 25, 2024

A race condition can occur in the following situations. In conclusion, we can use this situation to determine whether or not the UE Context has been removed and avoiding a crash.

For example, suppose a UE Context is removed in the followings.

  1. Attach Request
  2. Authentication-Information-Request
  3. Authentication-Information-Answer
  4. Authentication Request
  5. Authentication Response(MAC Failed)
  6. Authentication Reject
  7. UEContextReleaseCommand
  8. UEContextReleaseComplete

The MME then sends a Purge-UE-request to the HSS and deletes the UE context as soon as it receives a Purge-UE-Answer.

Suppose an Attach Request is received from the same UE between Purge-UE-Request/Answer, then the MME and HSS start the Authentication-Information-Request/Answer process.

This can lead to the following situations.

  1. Purge-UE-Request
  2. Attach Request
  3. Authentication-Information-Request
  4. Purge-UE-Answer
  5. [UE Context Removed]
  6. Authentication-Information-Answer

Since the UE Context has already been deleted
when the Authentication-Information-Answer is received, it cannot be processed properly.

Therefore, mme_ue_cycle() is used to check
whether the UE Context has been deleted and
decide whether to process or
ignore the Authentication-Information-Answer as shown below.

A race condition can occur in the following situations.
In conclusion, we can use this situation to determine
whether or not the UE Context has been removed and avoiding a crash.

For example, suppose a UE Context is removed in the followings.

1. Attach Request
2. Authentication-Information-Request
3. Authentication-Information-Answer
4. Authentication Request
5. Authentication Response(MAC Failed)
6. Authentication Reject
7. UEContextReleaseCommand
8. UEContextReleaseComplete

The MME then sends a Purge-UE-request to the HSS and deletes
the UE context as soon as it receives a Purge-UE-Answer.

Suppose an Attach Request is received from the same UE
between Purge-UE-Request/Answer, then the MME and HSS start
the Authentication-Information-Request/Answer process.

This can lead to the following situations.

1. Purge-UE-Request
2. Attach Request
3. Authentication-Information-Request
4. Purge-UE-Answer
5. [UE Context Removed]
6. Authentication-Information-Answer

Since the UE Context has already been deleted
when the Authentication-Information-Answer is received,
it cannot be processed properly.

Therefore, mme_ue_cycle() is used to check
whether the UE Context has been deleted and
decide whether to process or
ignore the Authentication-Information-Answer as shown below.
@acetcom acetcom merged commit 3886891 into main Jan 25, 2024
2 checks passed
@acetcom acetcom deleted the c branch January 25, 2024 14:27
acetcom added a commit that referenced this pull request Feb 8, 2024
When there is no MME-UE Context, going to cleanup without setting
s6a_message could cause a segmentation fault.

We fixed the problem by moving the location of setting s6a_message
to before cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant