RESOLVED FIXED 230460
Make valgrind work properly without extra environment variables
https://bugs.webkit.org/show_bug.cgi?id=230460
Summary Make valgrind work properly without extra environment variables
Michael Catanzaro
Reported 2021-09-19 09:37:59 PDT
Currently to run WebKit under valgrind, we have to manually disable bmalloc with Malloc=1, or else: * The Gigacage breaks everything, because valgrind shadows the entire address space in resident memory, and it just can't handle that much address space * Even with GIGACAGE_ENABLED=0, diagnostics are worse because bmalloc does not use valgrind's annotations Using valgrind.h, we can automatically disable bmalloc when running under valgrind to avoid needing to use the environment variable. Additionally, WebKitGTK and WPE WebKit users also have to set the WEBKIT_FORCE_SANDBOX=0 environment variable, because the web process sandbox breaks valgrind for some reason I never attempted to understand. If we have bmalloc expose valgrind.h as a public header, then we can check for valgrind in higher layers and make this work automatically too.
Attachments
Patch (471.86 KB, patch)
2021-09-19 09:48 PDT, Michael Catanzaro
no flags
Patch (440.00 KB, patch)
2021-11-15 11:17 PST, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2021-09-19 09:48:20 PDT
Michael Catanzaro
Comment 2 2021-09-19 09:51:22 PDT
Q: valgrind.h is complicated we only need RUNNING_ON_VALGRIND. Do we really need the whole thing? A: RUNNING_ON_VALGRIND is also really complicated. :P The header is designed to be a copylib and it's normal for projects that implement their own memory allocators to just include the whole thing (e.g. GLib has its own copy). Q: What is up with Source/bmalloc/bmalloc.xcodeproj/project.pbxproj? A: I don't know. Perhaps webkit-patch sorts it automatically?
Michael Catanzaro
Comment 3 2021-09-23 08:11:26 PDT
Ping bmalloc reviewers!
Radar WebKit Bug Importer
Comment 4 2021-09-26 09:38:16 PDT
Michael Catanzaro
Comment 5 2021-11-02 13:44:20 PDT
(In reply to Michael Catanzaro from comment #3) > Ping bmalloc reviewers! Final ping before I ask for GTK/WPE reviewers
Michael Catanzaro
Comment 6 2021-11-11 10:01:55 PST
Ping GTK/WPE reviewers
EWS
Comment 7 2021-11-12 12:46:10 PST
Tools/Scripts/svn-apply failed to apply attachment 438597 [details] to trunk. Please resolve the conflicts and upload a new patch.
Adrian Perez
Comment 8 2021-11-14 14:39:14 PST
(In reply to EWS from comment #7) > Tools/Scripts/svn-apply failed to apply attachment 438597 [details] to trunk. > Please resolve the conflicts and upload a new patch. The patch will need a rebase before it can land. Michael, could you take a stab at that when you have some spare cycles? Thanks!
Michael Catanzaro
Comment 9 2021-11-15 11:17:14 PST
EWS
Comment 10 2021-11-15 11:46:20 PST
Committed r285819 (244261@main): <https://commits.webkit.org/244261@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 444277 [details].
Note You need to log in before you can comment on or make changes to this bug.