From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 721E3287508 for ; Wed, 28 Jan 2026 14:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769611760; cv=none; b=XERGPS73m7bBQLlQ3LuphFCQFAJ+bVqrsL6kSOzrNPMdci83VzLXaiblGXDxsjcs4UogBPIP0aQiVHVT5JMO81Q2F9BIe1oVsUOvkeC4uPvRX4PANlrzGNNWUCaVzJefeAh3rq5+kjOM6l6p6g9CC+XaPnZsD/46eVoXVvk96Xs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769611760; c=relaxed/simple; bh=IkJWJMJLpcyV9VSmZouqP4mDwwtFFzlba0fucljUEpk=; h=Content-Type:Date:Message-Id:From:To:Cc:Subject:Mime-Version; b=Pj6ovTGmAw78H+rqHpHgFualbaaiWAQzP8BhvBeCxj+IMH71XE/SIySTCbvnIyf60o5ZD3Gvvb/3CNzWeqWxlXk5LqtTFTdkQbbFG8he1ALGs/kmbUAnYdehBRzpEAcSOtIHh1VtInVRYNhaEBIPwLxTfJwb7N8yG3usX+Hot44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b=EkAE2tqW; arc=none smtp.client-ip=185.125.188.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b="EkAE2tqW" Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id D33AF3F7D6 for ; Wed, 28 Jan 2026 14:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20251003; t=1769611755; bh=XraBybXD5tsGtLLp8ozxwcFptvRhogq8Wf8sKZhViPA=; h=Content-Type:Date:Message-Id:From:To:Cc:Subject:Mime-Version; b=EkAE2tqWaF1tWFdJmcQjc2KRxsEHar6IybGNCvsAI9YsgHiANKUS2FhRDT8mOM3Cu hOg46uKeKYUQM2GzSIasXRkerpT91DjRErwd0+y7vu8WC8mkbPGEMzBwCaiRXM0HVc CsKn78rkZ2j/oPLS4O5jzVKRY3QPwUO4d8xFm282AF5phB4O0QnabwkrhYnyOtl6nM Dstak04/PElVc14eyPengzRsFKeAXat4qKnD0wXTO0tY3ercKG0tNHlf0lzAy+nujf kNWiP+hBL5hTjGxSlJfKq4QMmThJJya5zwKyPITaxOM0ZnVO6cJkkUV9xrNi3Gaz5Q /D+sc3hvzaD2o4Nd0RxOsBkd7p5NnrWfFiPt/5pIQ1LH0xlX+7fPM4s6VTlCKP/JRm fc6Hm8ILgFLiV1MTf9YjPQrwiUgV5/P/WvL/6NRxzrlfrMwbceu4p51ToXToWbPzUD JPpobcaZllLZUVfoT7Ca9JOfN3Sb8WruuJu8nZ+6KXJ4l5uv+r2XL/r2K92SdT8M+I 3CawNairc37CiMPWz0H58JeCAFM7VdpHVyym9IeTMtRzudSSS/1n3/KmfVA0W4KxED oXQWC4P+0Lwht/Rfn3RkF63dCKHgDpm0msU+ZIwSjrBAuTqlX/rp07uRbtuYTS+qLR vtu0vcgkNREpIn6Bz26QKqsg= Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-7d18e9ab16fso2133382a34.0 for ; Wed, 28 Jan 2026 06:49:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769611755; x=1770216555; h=mime-version:content-transfer-encoding:subject:cc:to:from :message-id:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XraBybXD5tsGtLLp8ozxwcFptvRhogq8Wf8sKZhViPA=; b=awX57upizJ5GHhTszTa0dEmsD2LBAUXdlkAe8CtqPm7kKcBl5q43T02kA9PMWMoOp1 jasOfdGSHF8kWuGFbWme0xCGD8+NNjfKfuwJ1um7MdcKlCvDfNvAZs/qVaGi3S3TGDJ7 QVsP0ZolP2coIWdKEqKKlYlBRCaxUuCgLB0Oe1rqGuhgj7eSeUvgeuKbGWSMHilp8gRK f7MIg9iha+4GEOoZ8JNGPDGQ8mgd9/eUf0uPuKeq7PxXj0VZVStMtMqy6M2ioJRLcqG/ rRvcekULtdZZmqJ9sDQTs4uaIVgdXXRJTFk2P+gZCEkcUyp0co9YF45fgLc4dIaggs3z EekA== X-Forwarded-Encrypted: i=1; AJvYcCV5nqt7qNzaObPFjqVzbJBkJwemIyOzDSalr86Upd2q0CqYmi5jA4wScZHNulEm6apY5zi8rh5m0yPwQns=@vger.kernel.org X-Gm-Message-State: AOJu0YwouCJL0XwL2Ro9zq38rjkfpl24wTQ5m24BuaXKyoylWNvzIvU5 aFKNNIZ0Zl5UkeY3lkluYEOqwH/XscMs2Itri9eBlFB++qLlykifKseYA6PjxCkLFS12CqMAyhf 2Oo3EHHibF8+Nha1j4kiECIctQtt/ODgFqpHWEJ3kst6HyLb6c9xyR6SYNOw+E4zmh8CEsLkw8N IdLBHJeEKWBxFioLyj X-Gm-Gg: AZuq6aJM8Lk767mSvAJSktY8PF5fFKsBAQcwadd8/2UH4UBRmey4zAx5zvqOQXBMayu Eqwobo9woSv8O6Pw7i1LMBLdzCWqobEftJnPloCfSeioZjNhRN5PkmFg4MygP2eeH4ZBBz2IPqs s2XwaLi3DtOFF8bYnnyeIKkOyEJtH+0Cjf3x6FrB4Fxl02R7cRRBJJ9hTeTmVN9+PlH4oBz04Hn kjNfdqpp7TAsGNh9uMwjLlrx2MQXyRpdJbvRM3nsLqTiQSkaYGz62RPAkSw1ffdfbE4n9yFvJCl qxBXOkds19vXreSAzQc3tBYYECy0IAd5KLuA8fqjj8vh8IBSYAP0ZFlhdQUHjRTwQS8ofHv/RVf bxmv/T1ZZ3fBkXRng3m2q X-Received: by 2002:a05:6820:458d:b0:662:5684:d108 with SMTP id 006d021491bc7-662f2041140mr2631042eaf.20.1769611754635; Wed, 28 Jan 2026 06:49:14 -0800 (PST) X-Received: by 2002:a05:6820:458d:b0:662:5684:d108 with SMTP id 006d021491bc7-662f2041140mr2631037eaf.20.1769611754179; Wed, 28 Jan 2026 06:49:14 -0800 (PST) Received: from localhost ([2601:444:703:15b0:cfc8:ccb2:2ef8:893a]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-662f99447b5sm1483115eaf.2.2026.01.28.06.49.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jan 2026 06:49:13 -0800 (PST) Content-Type: text/plain; charset=UTF-8 Date: Wed, 28 Jan 2026 08:49:12 -0600 Message-Id: From: "Zachary M. Raines" To: "Alexander Viro" , "Christian Brauner" Cc: , Subject: PROBLEM: Duplicated entries in /proc//mountinfo Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: aerc 0.20.0 Greetings, When mounting and unmounting many filesystems, /proc//mountinfo someti= mes contains entries which are duplicated many times. Summary =3D=3D=3D=3D=3D=3D=3D Sometimes on a system that is mounting and unmounting filesystems frequentl= y, for example running lots of docker containers, the size of /proc/1/mountinf= o, can become very large -- 100s, to 1000s of entries or more -- with the vast majority being a single entry duplicated many times. This causes other problems on the system, due to systemd parsing the mount = table whenever it changes, and eating up a lot of memory, for example [1]. Waitin= g long enough there are rare events where the length of mountinfo can go into= the millions of lines and lead to OOM and kernel panics. Running the reproducers below, I pretty reliably see an Ubuntu virtual mach= ine kernel panic due to lack of memory within about 24hrs. Versions =3D=3D=3D=3D=3D=3D=3D=3D Bisecting the kernel git history, I was able to track the issue back to '2eea9ce4310d8 mounts: keep list of mounts in an rbtree' [2]. I've tested on 6.19-rc7 in a virtual machine and the issue is still present there. /proc/version: Linux version 6.19.0-rc7+ (ubuntu@kernel-builder) (gcc (Ubuntu 15.2.0-4ubun= tu4) 15.2.0, GNU ld (GNU Binutils for Ubuntu) 2.45) #8 SMP PREEMPT_DYNAMIC Tue J= an 27 22:33:35 UTC 2026 running on Ubuntu 25.10 Reproducer =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The problem can be reproduced by mounting and then unmounting tmpfs in a lo= op and in a seperate process reading /proc/1/mountinfo and checking for duplic= ates. I used the following scripts: 1. Mounts and unmounts tmpfs #!/bin/bash counter=3D0 while true; do unique_name=3D"tmpfs_$$_$counter" mkdir -p "/tmp/$unique_name" sudo mount -t tmpfs "$unique_name" "/tmp/$unique_name" sudo umount "/tmp/$unique_name" rmdir "/tmp/$unique_name" ((counter++)) sleep 0.1 done 2. Reads `/prod/1/mountinfo` and checks for duplicates #!/bin/bash THRESHOLD=3D75 echo "Starting monitoring at $(date)" while true; do # Get mountinfo entries and count total mountinfo=3D"$(cat /proc/1/mountinfo)" mountinfo_count=3D$(echo "$mountinfo" | wc -l) if ((mountinfo_count > THRESHOLD)); then echo "$(date): Mount count ($mountinfo_count) exceeds threshold ($T= HRESHOLD)" # Find and log duplicate mount points with their counts duplicates=3D$(echo "$mountinfo" | sort | uniq -cd) if [[ -n "$duplicates" ]]; then echo "Duplicate mounts :" echo "$duplicates" fi echo "=3D=3D=3D=3D=3D" echo "$mountinfo" echo "---" fi sleep 0.1 done Typically, within 5-10 minutes duplicates can be observed, often including hundreds or thousands of copies of the same mount point -- although the num= ber can rarely spike to much higher values. Given a long enough uptime, I've observed up to 1.4 million duplicates at a time. The duplication in mountinfo is very intermittent. `cat /proc/1/mountinfo` = 100ms later shows no duplication. Additional diagnostics =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D While running the script (2.) above, I also ran the following bpftrace scri= pt 3. Trace vfs_mounts as by `cat /proc/1/mountinfo` #!/usr/bin/env bpftrace fentry:show_mountinfo / comm =3D=3D "cat"/ { @mnts[args->mnt] =3D count(); } tracepoint:sched:sched_process_exit / comm =3D=3D "cat"/ { for ($mnt : @mnts) { if ($mnt.1 > 1) { printf("Duplicate mount %p\n", $mnt.0); @dups[$mnt.0] =3D $mnt.1; } } clear(@mnts); } and observed that a single mount struct was reached multiple times -- perha= ps unsurprisingly exactly the same number as there were duplicates detected by the above script. Typical outputs of script (2.) and the bpftrace script above are Starting monitoring at Tue Jan 27 20:48:13 UTC 2026 Tue Jan 27 20:50:43 UTC 2026: Mount count (696) exceeds threshold (75) Duplicate mounts : /proc/sys/fs/binfmt_misc: 2 occurrences /tmp/tmpfs_856614_41491: 666 occurrences and @dups[0xffff88e5fb9f10a0]: 666 Best, Zachary Raines [1]: https://github.com/systemd/systemd/issues/37939 [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/com= mit/?id=3D2eea9ce4310d8c0f8ef1dbe7b0e7d9219ff02b97