public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Sergey Bugaev <bugaevc@gmail.com>
Cc: bug-hurd@gnu.org, libc-alpha@sourceware.org
Subject: Re: [RFC PATCH 0/3] O_TMPFILE and SHM_ANON for the Hurd
Date: Mon, 30 Jan 2023 00:31:40 +0100	[thread overview]
Message-ID: <20230129233140.tkgoqp45u7lrl65u@begin> (raw)
In-Reply-To: <20221212114636.74222-1-bugaevc@gmail.com>

Hello,

Sergey Bugaev, le lun. 12 déc. 2022 14:46:33 +0300, a ecrit:
> Then, Linux also has memfd_create (), which makes a temp file without touching
> any fs at all. This API is widely used in the Wayland ecosystem as the
> recommended way to create shared memory.  But such an approach would not work
> as-is on the Hurd: in order for there to be an fd, there has to be a server
> somewhere, servicing that fd.

Can't glibc itself serve it?

The drawback is that it'd only keep working while the creator is
running.

> We can't just make an fd out of "pure memory" -- it may be an fd to
> /hurd/tmpfs, but that /hurd/tmpfs needs to exist and be accessible. So
> being usable in an empty chroot is not going to happen anyway, unless
> we start spawning our own instances of /hurd/tmpfs for each memfd,
> which sounds like a terrible idea.

For a really-working memfd, it'd have to be so anyway.

> And so in that light, the FreeBSD alternative to memfd_create () -- namely
> SHM_ANON -- sounds much more approachable to me, while being, well, a bit less
> widely supported in the Wayland ecosystem than memfd, but still quite popular.
> We already implement shm by creating files under /dev/shm/

That has the benefit of factorizing the server part, indeed.

> As for the implementation: basically all of the SHM_ANON implementation, except
> the very definition, ended up in the generic / POSIX version of shm_open () and
> __shm_get_name (), predicated on defined (SHM_ANON) && defined (O_TMPFILE).
> This sounds problematic: while there is indeed nothing Hurd-specific about the
> implementation, and any port that supports O_TMPFILE and wants to support
> SHM_ANON could use these code paths, what if another port wants to implement
> SHM_ANON differently? Should I make a separate copy of shm_open.c in
> sysdeps/mach/hurd instead of modifying the generic version?

I would say that we can afford not foreseeing this, and wait for the
case to happen to see how to refactor things?

Thanks for this! We'll be able to commit things after the 2.37 release.
Samuel

      parent reply	other threads:[~2023-01-29 23:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 11:46 Sergey Bugaev
2022-12-12 11:46 ` [RFC PATCH 1/3] hurd: Consolidate file_name_lookup implementation Sergey Bugaev
2022-12-12 11:46 ` [RFC PATCH 2/3] hurd: Implement O_TMPFILE Sergey Bugaev
2023-01-29 23:25   ` Samuel Thibault
2023-01-30  9:53     ` Sergey Bugaev
2023-01-30  9:59       ` Samuel Thibault
2023-01-30 12:52         ` [PATCH v2 0/3] O_TMPFILE and SHM_ANON for the Hurd Sergey Bugaev
2023-01-30 12:52         ` [PATCH v2 1/3] hurd: Consolidate file_name_lookup implementation Sergey Bugaev
2023-02-01 19:06           ` Samuel Thibault
2023-01-30 12:52         ` [PATCH v2 2/3] hurd: Implement O_TMPFILE Sergey Bugaev
2023-02-01 22:34           ` Samuel Thibault
2023-01-30 12:52         ` [PATCH v2 3/3] hurd: Implement SHM_ANON Sergey Bugaev
2023-02-01 22:36           ` Samuel Thibault
2022-12-12 11:46 ` [RFC PATCH " Sergey Bugaev
2023-01-29 23:31 ` Samuel Thibault [this message]

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 \
    --in-reply-to=20230129233140.tkgoqp45u7lrl65u@begin \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=bugaevc@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).