Out-of-process WSL plugin runtime

Aperta
#41,967 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start by reading the WSL plugin loading and runtime entry points; the issue does not name specific files or tests. The proposal requires designing process isolation, lifecycle control, restart behavior, and plugin initialization events. Done would mean agreeing on an architecture that supports those capabilities without restarting the WSL service.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature

Problem

Currently, a WSL plugin is a DLL directly loaded into the wslservice.exe process when it starts. There is no way to manage the lifecycle of that library other than that, which is quite inconvenient.

Indeed, when installing the file at a certain path and then registering it in the right Registry key, then it is not possible to instruct the WSL runtime to load it immediately. Similarly, when updating it, there is no way to instruct the runtime to unload it and load the new one. This makes it hard to handle the basics of software integration.

Also, having the library directly loaded into a central process poses a few risks that cannot be managed externally:

  • if some of its code crashes, then the WSL service crashes as well;
  • if it gets stuck, then it is not possible to "unstick" it by for example killing it without actually killing the WSL service process;
  • potentially-vulnerable code gets brought into the WSL service process, thus enabling some attack surface;
  • ...

Solution

The ideal would be to move plugins into processes, one per plugin, dedicated to handling their execution with respect to the global runtime that would communicate with them. This would be effectively similar to COM servers in spirit. Some control over these service-like processes would be nice too.

This way, if a crash occurs in a plugin, then only its dedicated runtime process would crash, thus improving safety. Then, upon such an event, the global WSL runtime could detect that this process died and automatically restart it. Also, it would enable managing plugins externally: it would become possible to just stop a plugin process, update its library and instruct the runtime to load it again without restarting the entire WSL service.

Upon a load, it would be nice to also add some kind of event the plugin could react to in order to be able to call the API and perform any initialization/update of what it performs in the Linux space. Alternatively, an already-existing event or series of events recorded until load time could be fired at the newly-loaded plugin to achieve the same end result.

Alternatives

  • Just some control over the load and unload of the plugins, but I'm not sure if that's really possible with loader APIs.
  • Just restarting the WSL service upon installing or updating a plugin, but that is extremely aggressive and may very well result in data loss, especially considering how WSL2 and WSLG are used mostly interactively by end users.
Lingua principale
C++
Stelle
34.4k
Fork
1.9k
Merge medio
1g 23h
PR unite (30g)
166

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/WSL

Tutte le issue di microsoft/WSL

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.