{"id":26947168,"url":"https://github.com/lsds/cubicleos","last_synced_at":"2025-04-02T20:18:13.580Z","repository":{"id":48653296,"uuid":"335704690","full_name":"lsds/CubicleOS","owner":"lsds","description":"Compartmentalised monolithic library OS","archived":false,"fork":false,"pushed_at":"2021-07-15T17:43:12.000Z","size":5818,"stargazers_count":19,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-06T20:25:07.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"LLVM","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/lsds.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}},"created_at":"2021-02-03T17:35:45.000Z","updated_at":"2024-06-07T22:10:53.000Z","dependencies_parsed_at":"2022-08-31T20:01:11.109Z","dependency_job_id":null,"html_url":"https://github.com/lsds/CubicleOS","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/lsds%2FCubicleOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsds%2FCubicleOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsds%2FCubicleOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsds%2FCubicleOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsds","download_url":"https://codeload.github.com/lsds/CubicleOS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246884766,"owners_count":20849554,"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":"2025-04-02T20:18:12.920Z","updated_at":"2025-04-02T20:18:13.574Z","avatar_url":"https://github.com/lsds.png","language":"LLVM","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  CubicleOS: A Library OS with Software Componentisation for Practical Isolation\n\nCubicleOS is a prototype of a LibOS that allows to partition a monolithic system without the use of message-based IPC.\nCubicleOS works as a runtime partitioning engine, but requires changes to the software and relies on hardare support, the Intel MPK technology.\n\nCubicleOS offers three core abstractions to component developers: (i) cubicles, which are isolated components; (ii) windows,\nwhich enable dynamic sharing across components; and (iii) cross-cubicle calls, which carry out control flow authorisation.\nTogether, these abstractions provide spatial memory isolation, temporal memory isolation, and control flow integrity, respectively.\n\nCubicleOS is implemented on top of Unikraft, a featurerich library OS that can execute existing POSIX-compatible applications,\nand runs on top of an existing host OS such as Linux.\n\nYou can find detailes about the project, motivation, design and etc here:\n\n```\nVasily A. Sartakov, Lluis Vilanova, Peter Pietzuch: CubicleOS: A Library OS with Software Componentisation for Practical Isolation, accepted to The 26th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS'21), ACM, 2021\n```\n\n## How to build and run\n\nYou may want to install some of these packages:\n```\napt install -y build-essential libncurses-dev python3 expect-dev  moreutils flex unzip bison wget libxml2-utils tclsh \\\n\tpython python-tempita python-six python-future python-ply xorriso qemu-system-x86 curl gawk\n```\nCheck out:\n\n```\ngit clone https://github.com/lsds/cubicleos\n```\n### Check MPK\n```\ncd check_mpk\ngcc ./check.c\n./a.out\n```\n\nExpected output:\n```\npkey alloc = 1\npkey: Success\n```\n\n### Building and running \n```\ncd cubicleos/sqlite\nmake\ncd ../kernel/\nLD_LIBRARY_PATH=./sqlite unbuffer ./loader sqlite --size 100 -mmap 0 --stats testing | ts -s '%M:%.S'\n```\n\nyou can use `sqlite3` and `sqlite4`, they deploy different number of cubicles.\n\n## Some configuration opetions\n\nThere are several options that you can add by changing Makefile or loader.c:\n* NOMPK: Loader implements cross-cubicle calls, but cubicles are not protected. Works on any suitable hardware and does not require porting.\n* ALLOW_APP: There is no isolation between LibOS and Application, but the LibOS is partitioned. Allows to run non-modified Applications.\n* ALLOW_ALL: All cross-cubicle accesses are alowed and don't require Windows. Allows to estimate the overhead of cross-cubicle calls.\n* DEBUG, WDEBUG, WDEBUG2: various forms of debug information\n* WDOT: used to generate DOT diagrams. generates raw data, requires post-processing\n* NWRAP: do not use cross-cubicle calls and MPK. Just run a set of linked modules.\n\n\n## Some CubicleOS internals\n\n* [getcontext.S](kernel/getcontext.S) [setcontext.S](kernel/setcontext.S) [coro.h](kernel/coro.h) [ucontext_i.h](kernel/ucontext_i.h): Implements low-level switching mechanic. Each cross-cubicle call -- coroutine-like switch\n* [elf_hook.h](kernel/elf_hook.h) [elf_hook.c](kernel/elf_hook.c) [plthook_elf.c](kernel/plthook_elf.c)  [plthook.h](kernel/): used to patch GPT and properly parse ELF symbols. Only one will be used in the future.\n* [mini-printf.c](kernel/mini-printf.c) [mini-printf.h](kernel/mini-printf.h): printf inside a trap, needed for debuging at some stage of the development\n* [Makefile](kernel/Makefile): Compiles dependencies, re-link binaries as separate .so libraries.\n* [fig.py](kernel/fig.py): parses [unikraft/unikraft.ll](unikraft/unikraft.ll) and generates cross-cubicle calls for each public function. Generates gen_hooks.h.\n* [loader.c](kernel/loader.c) [headers.h](kernel/headers.h): The Monitor. Loads libraries into memory, patches GPT, intercepts cross-cubicle calls, switches pages between cubicles.\n  \n## Disclaimer\n\nThe project is a proof-of-concept and at a very early development stage. It does not pretend to be ready-to-use. It likely has various flaws, requires significant improvement, and refactoring.\n\n## What does LLVM macro stand for?\n\nEarly prototypes use semi-automatic window management. Now all windows 'manual' and this macro just shows the orgiginal form of variables.\n\n## Known bugs and errors\n\n### RAMFS cannot allocate memory\n\nThere is a known bug inside Unikraft or CubicleOS. It appears once per 10 or 20 runs:\n```\n[ 9971.877293] CRIT: [libramfs] dlmemreq.c @ 41   : cannot allocate memory (262144000) for RAMFS \n```\n\nYou need to stop the test, kill all relevant processes, and start again.\n\n### Does not start \n\nDifferent OSes and Kernels somethimes have a slightly different structure of /proc/self/mem, which we parse at start.\nWe tested CubicleOSs with Debian 10 and Linux kernel 4.4.0. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsds%2Fcubicleos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsds%2Fcubicleos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsds%2Fcubicleos/lists"}