Skip to content

[clang][UBSan] Make sure that the implicit-conversion group is compatible with minimal runtime #114865

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

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

Zonotora
Copy link
Contributor

@Zonotora Zonotora commented Nov 4, 2024

We are currently getting:

clang: error: invalid argument '-fsanitize-minimal-runtime' not allowed with '-fsanitize=implicit-conversion'

when running

-fsanitize=implicit-conversion -fsanitize-minimal-runtime

because implicit-conversion now includes implicit-bitfield-conversion which is not included in the integer check. The integer check includes the implicit-integer-conversion checks and is supported by the trapping option and because of that compatible with the minimal runtime. It is thus reasonable to make implicit-bitfield-conversion compatible with the minimal runtime.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Axel Lundberg (Zonotora)

Changes

We are currently getting:

clang: error: invalid argument '-fsanitize-minimal-runtime' not allowed with '-fsanitize=implicit-conversion'

when running

-fsanitize=implicit-conversion -fsanitize-minimal-runtime

because implicit-conversion now includes implicit-bitfield-conversion which is not included in the integer check. The integer check includes the implicit-integer-conversion checks and is supported by the trapping option and because of that compatible with the minimal runtime. It is thus reasonable to make implicit-bitfield-conversion compatible with the minimal runtime.


Full diff: https://github.com/llvm/llvm-project/pull/114865.diff

1 Files Affected:

  • (modified) clang/lib/Driver/SanitizerArgs.cpp (+3-3)
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 89f1215afd0c81..6a00d99ba03428 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -68,9 +68,9 @@ static const SanitizerMask AlwaysRecoverable = SanitizerKind::KernelAddress |
 static const SanitizerMask NeedsLTO = SanitizerKind::CFI;
 static const SanitizerMask TrappingSupported =
     (SanitizerKind::Undefined & ~SanitizerKind::Vptr) | SanitizerKind::Integer |
-    SanitizerKind::Nullability | SanitizerKind::LocalBounds |
-    SanitizerKind::CFI | SanitizerKind::FloatDivideByZero |
-    SanitizerKind::ObjCCast;
+    SanitizerKind::ImplicitConversion | SanitizerKind::Nullability |
+    SanitizerKind::LocalBounds | SanitizerKind::CFI |
+    SanitizerKind::FloatDivideByZero | SanitizerKind::ObjCCast;
 static const SanitizerMask TrappingDefault = SanitizerKind::CFI;
 static const SanitizerMask CFIClasses =
     SanitizerKind::CFIVCall | SanitizerKind::CFINVCall |

@Zonotora
Copy link
Contributor Author

Zonotora commented Nov 5, 2024

@vitalybuka

@Zonotora
Copy link
Contributor Author

Hi @zygoloid and @efriedma-quic, would you mind taking a look? Thanks!

@Zonotora
Copy link
Contributor Author

@vitalybuka This is connected to #75481 that was merged a couple of months ago..

Copy link
Collaborator

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

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

Please can you also add a test that we allow combining -fsanitize=implicit-conversion and -fsanitize-minimal-runtime so that this doesn't regress in a similar way in future?

(It'd be great if the test covered all the sanitizer groups that are currently compatible with the minimal runtime, so we get an early warning if we add any non-compatible sanitizers to those groups, but at minimum I'd like to see some test coverage for this change.)

@Zonotora
Copy link
Contributor Author

Will do

@Zonotora Zonotora force-pushed the implicit-conversion-minimal-runtime branch from 9cb9672 to 5630203 Compare November 20, 2024 18:04
@Zonotora
Copy link
Contributor Author

@zygoloid I don't have write access, please merge on my behalf!

@zygoloid zygoloid merged commit 668f2c7 into llvm:main Nov 20, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 20, 2024

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-ubuntu running on as-builder-9 while building clang at step 16 "test-check-lldb-api".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/1335

Here is the relevant piece of the build log for the reference
Step 16 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
...
PASS: lldb-api :: types/TestIntegerTypeExpr.py (1204 of 1213)
PASS: lldb-api :: types/TestRecursiveTypes.py (1205 of 1213)
PASS: lldb-api :: tools/lldb-server/TestGdbRemote_vCont.py (1206 of 1213)
PASS: lldb-api :: types/TestShortType.py (1207 of 1213)
PASS: lldb-api :: types/TestLongTypes.py (1208 of 1213)
PASS: lldb-api :: types/TestLongTypesExpr.py (1209 of 1213)
PASS: lldb-api :: types/TestShortTypeExpr.py (1210 of 1213)
PASS: lldb-api :: tools/lldb-server/TestNonStop.py (1211 of 1213)
PASS: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (1212 of 1213)
UNRESOLVED: lldb-api :: tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py (1213 of 1213)
******************** TEST 'lldb-api :: tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py' FAILED ********************
Script:
--
/usr/bin/python3.12 /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libcxx-include-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1 --libcxx-include-target-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu --arch aarch64 --build-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb --compiler /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang --dsymutil /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil --make /usr/bin/make --llvm-tools-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --lldb-obj-root /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb --lldb-libs-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --platform-url connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/tools/lldb-server/attach-wait -p TestGdbRemoteAttachWait.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 668f2c7fab288db90d474a7f6f72b11e5a120328)
  clang revision 668f2c7fab288db90d474a7f6f72b11e5a120328
  llvm revision 668f2c7fab288db90d474a7f6f72b11e5a120328
Setting up remote platform 'remote-linux'
Connecting to remote platform 'remote-linux' at 'connect://jetson-agx-2198.lab.llvm.org:1234'...
Connected.
Setting remote platform working directory to '/home/ubuntu/lldb-tests'...
Skipping the following test categories: ['dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap']
connect to debug monitor on port 14452 failed, attempt #1 of 20
connect to debug monitor on port 13186 failed, attempt #2 of 20
connect to debug monitor on port 15017 failed, attempt #3 of 20
connect to debug monitor on port 15641 failed, attempt #4 of 20
connect to debug monitor on port 14358 failed, attempt #5 of 20
connect to debug monitor on port 12375 failed, attempt #6 of 20
connect to debug monitor on port 13982 failed, attempt #7 of 20
connect to debug monitor on port 13512 failed, attempt #8 of 20
connect to debug monitor on port 13201 failed, attempt #9 of 20
connect to debug monitor on port 15745 failed, attempt #10 of 20
connect to debug monitor on port 15138 failed, attempt #11 of 20
connect to debug monitor on port 12945 failed, attempt #12 of 20
connect to debug monitor on port 14303 failed, attempt #13 of 20
connect to debug monitor on port 12502 failed, attempt #14 of 20
connect to debug monitor on port 13774 failed, attempt #15 of 20
connect to debug monitor on port 13311 failed, attempt #16 of 20
connect to debug monitor on port 12048 failed, attempt #17 of 20
connect to debug monitor on port 14153 failed, attempt #18 of 20
connect to debug monitor on port 15113 failed, attempt #19 of 20
connect to debug monitor on port 15239 failed, attempt #20 of 20

--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants