Skip to main content

Module host_timed_producers

Module host_timed_producers 

Source
Expand description

Signal producers whose signal Linux sends at a moment host timing decides, which an in-guest run refuses (A5 step 3c slice 0b; design sections 16.30, D25, D28 and D28a of https://github.com/rrnewton/hermit/issues/4485).

While the in-guest runtime runs its own code, ordinary signals are blocked, and Linux keeps a blocked signal pending even when the guest ignores it, so a signal the kernel sends at a host-timed moment could become pending whatever the guest’s action and mask. So on the in-guest backends’ default route (Config::in_guest_refuses_host_timed_producers) Detcore refuses the one operation that completes such a producer, and Hermit refuses a launch whose guest would inherit one already complete.

A descriptor’s SIGIO and SIGURG producers (Linux v6.12):

  • SIGIO reaches a descriptor’s owner only through the descriptor’s fasync list (kill_fasync_rcu, fs/fcntl.c:1116-1142, sends it with send_sigio), which setting O_ASYNC populates: F_SETFL calls the file’s ->fasync when O_ASYNC changes (setfl, fs/fcntl.c:76-82), and so does FIOASYNC (ioctl_fioasync, fs/ioctl.c:365-385). open(O_ASYNC) keeps the flag but never calls ->fasync (do_dentry_open, fs/open.c:974), and a later F_SETFL that leaves the flag set calls nothing either. A descriptor whose status flags show O_ASYNC is treated as armed here anyway, which can only refuse more.
  • A socket’s owner gets SIGURG for out-of-band data without O_ASYNC (sk_send_sigurg, net/core/sock.c:3503-3508, calls send_sigurg, fs/fcntl.c:941-978, which reads only the owner).
  • F_SETLEASE with a read or write lease, and F_NOTIFY with a nonzero mask, make the caller the owner themselves (lease_setup, fs/locks.c:563-577; fcntl_dirnotify, fs/notify/dnotify/dnotify.c:372) and are refused outright.

An owner is named by F_SETOWN (f_setown, fs/fcntl.c:154-189), F_SETOWN_EX (f_setown_ex, fs/fcntl.c:217-259), and on a socket FIOSETOWN and SIOCSPGRP (sock_ioctl, net/socket.c:1284-1289); an owner of 0 (a pid of 0 for F_SETOWN_EX) removes it.

Structs§

OwnerLookup
The owner an owner-setting call names, as the kernel looks it up: who, a pid number, and whether it names a process group (group): a negative F_SETOWN, FIOSETOWN or SIOCSPGRP owner, or F_OWNER_PGRP.
ProducerState
What a descriptor already arms toward a host-timed signal producer.

Enums§

ProducerArming
An operation on a descriptor that can complete a host-timed signal producer (D28). call names the call and command, as the WARN does.

Constants§

F_GETOWN_EX
fcntl’s command that reads a descriptor’s owner and its type (Linux’s include/uapi/asm-generic/fcntl.h; the pinned libc lacks it).
F_OWNER_PGRP
See F_OWNER_TID.
F_OWNER_PID
See F_OWNER_TID.
F_OWNER_TID
F_SETOWN_EX’s owner types (Linux’s include/uapi/asm-generic/fcntl.h; the pinned libc lacks them).

Functions§

defer_run_end_log
Keeps log to run once at the end of this process’s run (emit_run_end_log): after the scheduler shuts down on the ordinary path, and just before any of the scheduler’s stopping refusals exits the process, so the line is logged on every exit path, at the same point of each path in every run. A later call replaces an earlier one.
emit_run_end_log
Runs the line defer_run_end_log kept, if any, once.
host_descriptor_state
The state of descriptor fd of the calling process, read from the host, with whether it holds a lease (F_GETLEASE): what Hermit checks before an in-guest launch in each descriptor the guest would inherit (D25). An O_PATH descriptor arms nothing (check_fcntl_cmd refuses every arming command on one), so it reads as arming nothing. A directory notification cannot be read back (there is no F_GETNOTIFY, and fdinfo does not show dnotify), so it is not reported.
names_an_owner
Whether F_GETOWN_EX’s answer, owner type kind and pid pid, names an owner the guest could receive a signal from.