From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0C67E1FF17A for ; Tue, 9 Dec 2025 07:39:40 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1DC471C886; Tue, 9 Dec 2025 07:40:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764938899; x=1765543699; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KT7qBJwXi2M6fLlVsHEUTVhnVvxJeH/TbizJZAM8sps=; b=I81e7rdNMxDcCPolw9rAXt84G59TpUgPNSFbqbHmst2/pye0c63f0Vc0vprS1sbCuB BaLlEtkiv8pVM/HTwW7QMLMFqlx6vA6csPkjyPe3et0EJWU7zx5SZOLXX9Zb9gilwLvX eHvoQuOuPZ7a9tL27NqnXfjttT2tvJKlrGFEV4aq4MYH1etZXatP3cnuLnrbb5CEHaNd uc1jYqGAScCYmSmNOdaSnSCqq/Gm+XHnp3jy6AGqAOn7d1OSLf7nF/YjscMOwob7ASFR ++TaSVAE83ckVSQrjC5tV4gjLl4POREDJ9b/acyiw02Kpn7Z06S1MJNlYGH+wVLE9laO +y/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764938899; x=1765543699; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KT7qBJwXi2M6fLlVsHEUTVhnVvxJeH/TbizJZAM8sps=; b=bh9c4uq4CevPJHBM+iW6ae3ieYDxIMvGHG8z7OatWAzZBRaQWWHXFShiN2RK1Au7NM U3J7C16wyEFTtx/JkTLsOrb7RGQDgLBnOvyoVBFPN9drTEAQgB6EQ1gEV75GydMvIzPm 9bm8LAuwtCmGYZCZB7QmzFx8MNe5M29dOFZs4p4v0/rxjZtZQhmzuDviQC8YmKwO7a2F gzna3JeFfHFhDkBbmJKIh2Jz412H90ntfMYzftwFsp/3UYRea1kbu02q5/rt4ocmp8gy JoLfZBVMvDH5sZ8AHyDkXKvnYLQnv2Hid/qYiMYc8EHhdEX5Blv5176PdFR7BXve8FCC r86g== X-Gm-Message-State: AOJu0YwuhJnUXJO8Q6mBPhlWkd/FOOLGSkvF9GtAW6YXS4NaHhjQT5dK 6F1YdD6s4SDGVG4qqBtyQByAutSFyB1AL7XurUCtU8lm5b8Sc9Z3WrMNU698e8aP X-Gm-Gg: ASbGncsTFh/5G2YpMj/q/fRiVcaJ+ZVbWHdU9nezZ2bP0m1tw6ps9cKJ6r9eRw08wk6 KeA5VthOop1Smwlub0MI1JxFuwDu6LYkWyaJHGkL9f0yqYM4yIUBbyebDmqsGHn5YSHpqFp/RfP JhXiRKCgj97ODTgZyoab79Xu9IZpb+IrI6XXICW8zYLd53Cg7ZjLEpjAAA2zr+Jy7EPQLo45aou NqwpTsqXV5k2Yd0X8Qva3wq8AguvNfwzXWioSyt9Z4rWOPa2vPVwIZiZbReXj2xUH47X38n/Wmf fpCQ/qykcYfxXUtf/kTfU5e+F16mupNYSD9Bih2rok2Bjr1vahPPjlQd3tRyjjX6LlgXSL83ewC q31x8J4dr89Qxt4qATRtN9FPju6ZfY4fhvPSti0MQ6wiPTkS6eKU848R3ye9q+7bGdUMZz+eFWy bnIQHwMZZXlbqA/Z/TceqpYu75fREdggHx8GBXNB/tU6E= X-Google-Smtp-Source: AGHT+IHInBv/YU6bejEBL2bATrxPUn8qPF44hY+fSSHyhYEVc+LjJqhA0J4jjKjxadw929VHyE3rRA== X-Received: by 2002:a05:620a:4510:b0:8b1:a49e:9b0e with SMTP id af79cd13be357-8b5e47d21b0mr1455734885a.5.1764938898432; Fri, 05 Dec 2025 04:48:18 -0800 (PST) From: Yuki Sireneva To: pbs-devel@lists.proxmox.com Date: Fri, 5 Dec 2025 12:47:50 +0000 Message-ID: <20251205124802.334198-1-yuki.utk8g@gmail.com> X-Mailer: git-send-email 2.51.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs] X-Mailman-Approved-At: Tue, 09 Dec 2025 07:40:17 +0100 Subject: [pbs-devel] [PATCH pve-xtermjs] Avoid allocating in `pre_exec` closure X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Cc: Yuki Sireneva Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" `Error::new` allocates memory (see [148971]). This is bad in multi-threaded programs, which pve-xtermjs AFAIK is. If the fork occurs while the allocator lock is held by another thread, deadlocks can occur, since there's no one left in the new process to unlock the mutex. I do not believe this is UB, and modern libc offer protections against this issue, but this isn't POSIX-compliant and should preferably be avoided. `nix` provides a non-allocating `impl From for std::io::Error`, which can be used instead. This ensures that the correct error code is forwarded to the parent process, instead of the default `-EINVAL`. [rust#148971]: https://github.com/rust-lang/rust/pull/148971 Signed-off-by: Yuki Sireneva --- termproxy/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/termproxy/src/main.rs b/termproxy/src/main.rs index 135468d..31f5a41 100644 --- a/termproxy/src/main.rs +++ b/termproxy/src/main.rs @@ -287,7 +287,7 @@ fn run_pty<'a>(mut full_cmd: impl Iterator) -> Result unsafe { command.pre_exec(move || { - make_controlling_terminal(&secondary_name).map_err(Error::other)?; + make_controlling_terminal(&secondary_name)?; Ok(()) }); } -- 2.51.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel