mystikos icon indicating copy to clipboard operation
mystikos copied to clipboard

/tmp/myst* files are not cleaned up in case a program fails

Open vtikoo opened this issue 4 years ago • 4 comments

If a program aborts or segfaults when run with mystikos, we don't get a chance to clean /tmp files.

vtikoo avatar Feb 01 '21 17:02 vtikoo

@vtikoo , please add more information about the issue

bodzhang avatar Feb 08 '21 21:02 bodzhang

Discussed some concerns and possible approaches with @paulcallen and @mikbras. Potential solutions include:

  • use a ramfs for the temp dir, or
  • use a stream object for signing or file mutations, or
  • declare signal traps to clean up the directory, and/or
  • always use a per-process unique temp dir (e.g., /tmp/mysql-abc123/*), and never place files directly in /tmp/

AevaOnline avatar Feb 08 '21 22:02 AevaOnline

looks like rootfs and elf image files. There is also empty directories that are owned by root

paulcallen avatar Feb 08 '21 22:02 paulcallen

Here is a solution but will require some rework.

    int fd = mkstemp(template);
    unlink(template);
    // use fd to access file; file blocks are reclaimed on close or when process dies.

mikbras avatar Jul 08 '21 17:07 mikbras