{"id":15389226,"url":"https://github.com/m4b/stackup","last_synced_at":"2025-04-15T20:24:04.024Z","repository":{"id":27373915,"uuid":"30849515","full_name":"m4b/stackup","owner":"m4b","description":"Statically modify a program binary's runtime stack size on Mac OS X --- without recompiling.","archived":false,"fork":false,"pushed_at":"2021-12-30T20:31:05.000Z","size":7,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T01:03:36.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m4b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-16T01:38:35.000Z","updated_at":"2023-05-26T12:57:27.000Z","dependencies_parsed_at":"2022-08-01T10:07:59.148Z","dependency_job_id":null,"html_url":"https://github.com/m4b/stackup","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/m4b%2Fstackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4b%2Fstackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4b%2Fstackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4b%2Fstackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m4b","download_url":"https://codeload.github.com/m4b/stackup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249146455,"owners_count":21220137,"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":[],"created_at":"2024-10-01T14:59:47.031Z","updated_at":"2025-04-15T20:24:04.001Z","avatar_url":"https://github.com/m4b.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stackup\nxnu MAXSSIZ got you down?  `stackup \u003cpath_to_binary\u003e 0xdeadbeef` makes everything all better.\n\nThe Mac OS X kernel 'hardcodes' the stack size (`MAXSSIZ`) to 64MB.\n\nHowever, check out this kernel code in the `load_main` routine in `xnu/bsd/kern/mach_loader.c`:\n\n```` c\nif (epc-\u003estacksize) {\n   result-\u003eprog_stack_size = 1;\n   result-\u003euser_stack_size = epc-\u003estacksize;\n} else {\n  result-\u003eprog_stack_size = 0;\n  result-\u003euser_stack_size = MAXSSIZ;\n}\n````\n\nwhere `epc` is an `entry_point_command` struct.\n\nIn other words, if our binary image contains a non-zero stack size in its `entry_point_command` struct (`LC_MAIN`), the kernel will use that instead of the default `MAXSSIZ`.\n\nSo, if for some reason you can't recompile, don't want to, or just simply want to be cool, you can run this command line tool to statically modify your program's runtime max stack size.\n\nEnjoy.\n\n## Compile\n\n`xcrun --sdk macosx swiftc main.swift -o stackup`\n\n## Examples\n\nSet stack to 1GB: `stackup \u003cpath_to_binary\u003e 0x0x40000000`\n\nSet stack to 0xdeadbeef: `stackup \u003cpath_to_binary\u003e 0xdeadbeef`\n\n# Features\n\n  * Static binary translation for program max stack size.\n  * Variable stack size\n  * No recompilation or source code necessary\n  * Hackish\n\n## TODO:\n\n   1. Enable 32-bit binary translation\n   2. Enable fat-binary (universal) translation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4b%2Fstackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4b%2Fstackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4b%2Fstackup/lists"}