{"id":18627490,"url":"https://github.com/yugr/valgrind-preload","last_synced_at":"2025-04-11T05:31:44.063Z","repository":{"id":41440440,"uuid":"84003812","full_name":"yugr/valgrind-preload","owner":"yugr","description":"LD_PRELOAD-able library which runs all spawned processes under Valgrind.","archived":false,"fork":false,"pushed_at":"2022-07-01T20:01:51.000Z","size":64,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-08T22:25:49.750Z","etag":null,"topics":["binfmt","chroot","dynamic-analysis","valgrind"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yugr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-05T21:33:50.000Z","updated_at":"2022-05-17T11:29:57.000Z","dependencies_parsed_at":"2022-09-01T13:40:53.620Z","dependency_job_id":null,"html_url":"https://github.com/yugr/valgrind-preload","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fvalgrind-preload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fvalgrind-preload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fvalgrind-preload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fvalgrind-preload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yugr","download_url":"https://codeload.github.com/yugr/valgrind-preload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223460478,"owners_count":17148756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binfmt","chroot","dynamic-analysis","valgrind"],"created_at":"2024-11-07T04:42:35.267Z","updated_at":"2024-11-07T04:42:35.755Z","avatar_url":"https://github.com/yugr.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](http://img.shields.io/:license-MIT-blue.svg)](https://github.com/yugr/Localizer/blob/master/LICENSE.txt)\n[![Build Status](https://github.com/yugr/valgrind-preload/actions/workflows/ci.yml/badge.svg)](https://github.com/yugr/valgrind-preload/actions)\n[![codecov](https://codecov.io/gh/yugr/valgrind-preload/branch/master/graph/badge.svg)](https://codecov.io/gh/yugr/valgrind-preload)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/yugr/valgrind-preload.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/yugr/valgrind-preload/alerts/)\n[![Coverity Scan](https://scan.coverity.com/projects/yugr-valgrind-preload/badge.svg)](https://scan.coverity.com/projects/yugr-valgrind-preload)\n\n\n# What's this?\n\nValgrind-preload (AKA Pregrind) is a simple `LD_PRELOAD`-able library\nwhich will cause all spawned processes to be started under Valgrind.\n\nIt's functionality is similar to Valgrind's standard `--trace-children=yes`\nbut fixes few disadvantages:\n* avoids intrumenting setuid processes (Valgrind\n  [doesn't handle them](http://stackoverflow.com/questions/1701752/how-do-i-run-valgrind-to-a-process-which-has-super-user-bit-on)\n  so you have to laboriously blacklist all of them via `--trace-children-skip`\n  which is unreliable and disables instrumentation of grandchildren)\n* can easily be enabled for the whole distro or chroot via `ld.so.preload`\n  (no need to search for `init` and replace it with a wrapper)\n\nThe tool seems to be pretty stable now, e.g. I was able to\n[instrument complete Debian package builds](https://github.com/yugr/debian_pkg_test/tree/master/examples/valgrind-preload)\nand even found [several new errors](https://github.com/yugr/valgrind-preload#trophies).\n\n# Usage\n\nTo use, just preload `libpregrind.so` to your app:\n\n    $ LD_PRELOAD=path/to/libpregrind.so app arg1 ...\n\nYou can also use a simple wrapper script:\n\n    $ path/to/pregrind app arg1 ...\n\nFinally, if you want to instrument _whole system_, preload `libpregrind.so`\nglobally:\n\n    $ echo path/to/libpregrind.so \u003e\u003e /etc/ld.so.preload\n\nNote that in this mode `libpregrind.so` will be preloaded to\n_all newly started processes_ so any malfunction may permanently break your\nsystem. It's thus highly recommended to only do this in a chroot or VM.\n\nLibrary can be customized through environment variables:\n* PREGRIND\\_LOG\\_PATH - log to files inside this directory, rather than to stderr\n* PREGRIND\\_FLAGS - additional flags for Valgrind (e.g. `--track-origins=yes`)\n* PREGRIND\\_VERBOSE - print diagnostic info\n* PREGRIND\\_DISABLE - disable instrumentation\n* PREGRIND\\_BLACKLIST - name of file with wildcard patterns of files\n  which should not be instrumented\n\n# Build\n\nTo build the tool, simply run make from top directory.\n\n# Trophies\n\n* [acl: Uninitialized value in lt-setfacl](http://savannah.nongnu.org/bugs/index.php?50566) (fixed)\n* [libsndfile: Uninitialized format in error\\_test](https://github.com/erikd/libsndfile/issues/209) (fixed)\n* [libsndfile: Buffer overflow in string\\_test](https://github.com/erikd/libsndfile/issues/208) (was already fixed in upstream)\n* [docbook-to-man: Memcpy parameter overlap in docbook-to-man](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=858389) (fixed)\n\n# Known issues\n\nVarious TODO and FIXME are scattered all over the codebase\nbut tool should be quite robust. Ping me if you need more features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugr%2Fvalgrind-preload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyugr%2Fvalgrind-preload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugr%2Fvalgrind-preload/lists"}