Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

[LibOS] FS-specific checkpoint callback must not leak checkpoint data #744

Open
@dimakuv

Description

PR #596 fixes the bug of the FS-specific checkpoint callback being called only the first time a process forks (so, when a process forks a second child, the second child may get a stale checkpoint / not perform checkpoint-specific code). The fix is to unconditionally call the FS-specific checkpoint callback.

Currently, it doesn't represent a problem. The only FS which has a checkpoint callback is Chroot, and it does a simple assignment of an already existing checkpoint stored somewhere in Chroot-specific memory:

static int chroot_checkpoint (void ** checkpoint, void * mount_data) {
    ...
    *checkpoint = mount_data;
     ...
}

However, there can be a memory leak if the checkpoint callback allocates data, e.g.:

my_fs_checkpoint(void ** checkpoint, void * mount_data) {  *checkpoint = malloc(1024) }

We can either mandate that checkpoint callbacks must never allocate memory or introduce a generic mechanism to clean the previous checkpoint during BEGIN_CP_FUNC(mount).

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions