Skip to content

Conversation

@luffy-zh
Copy link
Contributor

What changes were proposed in this pull request?

Add support for UBASN in CMake options and enable it by default in the CI workflow.

Why are the changes needed?

Detect undefined behavior issues with the help of the undefined sanitizer.

How was this patch tested?

Pass all CIs.

Was this patch authored or co-authored using generative AI tooling?

NO.

CXX: ${{ matrix.cxx }}
run: |
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_UBSAN=ON -DBUILD_JAVA=OFF
Copy link
Member

Choose a reason for hiding this comment

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

Can we enable ASan and UBSan in the same workflow?

CXX: ${{ matrix.cxx }}
run: |
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_UBSAN=ON -DBUILD_JAVA=OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should turn on following options:
-DBUILD_ENABLE_AVX512=ON -DBUILD_CPP_ENABLE_METRICS=ON

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need to collect metrics in a CI workflow?

Copy link
Contributor

@ffacs ffacs Jan 23, 2025

Choose a reason for hiding this comment

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

Why do we need to collect metrics in a CI workflow?

There are some codes only enabled when the macroENABLE_METRICS is defined, we need to check them too.

@github-actions github-actions bot added the CPP label Jan 23, 2025
@sfc-gh-mkwiczala
Copy link

@luffy-zh Thank you.

I did notice this PR and created a similar one here: #2267

Can we move forward with UBSAN support?
FYI. There is another problem

external/orc/c++/src/ColumnReader.cc:424:18: runtime error: load of misaligned address 0x7213ff5a8107 for type 'const int32_t' (aka 'const int'), which requires 4 byte alignment

#endif

#if defined(__GNUC__) || defined(__clang__)
#define NO_SANITIZE_ATTR __attribute__((no_sanitize("signed-integer-overflow", "shift")))

Choose a reason for hiding this comment

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

Is it possible to fix the code where signed-integer-overflow and shift issues were discovered?
Is it temporary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a temporary workaround. I intend to split the necessary changes into multiple patches to fix the issue discovered by UBSAN.

@sfc-gh-mkwiczala
Copy link

@ffacs can we merge this PR?

Copy link
Contributor

@ffacs ffacs left a comment

Choose a reason for hiding this comment

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

+1 LGTM.

@sfc-gh-mkwiczala
Copy link

@wgtmac can we merge this PR?

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @luffy-zh , @wgtmac , @ffacs , @sfc-gh-mkwiczala .

@dongjoon-hyun
Copy link
Member

Merged to main for Apache ORC 2.2.0.

@dongjoon-hyun dongjoon-hyun added this to the 2.2.0 milestone Jun 17, 2025
dongjoon-hyun pushed a commit that referenced this pull request Jul 16, 2025
…identified by UBSAN

### What changes were proposed in this pull request?

Remove some temporary workarounds in this [PR](#2117).

### Why are the changes needed?

Fix potential overflow issue in left shift operation.

### How was this patch tested?

Test it locally.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #2317 from luffy-zh/ORC-1946.

Authored-by: luffy-zh <zhnice@outlook.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun pushed a commit that referenced this pull request Jul 16, 2025
…identified by UBSAN

### What changes were proposed in this pull request?

Remove some temporary workarounds in this [PR](#2117).

### Why are the changes needed?

Fix potential overflow issue in left shift operation.

### How was this patch tested?

Test it locally.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #2317 from luffy-zh/ORC-1946.

Authored-by: luffy-zh <zhnice@outlook.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit eb60462)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants