mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Move VDSOParamPage out of Timekeeper.
We want to decouple the netstack from the kernel. This coupling is causing bugs in restore because netstack needs to be created before the Kernel is restored. So right now, netstack ends up using a "temporary" Kernel which is later destroyed in the restore sequence, but netstack keeps referencing it. Before this change, netstack was being initialized with a `kernel.TimeKeeper`. This `Timekeeper` was being initialized with `VDSOParamPage`, which references the MemoryFile of the kernel. So as a result, on restore the netstack ends up referencing the destroyed kernel's MemoryFile. So instead move out VDSOParamPage from TimeKeeper altogether. The callers of `TimeKeeper.SetClocks()` and `TimeKeeper.ResumeUpdates()` pass VDSOParamPage from the correct kernel being used currently. PiperOrigin-RevId: 647168588
This commit is contained in:
@@ -83,8 +83,9 @@ func Boot() (*kernel.Kernel, error) {
|
||||
}
|
||||
|
||||
// Create timekeeper.
|
||||
tk := kernel.NewTimekeeper(k.MemoryFile(), vdso.ParamPage.FileRange())
|
||||
tk.SetClocks(time.NewCalibratedClocks())
|
||||
tk := kernel.NewTimekeeper()
|
||||
params := kernel.NewVDSOParamPage(k.MemoryFile(), vdso.ParamPage.FileRange())
|
||||
tk.SetClocks(time.NewCalibratedClocks(), params)
|
||||
|
||||
creds := auth.NewRootCredentials(auth.NewRootUserNamespace())
|
||||
|
||||
@@ -96,6 +97,7 @@ func Boot() (*kernel.Kernel, error) {
|
||||
Timekeeper: tk,
|
||||
RootUserNamespace: creds.UserNamespace,
|
||||
Vdso: vdso,
|
||||
VdsoParams: params,
|
||||
RootUTSNamespace: kernel.NewUTSNamespace("hostname", "domain", creds.UserNamespace),
|
||||
RootIPCNamespace: kernel.NewIPCNamespace(creds.UserNamespace),
|
||||
PIDNamespace: kernel.NewRootPIDNamespace(creds.UserNamespace),
|
||||
|
||||
Reference in New Issue
Block a user