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

build: use clang over g++ for ubsan #52169

Closed
wants to merge 1 commit into from
Closed

Conversation

H4ad
Copy link
Member

@H4ad H4ad commented Mar 21, 2024

Use clang instead of g++ as we do for test-asan since it appears to use less memory, and probably should build faster too, refs: #32776

@H4ad H4ad requested a review from RafaelGSS March 21, 2024 01:22
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Mar 21, 2024
@targos
Copy link
Member

targos commented Mar 21, 2024

Need #52152 otherwise ubsan doesn't run on the PR

@targos
Copy link
Member

targos commented Mar 21, 2024

It landed so you can rebase on main now

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

LGTM if it works.

@targos
Copy link
Member

targos commented Mar 21, 2024

@H4ad
Copy link
Member Author

H4ad commented Mar 21, 2024

It took less time to compile, but it took much longer to test and it broke.

I don't have much knowledge on this topic, so do you think there's something we can do to try and fix it, or does ubsan only work with g++?

@anonrig
Copy link
Member

anonrig commented Mar 21, 2024

@lemire maybe has some knowledge on this

@lemire
Copy link
Member

lemire commented Mar 21, 2024

To my knowledge, ubsan works with both clang and gcc.

@lemire
Copy link
Member

lemire commented Mar 21, 2024

@H4ad Does it work locally for you, or does it only fail in CI?

@targos
Copy link
Member

targos commented Mar 21, 2024

Here's part of the error log:

../deps/v8/src/api/api-arguments-inl.h:334:3: runtime error: call to function v8::internal::Accessors::ReconfigureToDataProperty(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&) through pointer to incorrect function type 'void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void> &)'
(/home/runner/work/node/node/out/Release/node+0x2e875b0): note: v8::internal::Accessors::ReconfigureToDataProperty(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../deps/v8/src/api/api-arguments-inl.h:334:3 in 
../deps/v8/src/api/api-arguments-inl.h:334:3: runtime error: call to function v8::internal::Accessors::ReconfigureToDataProperty(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&) through pointer to incorrect function type 'void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void> &)'
(/home/runner/work/node/node/out/Release/node+0x2e875b0): note: v8::internal::Accessors::ReconfigureToDataProperty(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../deps/v8/src/api/api-arguments-inl.h:334:3 in 
../deps/v8/src/handles/global-handles.cc:866:3: runtime error: call to function node::BaseObject::MakeWeak()::$_0::__invoke(v8::WeakCallbackInfo<node::BaseObject> const&) through pointer to incorrect function type 'void (*)(const v8::WeakCallbackInfo<void> &)'
(/home/runner/work/node/node/out/Release/node+0x24e8e90): note: node::BaseObject::MakeWeak()::$_0::__invoke(v8::WeakCallbackInfo<node::BaseObject> const&) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../deps/v8/src/handles/global-handles.cc:866:3 in 
npm WARN cli npm v10.5.0 does not support Node.js v22.0.0-pre. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at [https://nodejs.org/.](https://nodejs.org/)
../deps/base64/base64/lib/codec_choose.c:215:17: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../deps/base64/base64/lib/codec_choose.c:215:17 in

@lemire
Copy link
Member

lemire commented Mar 21, 2024

@targos One of those warnings is legitimate:

#ifndef bit_AVX512vl
#define bit_AVX512vl (1 << 31)
#endif

I don't think it is a bug per se because no compiler would do the wrong thing here. But it seems to indicate that the tool is doing its work.

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

clang doesn't accept specific operators for suppression files. That's why I switched to g++. Are the actions running out of memory?

@H4ad
Copy link
Member Author

H4ad commented Mar 21, 2024

Does it work locally for you, or does it only fail in CI?

I just compiled locally but didn't try to run the tests for ubsan.

Are the actions running out of memory?

No, I just thought we could use clang to speed up/reduce memory usage based on another action that was using it.

That being the case, I will close this PR, thanks for the feedback!

@H4ad H4ad closed this Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants