Skip to content

[SanCov] Support SanitizerCoverage for CHERI purecap binaries #765

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

RoundofThree
Copy link
Member

This PR adds support for compiling purecap binaries with -fsanitize-coverage.

I have tested this in CHERI RISCV qemu.

This commit fixes type mismatches between uptr and usize.
This avoids the following errors:

<inline asm>:10:1: error: instruction requires the following: Not Capability Mode
   10 | tail __interceptor_signal@plt
      | ^
<inline asm>:19:1: error: instruction requires the following: Not Capability Mode
   19 | tail __interceptor_sigaction@plt
      |
@RoundofThree RoundofThree changed the title [SanCov] Support SanitizerCoverage for CHERI purecap binaries [SanCov][WIP] Support SanitizerCoverage for CHERI purecap binaries Apr 23, 2025
…n CHERI

When multiple private sancov global variables across object files share the same name,
even though they won't collide when they are linked together, their corresponding
__cap_merged_table will. This commit appends a unique module identifier to the sancov
global variable names to prevent collision. In the event that the unique module identifier
obtained through getUniqueModuleId() is empty, we use the clang PID and time.
@RoundofThree RoundofThree changed the title [SanCov][WIP] Support SanitizerCoverage for CHERI purecap binaries [SanCov] Support SanitizerCoverage for CHERI purecap binaries Apr 24, 2025
@RoundofThree RoundofThree requested a review from arichardson May 21, 2025 17:45
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.

1 participant