Martins3 / loongson-dune

:zap: Process virtualization based on KVM. More useable, stable and practical than Stanford Dune.
20 stars 3 forks source link

ltp: we can support exec like syscall #27

Closed Martins3 closed 3 years ago

Martins3 commented 3 years ago

Although dune can't make the program which is a parameter of syscall exec run in a virtualization environment, making the program run correctly without too many limitations is always better.

Martins3 commented 3 years ago
Martins3 commented 3 years ago

One way to do that is to always open files using the flag O_CLOEXEC, which ensures that this file descriptor is automatically closed when exec...() is ever called. [^1]

  1. https://stackoverflow.com/questions/56650579/why-should-i-close-all-file-descriptors-after-calling-fork-and-prior-to-callin
Martins3 commented 3 years ago
Martins3 commented 3 years ago

All the memory freed, that's what we expected.

Martins3 commented 3 years ago

https://stackoverflow.com/questions/6125068/what-does-the-fd-cloexec-fcntl-flag-do

Martins3 commented 3 years ago

MIPS doesn't use it.

Martins3 commented 3 years ago

These function called by KVM module, they should be carefully called properly.

Martins3 commented 3 years ago

It works.