{"id":20191399,"url":"https://github.com/htfy96/rwx_shim","last_synced_at":"2026-04-24T21:31:28.054Z","repository":{"id":239127463,"uuid":"798598226","full_name":"htfy96/rwx_shim","owner":"htfy96","description":"Minimal shim for a writable+executable section on x86-64","archived":false,"fork":false,"pushed_at":"2024-05-10T05:26:56.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T08:40:35.858Z","etag":null,"topics":["asm","c","jit","linux","x86-64"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/htfy96.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":"2024-05-10T05:13:32.000Z","updated_at":"2024-05-11T05:32:49.000Z","dependencies_parsed_at":"2024-05-10T07:43:31.419Z","dependency_job_id":null,"html_url":"https://github.com/htfy96/rwx_shim","commit_stats":null,"previous_names":["htfy96/rwx_shim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/htfy96/rwx_shim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Frwx_shim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Frwx_shim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Frwx_shim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Frwx_shim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/htfy96","download_url":"https://codeload.github.com/htfy96/rwx_shim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htfy96%2Frwx_shim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32241558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["asm","c","jit","linux","x86-64"],"created_at":"2024-11-14T03:48:44.343Z","updated_at":"2026-04-24T21:31:28.040Z","avatar_url":"https://github.com/htfy96.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rwx_shim\n\n`rwx_shim` is a minimalistic tool developed in Assembly and C that enables users to embed variables into sections that are both writable and executable right at the linking stage. This feature is particularly useful for applications that generate a fixed amount of code just-in-time at startup and then run it with minimal changes thereafter. One example is Linux's [Static Keys](https://docs.kernel.org/staging/static-keys.html).\n\nBy using rwx_shim, developers can better manage these sections compared to traditional methods like mapping pages at runtime using mmap. Moreover, it enhances the debugging process, as debuggers could read variable symbols.\n\n## Usage\n\n### Prerequisite\n\n- GNU AS\n- GCC\n- objtool\n- ld\n\nTested platform: x86-64. Supposed to work any recent Linux distro. Sys-V AMD64 ABI.\n\n### Build and use\n\n```bash\n$ make\n# You will see librwx_shim.a and ./test generated under current directory\n\n# See rwx_shim.h for API sample. See test.c for usage example\n\n# To use it in your program, simply include rwx_shim.h and link your binary against librwx_shim.a\n```\n\n```c\n#include \"rwx_shim.h\"\n\n// lea %rax, %rsi(%rdi)\n// ret\nunsigned char add[] RWX_SHIM_SECTION_ATTR = {0x8d, 0x04, 0x37, 0xc3};\n\nint main(void) {\n    _ensure_rwx_shm_linked();\n    seal_rwx_shim();\n    int (*add_func)(int, int) = (void *)(\u0026add);\n    // prints out 63\n    printf(\"Add 42 + 21 = %d\\n\", add_func(42, 21));\n    // add[0] = '\\0'; will cause segmentation fault\n    return 0;\n}\n```\n\n## Security\n\nCreating a wriable and executable section in your binary greatly increases the attack surface and enables easier code execution. Please only use this in a trusted environment.\n\n## License\n\nApache v2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtfy96%2Frwx_shim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhtfy96%2Frwx_shim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtfy96%2Frwx_shim/lists"}