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

Mute an UBSan check error for SCOPED_LOCK macro #283

Merged

Conversation

beef9999
Copy link
Collaborator

@beef9999 beef9999 commented Dec 1, 2023

The previous SCOPED_MEMBER_LOCK will visit member address even if the object itself is nullptr.

This behavior will cause an runtime error in the UndefinedBehaviorSanitizer check (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html), although the compiler didn't regard it as a warning.

Removed SCOPED_MEMBER_LOCK, luckily this is the only usage in the whole project.

@@ -72,8 +72,6 @@ inline int posix_memalign(void** memptr, size_t alignment, size_t size) {
by target vcpu in resume_thread(), when its runq becomes empty;
*/

#define SCOPED_MEMBER_LOCK(x) SCOPED_LOCK(&(x)->lock, ((bool)x) * 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when x is null, it doesn't actually do the locking.

@beef9999 beef9999 closed this Dec 3, 2023
@beef9999 beef9999 reopened this Dec 4, 2023
@lihuiba lihuiba merged commit 3ae9e95 into alibaba:release/0.7 Dec 5, 2023
13 checks passed
lihuiba pushed a commit that referenced this pull request Dec 6, 2023
* Mute an UBSan check error for SCOPED_LOCK macro (#283)

* io: support reset photon at fork (#282)

In photon context, event engine based module need reset after
fork, if exec will not be called after fork.
This is implicitly done by pthread_atfork hook.

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

---------

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
Co-authored-by: Bob Chen <beef9999@qq.com>
Co-authored-by: yuchen0cc <91253032+yuchen0cc@users.noreply.github.com>
lihuiba pushed a commit that referenced this pull request Dec 12, 2023
* Mute an UBSan check error for SCOPED_LOCK macro (#283)

* io: support reset photon at fork (#282)

In photon context, event engine based module need reset after
fork, if exec will not be called after fork.
This is implicitly done by pthread_atfork hook.

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* RPC support graceful shutdown

---------

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
Co-authored-by: Bob Chen <beef9999@qq.com>
Co-authored-by: yuchen0cc <91253032+yuchen0cc@users.noreply.github.com>
lihuiba added a commit that referenced this pull request Dec 16, 2023
* Mute an UBSan check error for SCOPED_LOCK macro (#283)

* io: support reset photon at fork (#282)

In photon context, event engine based module need reset after
fork, if exec will not be called after fork.
This is implicitly done by pthread_atfork hook.

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* RPC support graceful shutdown

* fs: support xattr for extfs and subfs (#298)

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* Sequential mutex (#294)

seq_mutex

* exit(0) requires stdlib.h (#303)

* fix e2fs include dir name (#301)

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* [feat] http client with cert

Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>

---------

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
Co-authored-by: Bob Chen <beef9999@qq.com>
Co-authored-by: yuchen0cc <91253032+yuchen0cc@users.noreply.github.com>
Co-authored-by: Huiba Li <lihuiba@gmail.com>
Co-authored-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com>
lihuiba added a commit that referenced this pull request Dec 18, 2023
* Mute an UBSan check error for SCOPED_LOCK macro (#283)

* io: support reset photon at fork (#282)

In photon context, event engine based module need reset after
fork, if exec will not be called after fork.
This is implicitly done by pthread_atfork hook.

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* RPC support graceful shutdown

* fs: support xattr for extfs and subfs (#298)

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* Sequential mutex (#294)

seq_mutex

* exit(0) requires stdlib.h (#303)

* fix e2fs include dir name (#301)

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>

* [feat] http client with cert

Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>

* minor fix for std-compat (#307)

* minor fix for std-compat

* rpc::string add empty method

* set io_uring eventfd non-blocking

---------

Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
Co-authored-by: Bob Chen <beef9999@qq.com>
Co-authored-by: yuchen0cc <91253032+yuchen0cc@users.noreply.github.com>
Co-authored-by: Huiba Li <lihuiba@gmail.com>
Co-authored-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com>
@beef9999 beef9999 deleted the beef9999/fix-scope-lock-UBSan-check branch December 21, 2023 16:07
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.

3 participants