public inbox for [email protected]
 help / color / mirror / Atom feed
From: Askar Safin <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected],
	[email protected]
Subject: Re: [PATCH RFC 0/9] Launching processes with io_uring
Date: Sun, 19 Jan 2025 01:33:09 +0300	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Pavel Begunkov:
> At this point it raises a question why it even needs io_uring
> infra? I don't think it's really helping you. E.g. why not do it
> as a list of operation in a custom format instead of links? That
> can be run by a single io_uring request or can even be a normal
> syscall.

> Makes me wonder about a different ways of handling. E.g. why should
> it be run in the created task context (apart from final exec)? Can
> requests be run as normal by the original task, each will take the
> half created and not yet launched task as a parameter (in some form),
> modify it, and the final exec would launch it?

I totally agree. I think API should look like this:

===
// This may be PID fd or something completely different
int fd = create_task ();

task_manipulate (fd, OP_CHDIR, "/");
task_manipulate (fd, OP_CLOSE, 0);
task_manipulate (fd, OP_OPEN, "/dev/null", O_RDONLY, 0666);

task_execve (fd, "/bin/true", argv, envp);
===

We will have ability to do proper error handling.

Paper "A fork() in the road" says the same thing.
( https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.pdf ).

From that paper:

> While a spawnlike API is preferred for most instances of starting a new
> program, for full generality it requires a flag, parameter, or
> helper function controlling every possible aspect of process
> state. It is infeasible for a single OS API to give complete
> control over the initial state of a new process. In Unix today,
> the only fallback for advanced use-cases remains code executed
> after fork, but clean-slate designs [e.g., 40, 43] have
> demonstrated an alternative model where system calls that
> modify per-process state are not constrained to merely the
> current process, but rather can manipulate any process to
> which the caller has access. This yields the flexibility and
> orthogonality of the fork/exec model, without most of its
> drawbacks: a new process starts as an empty address space,
> and an advanced user may manipulate it in a piecemeal fashion,
> populating its address-space and kernel context prior to
> execution, without needing to clone the parent nor run code
> in the context of the child. ExOS [43] implemented fork in
> user-mode atop such a primitive. Retrofitting cross-process
> APIs into Unix seems at first glance challenging, but may
> also be productive for future research

So, yes, such APIs already exist in research operating systems.

Moreover, as well as I understand, Windows NT native API also
creates processes the same way.

Askar Safin

  parent reply	other threads:[~2025-01-18 22:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 23:43 [PATCH RFC 0/9] Launching processes with io_uring Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 1/9] io_uring: Drop __io_req_find_next_prep Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 2/9] io_uring: Expose failed request helper in internal header Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 3/9] kernel/fork: Don't inherit PF_USER_WORKER from parent Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 4/9] fs/exec: Expose do_execveat symbol Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 5/9] kernel/fork: Add helper to fork from io_uring Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 6/9] io_uring: Let commands run with current credentials Gabriel Krisman Bertazi
2024-12-11 14:48   ` Pavel Begunkov
2024-12-09 23:43 ` [PATCH RFC 7/9] io_uring: Introduce IORING_OP_CLONE Gabriel Krisman Bertazi
2024-12-11 13:37   ` Pavel Begunkov
2024-12-11 17:26     ` Josh Triplett
2024-12-17 11:03       ` Pavel Begunkov
2024-12-17 19:14         ` Josh Triplett
2024-12-09 23:43 ` [PATCH RFC 8/9] io_uring: Let ->issue know if it was called from spawn thread Gabriel Krisman Bertazi
2024-12-09 23:43 ` [PATCH RFC 9/9] io_uring: Introduce IORING_OP_EXEC command Gabriel Krisman Bertazi
2024-12-10 21:01   ` Josh Triplett
2024-12-10 21:10 ` [PATCH RFC 0/9] Launching processes with io_uring Josh Triplett
2024-12-11 14:02 ` Pavel Begunkov
2024-12-11 17:34   ` Josh Triplett
2024-12-13 20:13   ` Gabriel Krisman Bertazi
2024-12-17 16:10     ` Pavel Begunkov
2024-12-30 23:38       ` Gabriel Krisman Bertazi
2024-12-31 14:35         ` Pavel Begunkov
2025-01-18 22:33   ` Askar Safin [this message]
2025-01-19  3:04     ` Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox