From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AF/mGSQZgmItJQAAbAwnHQ (envelope-from ) for ; Mon, 16 May 2022 11:28:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +GzWGSQZgmILoAAA9RJhRA (envelope-from ) for ; Mon, 16 May 2022 11:28:04 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8A9222C0E0 for ; Mon, 16 May 2022 11:28:03 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id A61E05F748; Mon, 16 May 2022 09:27:59 +0000 (UTC) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by mail.notmuchmail.org (Postfix) with ESMTPS id D97265F6D1 for ; Mon, 16 May 2022 09:27:56 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id DD1D8580184; Mon, 16 May 2022 05:27:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 16 May 2022 05:27:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eliza.sh; h=cc :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t= 1652693274; x=1652696874; bh=bXaB6g2iJ1C5DkPSloMNWicLY0ZqPTVr9Zb uPfqQ41c=; b=j7zrafNGe0AsUJq2j35kSvBTc8Si6U0kiyK6wBzbhx5MFp/70SU v68M39H+G7Ih4sUwD86FX7n9HDqURNVDq0HLUJ26/WmxnEz1CRBBumODe5+IVnk6 pHNeU8MerNX8dwaMbhLk4d9E/2ZZv+hECsh1uTcS5bHjC//ibmbmyhukTdEufcwd D2jA6OD5qpwXtdZKdNnIYtXnlrm25iznUsj/fh0ZeVFDy5v68dNpkCKOYogsyJfN XFtES8sgJM8JOEN/HcbZCSKoa47fnk2wbuBcy9A+fYgSCRJm0SMGVpNhQNBEf+HV FChcMZa6OyWJeGep1R1W70Th1sSkRdi/6BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1652693274; x=1652696874; bh=bXaB6g2iJ1C5D kPSloMNWicLY0ZqPTVr9ZbuPfqQ41c=; b=l5kTpqz97urniwa5SHfmyCWU6vxpo BB0o2mb/hOZufu0bMON8OB8mGj/1+aAQanWO8w4BQnLm+BtRHr7zbvWenm7jf/iu agYFSz26LoP3yqsB8U9kZnwgK51sC412qCPmZs1blyuvYFmLWlPrbNu/KxAYaA53 eRdplp1/JNDwM4Y68Ofd4uV2AzAbrCV3bLOBCdkgrR7qt8L6cvN1Ya4EYI8jDICA KMGmf8YHaTEwFSXux3VRw7FlmnwdW2ja+wNnXf8RhLg7dZvSKL4zVxJS0AYVD0a8 O2RWeE1BBJu41WFdRWyP77GUuGD2z+qASu2fZ5cITlol+ghZz64sfF+oA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrheehgddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttddttd enucfhrhhomhepgfhlihiirgcugggvlhgrshhquhgviicuoegvlhhiiigrsegvlhhiiigr rdhshheqnecuggftrfgrthhtvghrnhepffdvffeltedtgfevudfhvdelvdelkeefffduff ethefghfdvjedtvdeihfejiedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomhepvghlihiirgesvghlihiirgdrshhh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 16 May 2022 05:27:54 -0400 (EDT) From: Eliza Velasquez To: notmuch@notmuchmail.org Subject: [bug] possible condition depending on uninitialized value in _notmuch_message_sync Date: Mon, 16 May 2022 02:27:53 -0700 Message-ID: <87o7zxj086.fsf@eliza.sh> MIME-Version: 1.0 Message-ID-Hash: NYMS46WXSXTD4AD3KZQYPHKRBILNSUJA X-Message-ID-Hash: NYMS46WXSXTD4AD3KZQYPHKRBILNSUJA X-MailFrom: eliza@eliza.sh X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652693284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=/HJoRSSgAChgo2P+5Mo5n0AHrqFwP5rTOINL63D5zCs=; b=tfqZ4oeBfNJFKAG5Nw5nOA5BH4o6Kkoz9DjZ1yX8FgbcHGZx24jWKz4I7bemtUJgIBXXQE o+8C66SR+O/NxjLuub9jQOlUQquBiVLImUutHVzhy1v2FjrQK947bRLBbJnofmyqvhMCHU GezBEl/5tiB9XBbuE+MSh4FzByuY5k6G+PagRYUxV76rB1oxD40SW+UaEac+RceY16fK64 fVk7MxY6pgeGaRT1LG5/YNkqvDJ26y+Xp61hyIFeH+YBAxdkd7OONSwNPBPpfICMorsgZL ln5fjwHKa7xRDsfGd8j0eJ0NtgwOPAEnU9Xu0eEp1BbEQkqZjmeSxOGx//ViWQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652693284; a=rsa-sha256; cv=none; b=Njc4VMqcrtm+nMerFxqvY05iLTMi2J9ybpLblxUzzJX4DKU04S7HplEYms5k4PBdSMAHON kY3Znui6CzqS8IPdE33tEyUW7kRZpyuQDvpm8336pNzwFkUD+AJmVxVZJNwt/sCYEYMCaE GAwCwo33yTn4GRvAZ8xx3LXyxOXWjP+HZAno07IdeXPfjdarNMYGDETizb9hv8Qe41WDtR H6jZd+xI+D8Y3wb78J/pKbzRB61jZwPTVhLrTAhbweEnAY9nRJ+eau8nUIN0jGwOPSKy6L XvT39yBSPaSNoK0zdpwMzs8YWsss+p2sO7t12QMXkwt8vioX6Gr62L85i4TR9g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=eliza.sh header.s=fm1 header.b=j7zrafNG; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=l5kTpqz9; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 1.95 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=eliza.sh header.s=fm1 header.b=j7zrafNG; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=l5kTpqz9; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 8A9222C0E0 X-Spam-Score: 1.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: yScKeJ4uTXMv Hello notmuch, I noticed something peculiar while hacking on the notmuch Rust bindings. One of the unit tests, when run through valgrind, consistently produced this trace: --8<---------------cut here---------------start------------->8--- ==232461== Thread 2 test_tags::mutab: ==232461== Conditional jump or move depends on uninitialised value(s) ==232461== at 0x486E8C6: _notmuch_message_sync (in /nix/store/w5i4pvirysllyh6wq5pxqcm62j4g36fl-notmuch-0.35/lib/libnotmuch.so.5.6.0) ==232461== by 0x4870E6E: notmuch_message_remove_tag (in /nix/store/w5i4pvirysllyh6wq5pxqcm62j4g36fl-notmuch-0.35/lib/libnotmuch.so.5.6.0) ==232461== by 0x1BE953: notmuch::message::Message::remove_tag (message.rs:125) ==232461== by 0x15FD83: tests::test_tags::mutable::test_discard_not_present (test_tags.rs:118) ==232461== by 0x159EC9: tests::test_tags::mutable::test_discard_not_present::{{closure}} (test_tags.rs:114) ==232461== by 0x14FCBD: core::ops::function::FnOnce::call_once (function.rs:227) ==232461== by 0x171B52: test::__rust_begin_short_backtrace (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6) ==232461== by 0x171CD8: test::run_test_in_process (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6) ==232461== by 0x19E2B7: _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hd93c8f36d9bfcd36E.llvm.6931861783653830752 (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6) ==232461== by 0x184605: core::ops::function::FnOnce::call_once{{vtable.shim}} (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6) ==232461== by 0x2896E2: std::sys::unix::thread::Thread::new::thread_start (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6) ==232461== by 0x4D9CEB1: start_thread (in /nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115/lib/libc.so.6) --8<---------------cut here---------------end--------------->8--- The test definition follows. --8<---------------cut here---------------start------------->8--- #[test] fn test_discard_not_present() { let tagset = TagSetFixture::new(true, false); assert!(!tagset.message.tags().any(|x| x == "foo")); tagset.message.remove_tag("foo").unwrap(); } --8<---------------cut here---------------end--------------->8--- First line, when called with these two arguments, creates a new notmuch database with a single dummy message and opens it in `ReadWrite' mode. Investigating the rest of the Rust-side of the stack trace, I didn't find anything particularly suspicious in the way it handles memory. Is it possible then that there's a potential memory error with removing a non-existent tag on a message? I wanted to ask about this on the mailing list before diving in deeper, since this isn't quite the latest version of notmuch and I wasn't sure if it had been fixed in 0.36. I searched the mailing list archives for this particular issue, but I wasn't able to find anything. -- Eliza