Page MenuHomeFreeBSD

ena: PHC destroy race
Needs ReviewPublic

Authored by osamaabb_amazon.com on Aug 20 2024, 8:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 28, 6:27 PM
Unknown Object (File)
Sat, Nov 22, 2:51 PM
Unknown Object (File)
Fri, Nov 14, 2:39 PM
Unknown Object (File)
Nov 5 2025, 6:40 AM
Unknown Object (File)
Nov 3 2025, 6:36 PM
Unknown Object (File)
Nov 3 2025, 12:23 PM
Unknown Object (File)
Oct 29 2025, 11:32 PM
Unknown Object (File)
Oct 24 2025, 2:45 PM
Subscribers

Details

Reviewers
cperciva
Summary

Under theoretical race condition, PHC may be destroyed while PHC
timestamp is retrieved. This will cause the PHC device memory to
be freed while being used in another thread.
To prevent such a race, PHC destroy flow will disable the PHC state
under PHC lock, (these lock and state variables are used on every
PHC timestamp retrieval).

Approved by: cperciva
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 59070
Build 55957: arc lint + arc unit

Event Timeline

sys/contrib/ena-com/ena_com.c
1887

Seems weird to add a new value flags=0 and then use it a few lines later without any way for the flags to change. Is this Amazon house style saying "no magic numbers"?

sys/contrib/ena-com/ena_com.c
1887

We do hate magic number or using variables uninitialized, we do our best to avoid doing that