{"id":13837764,"url":"https://github.com/lac-dcc/honey-potion","last_synced_at":"2026-01-16T11:54:10.138Z","repository":{"id":37800868,"uuid":"447301101","full_name":"lac-dcc/honey-potion","owner":"lac-dcc","description":"Writing eBPF programs with Elixir!","archived":false,"fork":false,"pushed_at":"2026-01-12T03:14:50.000Z","size":5704,"stargazers_count":290,"open_issues_count":9,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-01-12T10:09:55.520Z","etag":null,"topics":["bpf","bpftool","c","clang","compiler","compiler-construction","compiler-design","compilers","ebpf","elixir","elixir-lang","elixir-library","framework","libbpf","linux","linux-kernel","metaprogramming","network-monitoring","optimizer","tracing"],"latest_commit_sha":null,"homepage":"https://lac-dcc.github.io/honey-potion/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lac-dcc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-12T17:00:27.000Z","updated_at":"2026-01-04T09:19:27.000Z","dependencies_parsed_at":"2023-02-18T17:45:46.396Z","dependency_job_id":"2135074d-2d48-45f8-9202-b94b01212023","html_url":"https://github.com/lac-dcc/honey-potion","commit_stats":{"total_commits":114,"total_committers":9,"mean_commits":"12.666666666666666","dds":0.7456140350877193,"last_synced_commit":"8ecf51f3573c34d3d2e7b1382a940e4bfb2aa0cc"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lac-dcc/honey-potion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lac-dcc%2Fhoney-potion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lac-dcc%2Fhoney-potion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lac-dcc%2Fhoney-potion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lac-dcc%2Fhoney-potion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lac-dcc","download_url":"https://codeload.github.com/lac-dcc/honey-potion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lac-dcc%2Fhoney-potion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"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":["bpf","bpftool","c","clang","compiler","compiler-construction","compiler-design","compilers","ebpf","elixir","elixir-lang","elixir-library","framework","libbpf","linux","linux-kernel","metaprogramming","network-monitoring","optimizer","tracing"],"created_at":"2024-08-04T15:01:24.491Z","updated_at":"2026-01-16T11:54:10.130Z","avatar_url":"https://github.com/lac-dcc.png","language":"C","funding_links":[],"categories":["LLVM"],"sub_categories":[],"readme":"# 🍯 Honey Potion - Writing eBPF with Elixir 🍯\n\n[![Hex Version](https://img.shields.io/hexpm/v/honey.svg)](https://hex.pm/packages/honey)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/honey/)\n[![Total Download](https://img.shields.io/hexpm/dt/honey.svg)](https://hex.pm/packages/honey)\n[![License](https://img.shields.io/hexpm/l/honey.svg)](https://github.com/lac-dcc/honey-potion/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/lac-dcc/honey-potion.svg)](https://github.com/lac-dcc/honey-potion/commits/master)\n[![join discord](https://badgen.net/badge/discord/Join%20Honey%20on%20Discord/discord?icon=discord\u0026label\u0026color=blue)](https://discord.gg/uqRmWkJ3eT)\n\n## 🐝 About\n\n**Honey Potion** is a framework that brings the power of **[eBPF](https://ebpf.io/)** to Elixir, allowing users to write Elixir code that is transformed into eBPF bytecode.\n\nIn this alpha version, Honey Potion translates Elixir code into a subset of C that leverages [libbpf](https://github.com/libbpf/libbpf). The generated C code is then compiled using `clang` to produce the eBPF bytecode, which can be loaded into the kernel.\n\n![Honey Potion Logo](./assets/honey.png)\n\n---\n\n## 📦 Dependencies\n\nHoney Potion requires the following dependencies, listed with their Ubuntu package names (equivalents exist for other distributions):\n\n- **Erlang \u0026 Elixir** – Required for running Honey Potion\n- **libbpf** – Version 1.1 ([installation guide](https://www.youtube.com/watch?v=PhHs9u9toTg\u0026list=PL9cmSHf85lF5HzCha020qegkKQ3GpiEBY\u0026index=2))\n- **gcc-multilib** – Required for certain C libraries (`asm/types.h`)\n- **make** – For Makefile-based compilation\n- **llvm** – Provides `llc`\n- **clang** – Required for compilation\n- **bpftool** – Used for skeleton generation\n\n\u003e ℹ️ **Note:** You can manually compile `clang`, `llc`, and `bpftool`, as long as they are available in your `$PATH`.\n\n---\n\n## 🎥 Video Guide\n\nPrefer a video tutorial? Check out the [Honey Potion YouTube playlist](https://www.youtube.com/playlist?list=PL9cmSHf85lF5HzCha020qegkKQ3GpiEBY) with step-by-step guides.\n\n[![YouTube Thumbnail](./assets/youtube.png)](https://www.youtube.com/playlist?list=PL9cmSHf85lF5HzCha020qegkKQ3GpiEBY)\n\n---\n\n## 🚀 Installation\n\nAdd `honey` to your project's dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:honey, git: \"https://github.com/lac-dcc/honey-potion/\", submodules: true}\n  ]\nend\n```\n\n---\n\n## 📝 Usage\n\nWhen you `use Honey` in your module, it will be translated to C the next time you compile your project.\n\n```elixir\ndefmodule Minimal do\n  use Honey, license: \"Dual BSD/GPL\"\n  # ...\nend\n```\n\nThis generates the following directories:\n\n- **`src/`** – Stores the generated C code (e.g., `Minimal.bpf.c`)\n- **`obj/`** – Stores compilation objects (e.g., `Minimal.o`)\n- **`bin/`** – Stores the final executable (e.g., `Minimal`)\n\nTo run your program, navigate to the `bin/` directory and execute the binary with appropriate privileges.\n\n### 🔧 Command-line Options\n\n- `-p` → Prints all eBPF maps\n- `-t \u003cseconds\u003e` → Specifies the duration the program should run\n\n#### 🎯 The `main/1` Function\n\nEvery module using `Honey` must define a `main/1` function that serves as the entry point for the eBPF program.\n\n```elixir\ndefmodule Example.Minimal do\n  use Honey, license: \"Dual BSD/GPL\"\n\n  @sec \"tracepoint/syscalls/sys_enter_kill\"\n  def main(ctx) do\n    # ...\n  end\nend\n```\n\n- `@sec` specifies the **program type** according to `libbpf`.\n- `ctx` is a struct whose fields vary depending on the program type.\n- The `main/1` function **must** return an integer; otherwise, a runtime exception is thrown.\n\nFor detailed documentation and examples, see:\n\n- [`Language`](docs/getting_started/language.md)\n- Example programs in [`/examples`](examples):\n  - [`hello_world`](examples/hello_world/)\n  - [`maps`](examples/maps/)\n  - [`count_syscalls`](examples/count_syscalls/)\n  - [`force_kill`](examples/force_kill/)\n\nOr watch the [YouTube tutorial](https://www.youtube.com/watch?v=Wis5e3vLcMg).\n\n---\n\n## ⚠️ Runtime Exceptions\n\nAs Elixir is a dynamically typed language, we simulate runtime exceptions when translating programs to eBPF.\n\nIn this Alpha version, if an exception occurs, it will be printed to the debug pipe, and the program will exit with status `0`.\n\n---\n\n## 🚧 Current Limitations\n\nHoney Potion is still in **Alpha**, and many features are still being developed. Some known limitations include:\n\n- **Pattern Matching:** No destructuring; `=` behaves like an assignment operator.\n- **Control Flow:** No `case` or `if-else` blocks (unless optimized out at compile time).\n- **Operators:** Limited to `+`, `-`, `*`, `/`, and `==`.\n- **Function Guards:** Not supported.\n- **Default Arguments:** Not supported.\n- **Recursion:** No mutual recursion support.\n- **Structs:** User-defined structs are not supported.\n- **Execution Requirements:** Executable must reside in `bin/`, and the object file must be in `obj/`.\n\nWe are actively working to improve Honey Potion. Stay tuned!\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome! To avoid redundant work, please reach out before submitting major changes.\n\nFeedback and suggestions are highly appreciated! You can:\n\n- Open a [GitHub issue](https://github.com/lac-dcc/honey-potion/issues)\n- Contact us at **kaelsoaresaugusto@gmail.com**\n\n---\n\n## 📜 License\n\n**Honey Potion** is maintained by the **Compilers Laboratory** at the **Federal University of Minas Gerais (UFMG), Brazil**.\n\nThis program is **free software** under the terms of the **GNU General Public License (GPLv3)**.\n\nFor details, see the full license: [GNU GPL v3](https://www.gnu.org/licenses/).\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flac-dcc%2Fhoney-potion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flac-dcc%2Fhoney-potion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flac-dcc%2Fhoney-potion/lists"}