-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Sanitizers] the access size (8 bytes) exceeds the max lock-free size (4 bytes) for 32-bit #125388
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
base: main
Are you sure you want to change the base?
Changes from 20 commits
f9d8e7f
1b7439e
84d973a
3addb86
b0b9c5a
317f5ca
2bae081
0b737c9
e130b14
9715d9e
721a57c
395131e
04857d6
2269b9c
a45304a
195445e
22749c3
cfd96ad
6388207
c3f8734
de739d8
d3857ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -232,7 +232,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, | |||||||||||||||||||
|
|
||||||||||||||||||||
| // Specify linker input file(s). | ||||||||||||||||||||
| AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const SanitizerArgs &Sanitize = ToolChain.getSanitizerArgs(Args); | ||||||||||||||||||||
| if (D.isUsingLTO()) { | ||||||||||||||||||||
| assert(!Inputs.empty() && "Must have at least one input."); | ||||||||||||||||||||
| // Find the first filename InputInfo object. | ||||||||||||||||||||
|
|
@@ -338,6 +338,13 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, | |||||||||||||||||||
| CmdArgs.push_back("-lpthread"); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Required for 64-bit atomic operations used in sanitizer runtimes | ||||||||||||||||||||
| // (e.g., sanitizer_common's atomic utilities). On 32-bit AIX, these | ||||||||||||||||||||
| // are not natively supported, necessitating linkage with -latomic. | ||||||||||||||||||||
| if (Sanitize.hasAnySanitizer() && IsArch32Bit) { | ||||||||||||||||||||
| CmdArgs.push_back("-latomic"); | ||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider adding the code to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the suggestion, @hubert-reinterpretcast. After careful consideration, I believe that keeping the -latomic handling directly in AIX.cpp is the more appropriate approach for the following reasons:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Consistency with Community LLVM Behavior:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Testing and Maintainability: The tests in clang/test/Driver/aix-ld.c are designed around this implementation. Moving the logic would complicate our test setup and risk unintended side effects.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while I appreciate the suggestion and understand the merits of aligning with IBM’s downstream practices, I believe that maintaining the target-specific logic in Please let me know if there are additional points to consider.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The addition of The addition of See
llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp Lines 585 to 586 in f729477
llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp Lines 1607 to 1608 in f729477
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: https://github.com/llvm/llvm-project/pull/125388/files#r1945365070:
In this case, the actual result would have been unintentional platform-specific behaviour.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: https://github.com/llvm/llvm-project/pull/125388/files#r1945365836:
Ignoring the lack of elaboration on how exactly placing this logic in llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp Lines 1452 to 1454 in f729477
The characterization that it is "IBM's downstream" that opted to centralize the logic in said function is misleading. The LLVM community had created said function for logic associated with linking in dependencies for static sanitizer components; IBM's downstream followed with that.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Generally, placing the code in a more widely used path will lead to more likely detection of problems. In other words, minimizing the risk of inadvertently impacting sanitizer handling on non-AIX targets increases the risk of having broken sanitizer handling on AIX. Considering that the risk of breaking non-AIX should be low (especially in an undetected manner) and that the risk of incorrect sanitizer handling on AIX is high during active development, I think deliberate attempts to isolate the AIX code (as opposed to using common code paths) is a mistake. |
||||||||||||||||||||
| } | ||||||||||||||||||||
| C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(), | ||||||||||||||||||||
| Exec, CmdArgs, Inputs, Output)); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1120,3 +1120,19 @@ | |
| // RUN: -c \ | ||
| // RUN: | FileCheck --check-prefixes=CHECK-K-UNUSED %s | ||
| // CHECK-K-UNUSED: clang: warning: -K: 'linker' input unused [-Wunused-command-line-argument] | ||
|
|
||
| // Check No Sanitizer on 32-bit AIX | ||
| // RUN: %clang -target powerpc-ibm-aix -m32 %s -### 2>&1 \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // RUN: | FileCheck -check-prefix=CHECK-LD32-NO-SANITIZER %s | ||
| // CHECK-LD32-NO-SANITIZER-NOT: "-latomic" | ||
|
|
||
| // This test verifies that the linker doesn't include '-latomic' when no sanitizers are enabled | ||
honeygoyal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // FIXME: Running this test on non-AIX host will result in the following error: | ||
| // LLVM ERROR: Sanitizer interface functions must be exported by export files on AIX | ||
|
|
||
| // Check enable AddressSanitizer on 32-bit AIX | ||
honeygoyal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // RUN: %if target={{.*aix.*}} %{ \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this diagnostic
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is strictly in IBM's downstream at this time. It will likely need revisiting before upstreaming. I have requested the removal of the driver part from this PR. |
||
| // RUN: %clang -target powerpc-ibm-aix -m32 -fsanitize=address %s -### 2>&1 \ | ||
| // RUN: | FileCheck -check-prefix=CHECK-LD32-ASAN %s \ | ||
| // RUN: %} | ||
| // CHECK-LD32-ASAN: "-latomic" | ||
hubert-reinterpretcast marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.