OpenBSD CVS

CVS log for src/usr.sbin/vmd/proc.c


[BACK] Up to [local] / src / usr.sbin / vmd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.25 / (download) - annotate - [select for diffs], Tue Apr 9 15:48:01 2024 UTC (7 weeks, 4 days ago) by tobhe
Branch: MAIN
CVS Tags: HEAD
Changes since 1.24: +4 -21 lines
Diff to previous 1.24 (colored)

Sync removal of setsid(), setpgid() and a few dup2() from relayd. They are
redundant since we call daemon() earlier.

ok bluhm@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Apr 8 12:48:26 2024 UTC (7 weeks, 5 days ago) by tobhe
Branch: MAIN
Changes since 1.23: +4 -1 lines
Diff to previous 1.23 (colored)

Call daemon() only in parent and before proc_exec() to avoid orphaning child
processes. Synced from relayd.

ok mlarkin@ dv@

Revision 1.23 / (download) - annotate - [select for diffs], Tue Feb 20 21:40:37 2024 UTC (3 months, 1 week ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.22: +18 -3 lines
Diff to previous 1.22 (colored)

Utilize separate threads for RX and TX in vmd(8)'s vionet.

This commit adds multithreading to allow both virtqueues to be
processed in parallel along with additional synchronization primitives
to protect device configuration state. Allowing RX and TX to operate
independently reduces overall network latency for guests and helps
alleviate the TX side dominating cpu time.

Tested with help from phessler@, kn@, and mlarkin@. ok mlarkin@.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jan 18 14:49:59 2024 UTC (4 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.21: +4 -3 lines
Diff to previous 1.21 (colored)

Use imsg_get_fd() in vmd.

vmd uses a lot of fd passing and does it sometimes via extra abstraction
so this just tries to convert the code without any optimisations.

ok dv@

Revision 1.21 / (download) - annotate - [select for diffs], Tue Sep 26 01:53:54 2023 UTC (8 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

vmd(8): disambiguate log messages per vm and device.

The logging output from vmd(8) often specifies the function performing
the logging, but leaves which vm or vm device to guesswork and
reading tea leaves.

Change the logging formatting to prefix with information about the
specific vm and potentially the device subprocess. Most of this
logging is behind the "verbose" mode, but for warnings this will
clarify which vm or device logged the warning.

The format of vm/<name>/<device><index> is chosen to be concise and
less ugly than other approaches. This adjusts the process naming
for devices to match, dropping the use of brackets.

In the process of this change, updating log settings dynamically
via vmctl(8) is fixed by properly broadcasting that information to
the device subprocesses. The "vmm" process also now updates its own
state properly, so settings survive vm reboots.

ok mlarkin@

Revision 1.20 / (download) - annotate - [select for diffs], Wed Feb 15 20:44:01 2023 UTC (15 months, 2 weeks ago) by tobhe
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.19: +1 -14 lines
Diff to previous 1.19 (colored)

proc_ispeer() is not used anywhere anymore so remove it everywhere.

ok florian@ bluhm@
ok for vmd mlarkin@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Apr 20 21:11:56 2021 UTC (3 years, 1 month ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (colored)

Move TAILQ initialization to files where they are used.

These priv-sep daemons all follow a similar design and use TAILQs
for tracking control process connections. In most cases, the TAILQs
are initialized separate from where they are used. Since the scope
of use is generally confined to a specific control process file,
this commit also removes any extern definitions and exposing the
TAILQ structures to other compilation units.

ok bluhm@, tb@

Revision 1.18 / (download) - annotate - [select for diffs], Mon Sep 10 10:36:01 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.17: +16 -5 lines
Diff to previous 1.17 (colored)

During the fork+exec implementation, daemon(3) was moved after
proc_init().  As a consequence vmd(8) child processes did not detach
from the terminal anymore.  Dup /dev/null to the stdio file descriptors
in the children.
OK mlarkin@ reyk@

Revision 1.17 / (download) - annotate - [select for diffs], Sun Aug 5 08:20:54 2018 UTC (5 years, 9 months ago) by mestre
Branch: MAIN
Changes since 1.16: +1 -4 lines
Diff to previous 1.16 (colored)

Remove cpath pledge(2) promise. We decided that not deleting the unix control
sockets cause no harm and this way we close another attack surface by not
allowing the daemon to create/delete any more files.

OK florian@

Revision 1.16 / (download) - annotate - [select for diffs], Sat Nov 4 07:40:31 2017 UTC (6 years, 6 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.15: +1 -3 lines
Diff to previous 1.15 (colored)

Remove a debug message that has outlived its usefulness.

From Carlos Cardenas, who discussed this with reyk@ also. Thanks!

Revision 1.15 / (download) - annotate - [select for diffs], Fri Sep 8 06:24:31 2017 UTC (6 years, 8 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.14: +3 -1 lines
Diff to previous 1.14 (colored)

vmd: add more explanatory log_debug messages

From Carlos Cardenas, many thanks!

Revision 1.14 / (download) - annotate - [select for diffs], Mon May 29 12:56:26 2017 UTC (7 years ago) by benno
Branch: MAIN
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

sync proc.c changes from relayd/httpd

Revision 1.13 / (download) - annotate - [select for diffs], Tue Jan 17 21:51:01 2017 UTC (7 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Nuke some whitespace that keeps poking me in the eye as I try to
steal code.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Jan 9 14:49:22 2017 UTC (7 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

Stop accessing verbose and debug variables from log.c directly.

This replaces log_verbose() and "extern int verbose" with the two functions
log_setverbose() and log_getverbose().

Pointed out by benno@
OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)

Revision 1.11 / (download) - annotate - [select for diffs], Wed Nov 16 15:32:42 2016 UTC (7 years, 6 months ago) by rzalamena
Branch: MAIN
Changes since 1.10: +25 -6 lines
Diff to previous 1.10 (colored)

Sync switchd(8) and vmd(8) with the latest proc.c changes. This sync
basically imports the imsg_flush() fix from reyk@ in httpd(8).

ok reyk@

Revision 1.10 / (download) - annotate - [select for diffs], Tue Oct 11 07:45:26 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.9: +91 -79 lines
Diff to previous 1.9 (colored)

Sync proc.c file vmd(8) and switchd(8).

New changes:
 * Fix msgbuf_write() usage idiom;
 * Add context (function name) that fatal()ed;
 * Use less fds on startup;

ok mlarkin@, reyk@

Revision 1.9 / (download) - annotate - [select for diffs], Wed Oct 5 17:31:28 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.8: +8 -2 lines
Diff to previous 1.8 (colored)

Sync with httpd(8) proc file. Check for dup2() usage to avoid oldd == newd
and remove the CLOEXEC with fcntl() if necessary.

ok reyk@

Revision 1.8 / (download) - annotate - [select for diffs], Wed Oct 5 17:10:00 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.7: +5 -1 lines
Diff to previous 1.7 (colored)

Call setsid() to create a new session for the executed processes.

From deraadt@
OK rzalamena@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Oct 4 17:17:30 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.6: +9 -3 lines
Diff to previous 1.6 (colored)

Add a new "priv" process that is responsible for ioctls and restricted
operations that aren't allowed under pledge.  This is a companion to
the "vmd" process that runs as root but with pledge.

With the "priv" process, each new tap(4) interface now gets a
description to indicate the vm, eg. "vm1-if0-myvm".  For network
configuration will be done by vmd/priv later.

OK mlarkin@

Revision 1.6 / (download) - annotate - [select for diffs], Thu Sep 29 22:42:04 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.5: +334 -187 lines
Diff to previous 1.5 (colored)

Implement fork+exec for vmd, using the same framework from httpd etc.

No objections from mlarkin@ sunil@

Revision 1.5 / (download) - annotate - [select for diffs], Mon Dec 7 16:05:56 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.4: +7 -5 lines
Diff to previous 1.4 (colored)

Add imsg "peerid" to debug messages (only within -DDEBUG).

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 5 17:30:34 2015 UTC (8 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

Another imsg_read user I did miss in my EAGAIN rampage.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Dec 2 13:43:36 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.2: +16 -2 lines
Diff to previous 1.2 (colored)

Sync with relayd, fix previous use of proc_compose*_imsg()

Revision 1.2 / (download) - annotate - [select for diffs], Wed Dec 2 09:39:41 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.1: +6 -6 lines
Diff to previous 1.1 (colored)

Add back the "peerid" to the proc_compose*() functions: in relayd, I
initially left it out because I didn't have a need for it.  But it is
actually quite useful to carry a reference to the imsg data context
across processes.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 2 09:14:25 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN

Start tweaking vmd's privsep and daemon model by splitting the main
process into multiple parts and adopting the "proc.c"-style from other
daemons.  This allows to further reduce the privileges, to give better
pledge(2), and to add some upcoming changes.

"please do" mlarkin@, deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.