google / gvisor

Application Kernel for Containers
https://gvisor.dev
Apache License 2.0
15.82k stars 1.3k forks source link

Complete the pidfd API #5839

Open milantracy opened 3 years ago

milantracy commented 3 years ago

Description

Implement pidfd API for gVisor.

See https://lwn.net/Articles/794707/ for details

Is this feature related to a specific bug?

N/A

Do you have a specific solution in mind?

milantracy commented 11 months ago

some use cases are listed at https://github.com/oven-sh/bun/issues/5803#issuecomment-1742964299

I will start work on it

EtiennePerot commented 11 months ago

This API has lots of surface area with various associated system calls. It would be good to enumerate them and to sort them by whether or not bun uses them.

Might also be good to add a tests for the bun runtime, similar to our node runtime tests.

milantracy commented 11 months ago

Syscalls that are expected to be done are listed in the order of priorities:

EtiennePerot commented 11 months ago

It seems hard to believe that pidfd_open is the only one bun expects. Why use pidfd_open at all if the program is not going to use the functionality that pidfd offers?

ayushr2 commented 11 months ago

You can poll(2) on FD returned by pidfd_open() to get a notification when the process represented by that pidfd exits. So maybe that's how bun uses it?

milantracy commented 11 months ago

is the only one bun expects. Why use pidfd_open at all if the program is not going to use the functionality that pidfd offers?

I didn't read into very details of their code base, as they said google-auth-library is the one who introduces the issue, the program crashed when it sees the pidfd_open. I will add pidfd_open to see if there is anything I shall follow with.

You can poll(2) on FD returned by pidfd_open() to get a notification when the process represented by that pidfd exits. So maybe that's how bun uses it?

from https://github.com/oven-sh/bun/pull/6724 , they are working around the issue in a very similar way