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

gh-111178: add UBSan suppression file #124763

Closed

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Sep 29, 2024

This is the suppression file for the current UBSan failures. Technically, invoking

make UBSAN_OPTIONS=suppressions="$(pwd)/Tools/usan/usan.function.supp"

would make the CI/CD green for -fsanitize=function (we'll need to update the build bot so that it uses this suppression file).

Note

Currently, suppressing specific UBSan failures for specific functions in specific files is not supported by Clang, so we need to suppress the entire file (i.e., I won't be able to make function-by-function PRs but will need to make file-by-file PRs).

Note that the files being suppressed are the files where the UB occurs, not where the bad function is being defined.

@picnixz picnixz force-pushed the chore/usan-suppression-file-111178 branch from e64c58b to 4ee9ca3 Compare September 29, 2024 10:46
@vstinner
Copy link
Member

If possible, I would prefer to fix known issues rather than ignoring them.

@encukou
Copy link
Member

encukou commented Oct 2, 2024

That would be best, but this PR could make the UBSan buildbot green so that it can detect other (and more important) kinds of undefined behaviour.


I think we generally put tool configuration in Misc, especially for external tools (valgrind-python.supp, indent.pro); Tools is full of custom-written tooling. Is there a special reason you went for Tools here?

@picnixz
Copy link
Member Author

picnixz commented Oct 2, 2024

Is there a special reason you went for Tools here

I found tsan with suppressions.txt so I thought it was fine to also have the suppressions file in a ubsan folder (which I now see I named usan...)

That would be best, but this PR could make the UBSan buildbot green so that it can detect other (and more important) kinds of undefined behaviour.

For that, we don't really need to because I think the regular UBSan PR bot has -fno-sanitize=function enabled (or maybe not?) It was mostly to make the UBSan Function bot green (and detect it one by one correctly).


By the way, once we're done with those fixes, the file would be anyway empty. I'll actually leave it here so that people can easily pick up what's wrong. There are explanations on which functions to files to patch (and how to generate the up-to-date list of fixable files) so you can just take a look and choose any of the bad files (maybe that's what Victor did? I saw a lot of small PRs today).

@encukou
Copy link
Member

encukou commented Oct 3, 2024

I found tsan with suppressions.txt

Oh! Never mind me then.

the regular UBSan PR bot has -fno-sanitize=function enabled (or maybe not?)

It doesn't: https://buildbot.python.org/#/builders/719/builds/4835/steps/4/logs/stdio
Oh, I see what's up! There's a builder with -fno-sanitize=function, but that's not the one that's marked stable. I filed python/buildmaster-config#536

@picnixz
Copy link
Member Author

picnixz commented Oct 3, 2024

I re-ran my script and some new locations with errors were found (probably because some calls where analyzed differently). So I don't think it's a good idea to have a suppression file =/ (it will likely change every time a new fix is pushed). Maybe the best way to show the issues is to run the script locally? (like our new toy with warnings?)

@encukou
Copy link
Member

encukou commented Oct 4, 2024

Oh. Yeah, that's a good reason against adding the file.

@picnixz
Copy link
Member Author

picnixz commented Oct 4, 2024

Should I write in some devguide or in some internal file so that it can help in the future? (I can also just close the PR and we would remember (probably) it).

@picnixz picnixz marked this pull request as draft October 4, 2024 08:55
@encukou
Copy link
Member

encukou commented Oct 4, 2024

This might be too specific to the current situation, with a lot of UB found with a new check, and with problems being reported in very different places than where they should be fixed.
If we don't set up CI to use the suppression file, I don't think there's much worth documenting -- Clang docs are best resource here, especially since they're kept up to date.

@picnixz
Copy link
Member Author

picnixz commented Oct 4, 2024

Closing since we won't add it anyway. I'll just post the script on the issue so that people can just cc it if needed.

@picnixz picnixz closed this Oct 4, 2024
@picnixz picnixz deleted the chore/usan-suppression-file-111178 branch October 4, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra CI, GitHub Actions, buildbots, Dependabot, etc. skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants