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, Sep 26, 6:49 PM
Unknown Object (File)
Fri, Sep 19, 4:00 PM
Unknown Object (File)
Sep 3 2025, 10:46 PM
Unknown Object (File)
Jul 31 2025, 11:28 PM
Unknown Object (File)
Jul 29 2025, 12:41 AM
Unknown Object (File)
Jul 28 2025, 11:31 AM
Unknown Object (File)
Jul 28 2025, 8:03 AM
Unknown Object (File)
Jul 14 2025, 6:58 AM
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