frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Kpython – A MicroPython Sidecar for the Linux Kernel (Experimental)

https://github.com/pymergetic/kpython
2•kpython•1h ago

Comments

kpython•1h ago
Hi HN,

I’ve been working on a little experiment rooted in a simple "What if?": Could we embed a high-level, garbage-collected runtime directly into the Linux Kernel to act as a programmable sidecar?

The goal wasn't to replace C or Rust, but to enable rapid prototyping and dynamic logic in Ring 0 without the "edit-compile-reboot" loop.

The result is kpython. It runs a stripped-down MicroPython interpreter inside a kernel module, allowing you to pipe Python code directly into debugfs for immediate execution.

* Repo:* https://github.com/pymergetic/kpython

The "Sidecar" Concept

Think of it as a dynamic scripting layer sitting alongside your rigid kernel modules.

Rapid Debugging: Inspect kernel structures or variables interactively.

Dynamic Logic: Imagine filtering network packets with a Python one-liner like if pkt.ip.src in blocklist: drop() (Socket bindings are conceptually possible and currently WIP).

AI Integration: It opens the door for LLMs to read dmesg and suggest/apply non-destructive fixes or diagnostics live.

Technical Implementation

Porting a runtime like MicroPython to the kernel space required solving a few interesting challenges:

Memory Safety: I mapped the Python allocator to vmalloc and implemented atomic-aware wrappers to prevent sleeping in interrupt contexts.

Exception Handling: Since the kernel lacks setjmp/longjmp, I implemented a custom x86_64 assembly shim to handle Python's non-local returns (NLR) safely.

Stack Constraints: To respect the small kernel stack (16KB), the interpreter enforces a strict 12KB stack limit to catch recursion early.

Minimalism: No FPU usage, no standard libc dependencies.

Status: Experimental

This is a research prototype. Running a GC in Ring 0 comes with risks. A bug here panics the kernel. Please do not use this on production systems.

Call for Collaboration

I’ve built the core engine, but there is huge potential for specific integrations (Netfilter hooks, VFS access, etc.). If you are a kernel developer or interested in embedded Python, I’d love your feedback or PRs to help stabilize the "sidecar".

Rich Headers: leveraging this mysterious artifact of the PE format

https://www.virusbulletin.com/virusbulletin/2020/01/vb2019-paper-rich-headers-leveraging-mysterio...
1•todsacerdoti•1m ago•0 comments

Building a Multiplayer Game with Polyglot Microservices: Architecture Lessons

https://gitlab.com/RobinTrassard/codenames-microservices/-/tree/account-java-version
1•birdculture•1m ago•0 comments

I was tired of removing video backgrounds, so I built a simpler solution

https://removebgvideo.com/
1•quchao•2m ago•1 comments

Unpredictable code behavior is a hidden driver of cloud waste

https://portugalstartupnews.com/2025/12/12/the-cloud-mistake-that-quietly-drains-startup-runway/
1•rodriguejr•2m ago•1 comments

Building Trustworthy AI Agents

https://www.schneier.com/blog/archives/2025/12/building-trustworthy-ai-agents.html
1•Garbage•2m ago•0 comments

'It May Be Worse'–No Fix for New Google Chrome Attacks

https://www.forbes.com/sites/zakdoffman/2025/12/12/it-may-be-worse-no-fix-for-new-threat-to-googl...
2•ColinWright•8m ago•0 comments

The simple cult camera that inspired Instagram (2017)

https://www.bbc.com/future/article/20171113-the-toy-camera-that-inspired-instagram
1•mastazi•9m ago•0 comments

Over 12,000 Startup Ideas Right Here

1•suhaspatil101•10m ago•0 comments

Clean, Limitless Energy Exists. China Is Going Big in the Race to Harness It

https://www.nytimes.com/2025/12/13/climate/china-us-fusion-energy.html
2•fleahunter•13m ago•0 comments

Get your social Media to explode

https://magiclip.io/article-subtitles.html
2•Sabr0•19m ago•1 comments

I think I might be done for a while

https://varunraghu.com/i-think-i-might-be-done-for-a-while/
4•Lagogarda•19m ago•1 comments

Can I use HTTPS RRs?

https://www.netmeister.org/blog/https-caniuse.html
1•fanf2•34m ago•0 comments

How much AI do we need, really?

https://newsletter.alastairrushworth.com/p/how-much-ai-do-we-need-really
1•alastairr•37m ago•0 comments

Tell HN: Cloudflare now censors Polymarket in Germany

2•baobabKoodaa•38m ago•2 comments

The secretive world of North Korean science fiction (2023)

https://arstechnica.com/culture/2023/08/the-strange-secretive-world-of-north-korean-science-fiction/
2•doener•45m ago•0 comments

Windows 3.1 in the Browser

https://www.pcjs.org/software/pcx86/sys/windows/3.10/
4•memalign•46m ago•0 comments

Show HN: Hands on tutorial for open source contribution

https://github.com/firstcontributions/first-contributions
3•promptmike•50m ago•0 comments

New Solitaire Gaming Website

https://www.trysolitaire.com
1•ssmallya•53m ago•0 comments

Show HN: League of Legends AI Assistant (OpenSource)

https://github.com/sorena-ai/LeagueAiCoach
2•legalcriminal•56m ago•0 comments

Gemini with Thinking 3 Pro can't script multi-line string replacement

1•YouAreWRONGtoo•1h ago•0 comments

Can We Really Claim That Civilization is on the Steady Path of Progress?

https://lithub.com/can-we-really-claim-that-civilization-is-on-the-steady-path-of-progress/
3•robtherobber•1h ago•0 comments

Commonplace Book

https://en.wikipedia.org/wiki/Commonplace_book
2•tosh•1h ago•0 comments

Sperm donor with cancer-causing gene fathers nearly 200 children

https://scienceclock.com/sperm-donor-carrying-rare-cancer-causing-gene-fathers-nearly-200-children/
2•ashishgupta2209•1h ago•0 comments

Surgical Masks and Viral Transmission

https://rodgercuddington.substack.com/p/surgical-masks-and-viral-transmission
2•freespirt•1h ago•0 comments

Ask HN: Is there a local dev tool you wish existed because of a repeating issue?

1•johnbros•1h ago•0 comments

Revolutionary gene therapy brings hope of leukaemia cure [video]

https://www.youtube.com/watch?v=IuWFVWwesSE
1•mgh2•1h ago•0 comments

Flow depression treatment now FDA approved

https://www.flowneuroscience.com/fda-approved-lp-2/
1•antfarm•1h ago•0 comments

Oilwell is a wellness app to help you embrace climate chaos

https://oilwell.app/
2•doener•1h ago•0 comments

Show HN: This week we shipped 'Surfaces' on rynk.io

https://twitter.com/farsn_/status/1999764184729551073
1•thefarseen•1h ago•0 comments

Breaking Down Trump's 2025 National Security Strategy

https://www.brookings.edu/articles/breaking-down-trumps-2025-national-security-strategy/
1•thomassmith65•1h ago•0 comments