public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: applied: [PATCH proxmox] shared-memory: flush contents of newly created mmap file
Date: Fri, 24 Apr 2026 11:36:00 +0200	[thread overview]
Message-ID: <1777023327.kj44okrld4.astroid@yuna.none> (raw)
In-Reply-To: <20260422073351.181581-1-c.ebner@proxmox.com>

just FTR, this one got applied already in
acd33a15c29cfe617ce5ecc69c78f692b2f20a8b

On April 22, 2026 9:33 am, Christian Ebner wrote:
> The man page for mmap [0] states, that mappings create with
> `MAP_SHARED` are not carried to the underlying file directly.
> 
> To avoid possible races between creating and initializing a new
> mmapped file and opening while checking the header of this file,
> msync the contents after init but before persisting the shared
> memory backed file.
> 
> [0] https://man7.org/linux/man-pages/man2/mmap.2.html
> 
> Fixes: https://forum.proxmox.com/threads/182948/
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>  proxmox-shared-memory/src/lib.rs | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/proxmox-shared-memory/src/lib.rs b/proxmox-shared-memory/src/lib.rs
> index 495812ef..4838ab42 100644
> --- a/proxmox-shared-memory/src/lib.rs
> +++ b/proxmox-shared-memory/src/lib.rs
> @@ -190,6 +190,10 @@ impl<T: Sized + Init> SharedMemory<T> {
>  
>          let mmap = mmap_file(&mut file, true)?;
>  
> +        if skip_tmpfs_check {
> +            mmap.msync(MsFlags::MS_SYNC)?;
> +        }
> +
>          let res = {
>              let path = CString::new(path.as_os_str().as_bytes())?;
>              Errno::result(unsafe {
> -- 
> 2.47.3
> 
> 
> 
> 
> 
> 




  reply	other threads:[~2026-04-24  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  7:33 Christian Ebner
2026-04-24  9:36 ` Fabian Grünbichler [this message]
2026-04-24  9:50 ` applied: " Thomas Lamprecht

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=1777023327.kj44okrld4.astroid@yuna.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal