python / buildmaster-config

Configuration for buildbot.python.org
https://buildbot.python.org/all/#/
30 stars 56 forks source link

Add Arch Linux Usan 3.x/ build bot with `-fno-sanitize=function` #517

Closed picnixz closed 2 weeks ago

picnixz commented 1 month ago

Bug report

Bug description:

Tests are broken for build bot Arch Linux Usan 3.x/4532 since the compilation fails with:

Objects/object.c:1071:16: runtime error: call to function long_hash through pointer to incorrect function type 'long (*)(struct _object *)'
/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Objects/longobject.c:3618: note: long_hash defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Objects/object.c:1071:16 in
make: *** [Makefile:1691: Python/frozen_modules/getpath.h] Error 1

See for instance https://buildbot.python.org/#/builders/720/builds/1300.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

picnixz commented 1 month ago

Closing in favor of the meta-issue python/cpython#111178

picnixz commented 1 month ago

Because of the sheer amount of work to do (I just looked at what I needed to do, fixed 1-2 things and then gave up), I suggest adding a new build bot with -fsanitize=undefined -fno-sanitize=function -fsanitize-recover. That way, we could catch the other undefined behaviours that are not due to those casts. Currently, the build bot fails fast (and we only see 1 UB per build due to the -fno-sanitize-recover) but I think that most of the time, we won't have a lot of UBs (or else it's bad for us...). As such, having a build bot that builds entirely (with -fsanitize-recover) instead of fast-failing would help a lot in detecting the other cases.

Once this new build bot is green, we can focus on eliminating the UBs related to function pointers.

Note: see https://github.com/python/cpython/pull/123004#issuecomment-2288611116 for what was detected as a first pass. I suspect there are UBs that are not detected but that's for another day.

Originally posted by @picnixz in https://github.com/python/cpython/issues/111178#issuecomment-2289087204

picnixz commented 4 weeks ago

@pablogsal I was told that you were responsible for the USAN build bot. Could you consider adding a build bot with the above configuration (namely, -fsanitize=undefined -fno-sanitize=function -fsanitize-recover) please?

erlend-aasland commented 4 weeks ago

Should this issue be moved to the buildbot repo?

picnixz commented 4 weeks ago

Oh yes, please. How can I do it easily? Should I just close this one and open a new one out there? (I forgot about the other repository...)

picnixz commented 4 weeks ago

Should this issue be moved to the buildbot repo?

Is the repository in question: https://github.com/python/buildmaster-config? or is it another one?

pablogsal commented 4 weeks ago

@pablogsal I was told that you were responsible for the USAN build bot. Could you consider

adding a build bot with the above configuration (namely, -fsanitize=undefined -fno-sanitize=function -fsanitize-recover) please?

Yeah absolutely! Do you want another bot with those settings or to just substitute the current one?

pablogsal commented 4 weeks ago

I have transferred the issue 👍

picnixz commented 4 weeks ago

I would like to keep the current one because it's important to cover -fsanitize=undefined in general, so another one it would be. Thank you in advance (and for transfering the issue)! Alternatively, what you could do with the current one is to remove the -fno-sanitize-recover option so that the build does not early exit. I'm not sure whether you wanted an early exit or not in order to reduce the resources being taken by the way but by exiting early, we can only patch one error per build being triggered.

encukou commented 2 weeks ago

Another option would be to add an ignore list to Misc/ (next to the Valgrind suppression file), keep the currently known failures there, and turn it on for --with-undefined-behavior-sanitizer builds (including the buildbot).

I'm not sure if that supports filtering on function, though. Another option would be a runtime suppression list.

pablogsal commented 2 weeks ago

Opened https://github.com/python/buildmaster-config/pull/519

picnixz commented 2 weeks ago

Thank you!