From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id ED3C31FF13B for ; Wed, 11 Feb 2026 13:54:40 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D63FF1C099; Wed, 11 Feb 2026 13:55:22 +0100 (CET) Message-ID: <59677b3a-7a2d-4e95-ab7f-2b5eceeb594c@proxmox.com> Date: Wed, 11 Feb 2026 13:55:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [pve-devel] [PATCH pve-cluster 11/15] pmxcfs-rs: vendor patched rust-corosync for CPG compatibility To: Proxmox VE development discussion , Kefu Chai References: <20260106142440.2368585-1-k.chai@proxmox.com> <20260106142440.2368585-12-k.chai@proxmox.com> Content-Language: en-US From: Samuel Rufinatscha In-Reply-To: <20260106142440.2368585-12-k.chai@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.209 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: UIW7HNXMWFEK2S2TYM42GRK2CAOVTJJZ X-Message-ID-Hash: UIW7HNXMWFEK2S2TYM42GRK2CAOVTJJZ X-MailFrom: s.rufinatscha@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: comments inline On 1/7/26 10:16 AM, Kefu Chai wrote: > Add vendored rust-corosync library with CPG group name fix to support > optional trailing nuls in group names, ensuring compatibility between > Rust and C pmxcfs implementations. > > The patch addresses a limitation in CString::new() which doesn't allow > trailing \0 in its input, while C code uses strlen(name) + 1 for CPG > group names (including the trailing nul). > > This vendored version will be replaced once the fix is upstreamed and > a new rust-corosync crate version is published. > > See: vendor/rust-corosync/README.PATCH.md for details Could you please link the relevant GH issue / PR for more context? Also please mention it in the README.PATCH.md. > --- > src/pmxcfs-rs/Cargo.toml | 6 + > src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml | 33 + > .../vendor/rust-corosync/Cargo.toml.orig | 19 + > src/pmxcfs-rs/vendor/rust-corosync/LICENSE | 21 + > .../vendor/rust-corosync/README.PATCH.md | 36 + > src/pmxcfs-rs/vendor/rust-corosync/README.md | 13 + > src/pmxcfs-rs/vendor/rust-corosync/build.rs | 64 + > .../vendor/rust-corosync/regenerate-sys.sh | 15 + > src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs | 392 ++ > .../vendor/rust-corosync/src/cmap.rs | 812 ++++ > src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs | 657 ++++ > src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs | 297 ++ > .../vendor/rust-corosync/src/quorum.rs | 337 ++ > .../vendor/rust-corosync/src/sys/cfg.rs | 1239 ++++++ > .../vendor/rust-corosync/src/sys/cmap.rs | 3323 +++++++++++++++++ > .../vendor/rust-corosync/src/sys/cpg.rs | 1310 +++++++ > .../vendor/rust-corosync/src/sys/mod.rs | 8 + > .../vendor/rust-corosync/src/sys/quorum.rs | 537 +++ > .../rust-corosync/src/sys/votequorum.rs | 574 +++ > .../vendor/rust-corosync/src/votequorum.rs | 556 +++ > 20 files changed, 10249 insertions(+) > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/LICENSE > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/README.md > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/build.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/regenerate-sys.sh > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cfg.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cmap.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/cpg.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/lib.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/quorum.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cfg.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cmap.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/cpg.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/mod.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/quorum.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/sys/votequorum.rs > create mode 100644 src/pmxcfs-rs/vendor/rust-corosync/src/votequorum.rs > > diff --git a/src/pmxcfs-rs/Cargo.toml b/src/pmxcfs-rs/Cargo.toml > index 4d18aa93..a178bc27 100644 > --- a/src/pmxcfs-rs/Cargo.toml > +++ b/src/pmxcfs-rs/Cargo.toml > @@ -91,3 +91,9 @@ strip = true > [profile.dev] > opt-level = 1 > debug = true > + > +[patch.crates-io] > +# Temporary patch for CPG group name length bug > +# Fixed in corosync upstream (commit 71d6d93c) but not yet released > +# Remove this patch when rust-corosync > 0.1.0 is published > +rust-corosync = { path = "vendor/rust-corosync" } > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml > new file mode 100644 > index 00000000..f299ca76 > --- /dev/null > +++ b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml > @@ -0,0 +1,33 @@ > +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO > +# > +# When uploading crates to the registry Cargo will automatically > +# "normalize" Cargo.toml files for maximal compatibility > +# with all versions of Cargo and also rewrite `path` dependencies > +# to registry (e.g., crates.io) dependencies > +# > +# If you believe there's an error in this file please file an > +# issue against the rust-lang/cargo repository. If you're > +# editing this file be aware that the upstream Cargo.toml > +# will likely look very different (and much more reasonable) > + > +[package] > +edition = "2018" > +name = "rust-corosync" > +version = "0.1.0" Not fully sure I understand: why are we using 0.1.0? Crates.io lists newer versions: https://crates.io/crates/rust-corosync/versions > +authors = ["Christine Caulfield "] > +description = "Rust bindings for corosync libraries" > +readme = "README.md" > +keywords = ["cluster", "high-availability"] > +categories = ["api-bindings"] > +license = "MIT OR Apache-2.0" > +repository = "https://github.com/chrissie-c/rust-corosync" > +[dependencies.bitflags] > +version = "1.2.1" > + > +[dependencies.lazy_static] > +version = "1.4.0" > + > +[dependencies.num_enum] > +version = "0.5.1" > +[build-dependencies.pkg-config] > +version = "0.3" > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig > new file mode 100644 > index 00000000..2165c8e9 > --- /dev/null > +++ b/src/pmxcfs-rs/vendor/rust-corosync/Cargo.toml.orig > @@ -0,0 +1,19 @@ > +[package] > +name = "rust-corosync" > +version = "0.1.0" > +authors = ["Christine Caulfield "] > +edition = "2018" > +readme = "README.md" > +license = "MIT OR Apache-2.0" > +repository = "https://github.com/chrissie-c/rust-corosync" > +description = "Rust bindings for corosync libraries" > +categories = ["api-bindings"] > +keywords = ["cluster", "high-availability"] > + > +[dependencies] > +lazy_static = "1.4.0" > +num_enum = "0.5.1" > +bitflags = "1.2.1" > + > +[build-dependencies] > +pkg-config = "0.3" > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/LICENSE b/src/pmxcfs-rs/vendor/rust-corosync/LICENSE > new file mode 100644 > index 00000000..43da7b99 > --- /dev/null > +++ b/src/pmxcfs-rs/vendor/rust-corosync/LICENSE > @@ -0,0 +1,21 @@ > +MIT License > + > +Copyright (c) 2021 Chrissie Caulfield > + > +Permission is hereby granted, free of charge, to any person obtaining a copy > +of this software and associated documentation files (the "Software"), to deal > +in the Software without restriction, including without limitation the rights > +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > +copies of the Software, and to permit persons to whom the Software is > +furnished to do so, subject to the following conditions: > + > +The above copyright notice and this permission notice shall be included in all > +copies or substantial portions of the Software. > + > +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > +SOFTWARE. > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md b/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md > new file mode 100644 > index 00000000..c8ba2d6f > --- /dev/null > +++ b/src/pmxcfs-rs/vendor/rust-corosync/README.PATCH.md > @@ -0,0 +1,36 @@ > +# Temporary Vendored rust-corosync v0.1.0 > + > +This is a temporary vendored copy of `rust-corosync` v0.1.0 with a critical bug fix. > + > +## Why Vendored? > + > +The published `rust-corosync` v0.1.0 on crates.io has a bug that prevents Rust and C applications from joining the same CPG groups. This bug has been fixed in corosync upstream but not yet released. Can you please link the commit? > + > +## Upstream Fix > + > +The fix has been committed to the corosync repository: > +- Repository: https://github.com/corosync/corosync > +- Local commit: `~/dev/corosync` commit 71d6d93c So this is the local commit after applying the fix diff, right? > +- File: `bindings/rust/src/cpg.rs` > +- Lines changed: 209-220 Since the fix is quite small, can we please add the diff here? > + > +## The Bug > + > +CPG group name length calculation was excluding the null terminator: > +- C code: `length = strlen(name) + 1` (includes \0) > +- Rust (before): `length = name.len()` (excludes \0) > +- Rust (after): `length = name.len() + 1` (includes \0) > + > +This caused Rust and C nodes to be isolated in separate CPG groups even when using identical group names. > + > +## Removal Plan > + > +Once `rust-corosync` v0.1.1+ is published with this fix: > + > +1. Remove this `vendor/rust-corosync` directory > +2. Remove the `[patch.crates-io]` section from `../Cargo.toml` > +3. Update workspace dependency to `rust-corosync = "0.1.1"` > + > +## Testing > + > +The fix has been tested with mixed C/Rust pmxcfs clusters and verified that all nodes successfully join the same CPG group and communicate properly. > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/README.md b/src/pmxcfs-rs/vendor/rust-corosync/README.md > new file mode 100644 > index 00000000..9c376b8a > --- /dev/null > +++ b/src/pmxcfs-rs/vendor/rust-corosync/README.md > @@ -0,0 +1,13 @@ > +# rust-corosync > +Rust bindings for corosync > + > +This crate covers Rust bindings for the > +cfg, cmap, cpg, quorum, votequorum > +libraries in corosync. > + > +It is very much in an alpha state at the moment and APIs > +may well change as and when people start to use them. > + > +Please report bugs and offer any suggestions to ccaulfie@redhat.com > + > +https://corosync.github.io/corosync/ > diff --git a/src/pmxcfs-rs/vendor/rust-corosync/build.rs b/src/pmxcfs-rs/vendor/rust-corosync/build.rs > new file mode 100644 > index 00000000..8635b5e4 > --- /dev/null [..]