{"id":16164319,"url":"https://github.com/troglobit/libc-chaos","last_synced_at":"2026-03-02T15:36:45.185Z","repository":{"id":136803869,"uuid":"110611908","full_name":"troglobit/libc-chaos","owner":"troglobit","description":"Emit random errors when calling libc functions to emulate an unstable underlying system","archived":false,"fork":false,"pushed_at":"2019-12-14T05:57:41.000Z","size":29,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-07T06:43:19.303Z","etag":null,"topics":["fault-injection","fuzzing","glibc"],"latest_commit_sha":null,"homepage":null,"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/troglobit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-13T22:53:15.000Z","updated_at":"2024-06-10T05:33:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"181faddc-bf22-4fb5-9d95-ae68cdbe1239","html_url":"https://github.com/troglobit/libc-chaos","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Flibc-chaos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Flibc-chaos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Flibc-chaos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Flibc-chaos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/troglobit","download_url":"https://codeload.github.com/troglobit/libc-chaos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240521052,"owners_count":19814694,"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":["fault-injection","fuzzing","glibc"],"created_at":"2024-10-10T02:46:12.391Z","updated_at":"2026-03-02T15:36:45.120Z","avatar_url":"https://github.com/troglobit.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libc-chaos\n\nThis is an MIT licensed `LD_PRELOAD` hack library that introduces random\nerrors in certain libc I/O functions your application uses.\n\nThe main purpose is to test how your application handles an unreliable\nfile system.  It can also be used to locate hard-to-find bugs that only\nhappen once in a blue moon by introducing unexpected delays.\n\n\n## Status\n\nThis library is still in alpha phase supporting the following functions:\n\n- pwrite()\n- pread()\n- write()\n- read()\n- writev()\n- readv()\n\n\n## Examples\n\nMake calling `pread()` have 20% chance to return an `EIO` error:\n\n```\nERROR_RATE=20 LD_PRELOAD=$PWD/libchaos.so PREAD_ERROR=io path/to/your/executable\n```\n\nIntroduce a 3 sec delay in all `writev()` calls:\n\n```\nHANG_TIME=3 WRITEV_ERROR=\"hang\" LD_PRELOAD=$PWD/libchaos.so path/to/your/executable\n```\n\n\n## Control Error Emission with Environment Variables\n\n-   `ERROR_RATE`\ndefines the rate in percentage at what a function call emits an error.\n`0` makes it never emit an error.\n\n-   `HANG_TIME`\ndefines the delay a function should always introduce before returning.\n\n-   `LD_PRELOAD=XXX`\nshould be kept what it is. Never touch it unless you know what you do.\n\n-   `PWRITE_ERROR`\ndefines what error to emit when calling `pwrite()`.\nIts value could be one of:\n    -   `nospace` emits an `ENOSPC` error.\n    -   `io` emits an `EIO` error.\n    -   `intr` emits an `EINTR` error.\n    -   `hang` wait `HANG_TIME` seconds before writing\n\n-   `PREAD_ERROR`\ndefines what error to emit when calling `pread()`.\nIts value could be one of:\n    -   `wrong_byte` change 1 byte in the buffer that is read, before\n        returning to caller.\n    -   `io` emits an `EIO` error.\n    -   `intr` emits an `EINTR` error.\n    -   `hang` wait `HANG_TIME` seconds before reading\n\n-   `READ_ERROR`\nsame as above\n\n-   `WRITE_ERROR`\nsame as above\n\n-   `READV_ERROR`\nsame as above\n\n-   `WRITEV_ERROR`\nsame as above\n\n\n## Copyright and License\n\nCopyright (c) 2015-2016  Zhang Yanpo (张炎泼) \u003cdrdr.xp@gmail.com\u003e  \nCopyright (c) 2017-2019  Joachim Nisson \u003ctroglobit@gmail.com\u003e\n\nThis library was initially written by 张炎泼 (Zhang Yanpo) who\ngraciously released the software under the MIT license.  Later\nJoachim Nilsson picked it up and added a few more APIs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroglobit%2Flibc-chaos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftroglobit%2Flibc-chaos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroglobit%2Flibc-chaos/lists"}