{"id":28956520,"url":"https://github.com/fredtux/dfsproc","last_synced_at":"2026-05-08T10:35:37.917Z","repository":{"id":118941797,"uuid":"572035863","full_name":"fredtux/dfsproc","owner":"fredtux","description":"Linux system call to list processes in DFS order","archived":false,"fork":false,"pushed_at":"2023-01-20T16:12:36.000Z","size":3326,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-23T21:07:31.771Z","etag":null,"topics":["c","haskell","haskell-inlinec","linux","linux-kernel","linux-syscall"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fredtux.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,"zenodo":null}},"created_at":"2022-11-29T12:24:10.000Z","updated_at":"2023-01-20T15:48:05.000Z","dependencies_parsed_at":"2023-09-17T01:47:17.977Z","dependency_job_id":null,"html_url":"https://github.com/fredtux/dfsproc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fredtux/dfsproc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2Fdfsproc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2Fdfsproc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2Fdfsproc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2Fdfsproc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredtux","download_url":"https://codeload.github.com/fredtux/dfsproc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredtux%2Fdfsproc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32776910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["c","haskell","haskell-inlinec","linux","linux-kernel","linux-syscall"],"created_at":"2025-06-23T21:07:30.637Z","updated_at":"2026-05-08T10:35:37.902Z","avatar_url":"https://github.com/fredtux.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux system call to list processes in DFS order\n\n\n- This project was made for the Operating Systems laboratory from the University of Bucharest\n- It is based on the **Linux Kernel 6.0.6**\n- Contains the kernel patch, building and debugging config files and 3 userland programs\n- The code for the syscall can be located in **dfsproc** directory\n\n# Table of contents\n* [PART I : Building the kernel and testing environment with buildroot](https://github.com/fredtux/dfsproc#part-i--building-the-kernel-and-testing-environment-with-buildroot)\n* [PART II : Debugging the kernel](https://github.com/fredtux/dfsproc#part-ii--debugging-the-kernel)\n* [PART III : Userland applications](https://github.com/fredtux/dfsproc#part-iii--userland-applications)\n\n# PART I : Building the kernel and testing environment with buildroot\n## Preparing the kernel\nUse the patch file inluded in `dfsproc.patch` by issuing this command in the linux kernel source code directory\n```bash\npatch -p1 \u003c dfsproc.path\n```\n### Optional\nIf you want to replicate my local testing environment with Qemu, buildroot and the kernel build for debugging, then follow these 2 steps (this tutorial will assume you have completed this step, otherwise you are free to choose your own options):\n1. Place the `optional/kernel/.config` file for kernel config in your linux kernel source code directory.\n2. For buildroot there is a configuration file that you should place into your buildroot directory. The file is located at `optional/buildroot/.config`\n\n## Building the kernel\nIssue the following commands\n1. For building the `.config` file\n```bash\nmake menuconfig\n```\n2. For building the kernel\n```bash\nmake -j $(nproc)\n```\n3. For building the modules\n```bash\nmake modules -j $(nproc)\n```\n\n## Building buildroot\nThis section is a more streamlined (and less flexible) version of the tutorial found here: [https://www.nullbyte.cat/post/linux-kernel-exploit-development-environment/](https://www.nullbyte.cat/post/linux-kernel-exploit-development-environment/). At the end there is an optional bash script that executes qemu with all of the needed parameters\n\n**Replace `/path_to_buildroot` with your own path to the buildroot directory.**\n\n1. Configure buildroot\n```bash\nmake menuconfig\n```\n2. Add overlay directories\n```bash\nmkdir /path_to_buildroot/buildroot/overlay/etc/\n```\n\n3. Add this text to a new file in `/path_to_buildroot/buildroot/overlay/etc/shadow` (the default user:password will be **root:root** and **user:user**)\n```\nroot:$5$AQRgXbdJ$eCko6aRPrhOBegsJGLy36fmmrheNtfkUMBjlKPWEXW9:10000:0:99999:7:::\ndaemon:*:10933:0:99999:7:::\nbin:*:10933:0:99999:7:::\nsys:*:10933:0:99999:7:::\nsync:*:10933:0:99999:7:::\nmail:*:10933:0:99999:7:::\nwww-data:*:10933:0:99999:7:::\noperator:*:10933:0:99999:7:::\nnobody:*:10933:0:99999:7:::\nuser:$5$QAucgwIL$onnijv2MwdMD.Jze4LgPx7z3kksIjU18y3jffH2urv3:10000:0:99999:7:::\n```\n4. Add the home folder for the user \"user\"\n```bash\nmkdir -p /path_to_buildroot/buildroot/overlay/home/user\n```\n5. Set the permissions to the device table\n```bash\necho -e '/home/user\\td\\t755\\t1000\\t100\\t-\\t-\\t-\\t-\\t-' \u003e\u003e /path_to_buildroot/buildroot/system/device_table.txt\n```\n## Adding kernel modules to buildroot\nFor installing the modules with buildroot\n```bash\nmake modules_install INSTALL_MOD_PATH=/path_to_buildroot/buildroot/overlay -j $(nproc)\n```\n\n## Compiling buildroot\nUse the following commands\n```bash\nmake source\nmake -j $(nproc)\n```\n\n## Starting the kernel\nCopy and **modify the paths** in the `optional/start` file and run it. I suggest keeping buildroot and the linux kernel in the same directory for simplicity.\n```bash\n./start\n```\nThis file will start buildroot within a terminal\n\n## Connecting to the environment\n### Connect thorugh ssh\nConnect to the user account using the **user** password\n```bash\nssh -p 2222 user@localhost -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\n```\n### Compiling files for the environment\n**Please use -no-pie and --static for C**\n\nAs an example we'll take the florin/f1_c.c file.\n```bash\ngcc f1_c.c -o f1 --static -no-pie\n```\n\n### Transferring binaries through scp\n```bash\nscp -P 2222 f1 user@localhost:/home/user/\n```\n# PART II : Debugging the kernel\nTo start debugging issue this command:\n```bash\ngdb linux-6.0.6/vmlinux\n```\nTo connect to the server issue this command inside gdb\n```\ntarget remote localhost:1234\n```\nTo set a breakpoint inside the dfsproc system call at line 100 (change the number with the desired line)\n```\nb dfsproc/dfsproc.c:100\n```\nIt should start debugging once it hits the breakpoint.\n## Debug with VSCode\nCopy the `optional/.vscode` directory to the linux kernel source code directory and open the kernel source code directory. Then while the kernel is loaded with buildroot set a debug point and press F5. It should start debugging once it hits the breakpoint.\n\n# PART III : Userland applications\n## Florin\nMy userland programs located in **florin** directory\n\n### First application\nBuild the f1_c.c application like this\n```bash\ngcc f1_c.c -o f1 --static -no-pie\n```\nCopy it to the virtual machine\n```bash\nscp -P 2222 f1 user@localhost:/home/user/\n```\nConnect to the virtual machine either directly (not recommended) or via ssh and run\n```bash\n./f1\n```\n### Second application\nCopy libgmp.so.10 to the virtual machine\n```bash\n scp -P 2222  optional/libgmp.so.10 root@localhost:/lib/libgmp.so.10\n ```\nCompile the file with either stack or cabal. For cabal use:\n```bash\ncabal build\n```\nCopy the resulting file to the virtual machine\n```bash\nscp -P 2222 f2 user@localhost:/home/user/\n```\nConnect to the virtual machine either directly (not recommended) or via ssh and run\n```bash\n./f2\n```\n**Note that it expects an input, let's say 1**\n\n## Anca\nAnca's userland programs located in **anca** directory\n\nFirst application\nBuild the a1.c application like this\n\ngcc a1.c -o a1 --static -no-pie\nCopy it to the virtual machine\n\nscp -P 2222 a1 user@localhost:/home/user/\nConnect to the virtual machine either directly (not recommended) or via ssh and run\n\n./a1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredtux%2Fdfsproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredtux%2Fdfsproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredtux%2Fdfsproc/lists"}