Repository navigation
Commit d5a3208
A started program receives the three streams and its grants, and nothing else
Builds on the previous commit, which left a started program a descriptor for
its own file instead of one for its base directory. Three further departures
from clause 7.13 of the specification are removed.
The descriptor for the program is opened close-on-exec, and only a program that
needs an interpreter keeps it: the kernel refuses such a program with ENOENT
before the point of no return, and the start is repeated with the flag cleared.
An ordinary executable now starts with nothing above the three streams. The
descriptor is moved above the placed positions, so that a caller without a
standard input does not hand a script its own descriptor as one.
What the caller itself inherited without the close-on-exec flag is no longer
passed on. Everything above the grants is marked in the started image with
close_range, or from /proc/self/fd or up to the descriptor limit on a kernel
older than 5.11.
Grants arrive. Every source is moved above the positions being filled before
any is placed, so one placement no longer overwrites another grant, a stream,
or the base the program's name is resolved under; a grant already at its own
position no longer keeps the flag that closed it. The names travel in
KAL_PREOPENS=<pid>{;<fd>,<len>,<name>}, bound to the started process by its
pid in the way systemd's LISTEN_FDS is, and kal_fs_preopen in the started
program enumerates exactly the grants, in order and by name. A count of zero
leaves none; not asking leaves the working directory and / as before.
tests/conformance_spawn.cpp observes each of these from the started program.
Against 0.15.0 seven of its observations fail.
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>1 parent 5104f8d commit d5a3208
4 files changed
Lines changed: 534 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
23 | 85 | | |
24 | | - | |
| 86 | + | |
| 87 | + | |
25 | 88 | | |
26 | 89 | | |
27 | 90 | | |
| 91 | + | |
| 92 | + | |
28 | 93 | | |
29 | 94 | | |
30 | 95 | | |
| |||
45 | 110 | | |
46 | 111 | | |
47 | 112 | | |
48 | | - | |
| 113 | + | |
49 | 114 | | |
50 | 115 | | |
51 | 116 | | |
| |||
0 commit comments