From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB343C52D6F for ; Sun, 25 Aug 2024 01:50:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8E66800F8; Sat, 24 Aug 2024 21:50:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3EE6800F0; Sat, 24 Aug 2024 21:50:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0609800F8; Sat, 24 Aug 2024 21:50:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 93694800F0 for ; Sat, 24 Aug 2024 21:50:48 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D4CA0A0C0D for ; Sun, 25 Aug 2024 01:50:47 +0000 (UTC) X-FDA: 82489088934.30.A4D7041 Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) by imf03.hostedemail.com (Postfix) with ESMTP id 1F0B620006 for ; Sun, 25 Aug 2024 01:50:44 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of forestix@nom.one designates 64.142.111.50 as permitted sender) smtp.mailfrom=forestix@nom.one; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724550603; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=uz5JJvDtLXIrjyFHG+uggJuiGNRqPgw3nsCOepn8rds=; b=p7s776QulmqYj9sZmr49qrn8G7SrVsXdeEjltWAdAO2MWpbPKo9nE+5LSqeRClJVWt6YXg 67f3/M4G0zfrUvAyWy+CJCso0rAfY0DoQSo7hjK+/h28+TRAZp5hsCrKRgfAkQCUf3t4oi 5CC0hNfohEzWBRdtHmsO4YEJBQ5b5p8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of forestix@nom.one designates 64.142.111.50 as permitted sender) smtp.mailfrom=forestix@nom.one; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724550603; a=rsa-sha256; cv=none; b=Pf5ynvW/mhx1TlR1U+vKBZWd9ZoOte05XLwLMeKKoRnRYl4PPNXVOdtqSYdu168cYnGBI4 krM4L0eej6p1nXjBsaPykEHFTGXaa380lw5sDhiP/PiJ/eNlZqOwXfNHfEc0zcI9HZW3PE VM6S0KbGH4kb370z8t5Z48z3mNviark= Received: from 192-184-190-65.static.sonic.net (192-184-190-65.static.sonic.net [192.184.190.65]) (authenticated bits=0) by d.mail.sonic.net (8.16.1/8.16.1) with ESMTPA id 47P1oeJg025924; Sat, 24 Aug 2024 18:50:41 -0700 From: Forest To: David Howells , Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton Cc: linux-cifs@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, regressions@lists.linux.dev Subject: [REGRESSION] cifs: triggers bad flatpak & ostree signatures, corrupts ffmpeg & mkvmerge outputs Date: Sat, 24 Aug 2024 18:50:40 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbLHoUERX1vtYlwpdseB4XYWtL2dShvfjUov/JNCh945aBnRL4VeQXkDwI4V2nIoHpMTu1rLsWf2EGRvohwCNK8 X-Sonic-ID: C;pEX8boRi7xGqg65Sr7edkQ== M;NEsRb4Ri7xGqg65Sr7edkQ== X-Sonic-Spam-Details: -0.0/5.0 by cerberusd X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 1F0B620006 X-Stat-Signature: tcgjsgpdh9exj1a33auykfaai8s6g9rz X-HE-Tag: 1724550644-827680 X-HE-Meta: U2FsdGVkX18Er5I0rN4PF019rQLC/CSPX3x0sLRK4Vp24Rjmd+2ytfOFndDvjTN/h7FQXfZWPUcvyDI66bgJTSj4hSfbk3o3+n+CjmiP4pAFXAoDQa2DKh+JTFkIzOFGV+M9H87nAyoP0irroJ0VPG1sDP2av+ckUZyzHn3dfRC/ZWH/s62U0qZLA6TzGjppgOPEPws6QnNW/zDgzre9FjIzMY61n0v7j40EdijDF8uXImaxSvNm/AqiWt9s9rnR2Lm6efxCdJmFxVfSKyFDjZdcX5JZ1OBY49w/bJqw5J81foAFeBwvqLSuB3gjbA1Boko6mNGze+CrIbnrSkG7PpJRd5HrQLZZAk4zTtSqBwkd21PAjpAbLwehxXXaW6uxLE3MLMn+oyUde6srT9kechetgdbariAgZIofmwYprVMp0S2sKulsJHg2MfWh7fSiNdEjFQGpqJ4MC+w6f1YdxyitxqzV4qddW0O53cNmesNBItsbpu1wv4Rc2ikNUp3bL1CoNhqjAbsI4nsPoQ7npHkH9Af0kDZW+DmDyd45Fc00p/bb03rJvDBe7iZ5gm4vmnux3qZ/d+zBIG6MiKz0g9OpvRgZmt/DawXa7lpoLMD74c3f1FnuBQYOrPQZoe5gIro0KKv02Y1k1pUsgEDdA6fA9mHmyky5UtzSJJ8zbRkbfLaRiYT+39OVc8I+Nph/HxZjlH7mN7kGOatsHKC0nQf15M0xDedpu3uM8Es6Et1Ya0pS6YpskEBVRmQXi5QUWIEdi1Tw9GvKFyljVjkf9UpE1HROPlNkil26EwfEj3zK7a1ChClrjFccalklCs4dnZSwzHnwBluJ8t4zGnAEKVjylkvlvA2Sh7+hkYzce+qUO1MPlu4hXMcKVcKZtbLOy+CUJyqxpFZ5XMHzFCN+c73MTkdeiBDe5/U0LgE3BsUchxppHW+dxYAnlnaAQbVrK9UHeF0XHlI8qODK9XK ah5CIera pWeMgIGmXBARMXAI8rD1wFvaZ+WDKxSj2qhvs0IsZa1gNx+6UT52RtcSAA4yUYZt38TuEq8czFtkNH65mRO9DP+iD8bKJVzKfZviC+rGO0lKV48opkmMeJ0emhpXL9YeZPYwUuo+MGI5GdpyQMkom0EpBQLTlQtfmU41/FTlC1Jw4vXP0zAmMya6enUXVCAh9Z7UPh8urtHciAeAhCiY86qyOwBtDCbN9WZOcTws8X/IiLTiiH79qG+ppP5ewZOJwf9rQ9cpqKZ1OuiIt+v80N+7RrQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: #regzbot introduced: 3ee1a1fc3981 Dear maintainers, I think I have found a cifs regression in the 6.10 kernel series, which leads certain programs to write corrupt data. After upgrading from kernel 6.9.12 to 6.10.6, flatpak and ostree are now writing bad gpg signatures when exporting signed packages or signing their repository metadata/summary files, whenever the repository is on a cifs mount. Instead of writing the signature data, null bytes are written in its place. Furthermore, ffmpeg and mkvmerge are now intermittently writing corrupt files to cifs mounts. No error is reported by the applications or the kernel when it happens. In the case of flatpak, the problem isn't revealed until something tries to use the repository and finds signatures full of null bytes. (Of course, this means the affected repositories have been rendered useless.) In the case of ffmpeg and mkvmerge, the problem isn't revealed until someone plays the video file and reaches a corrupt section. A kernel bisect reveals this: 3ee1a1fc39819906f04d6c62c180e760cd3a689d is the first bad commit commit 3ee1a1fc39819906f04d6c62c180e760cd3a689d Author: David Howells Date: Fri Oct 6 18:29:59 2023 +0100 cifs: Cut over to using netfslib I was unable to determine whether 6.11.0-rc4 fixes it, due to another cifs bug in that version (which I hope to report soon). An strace of flatpak (which uses libostree) shows it generating correct signatures internally, but behaving differently on cifs vs. ext4 when working with memory-mapped temp files, in which the signatures are stored before being written to their final outputs. Here's where I reported my initial findings to those projects: https://github.com/flatpak/flatpak/issues/5911 https://github.com/ostreedev/ostree/issues/3288 Debian Testing and Unstable kernels (6.10.4-1 and 6.10.6-1) are affected: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1079394 The following reproducer script consistently triggers the problem for me. Run it with two arguments: a path on a cifs mount where an ostree repo should be created, and a GPG key ID with which to sign a commit. #!/bin/sh set -e if [ "$#" -lt 2 ] || [ "$1" = "-h" ] ; then echo "usage: $(basename "$0") " exit 2 fi repo=$1 keyid=$2 src="./foo" echo "creating ostree repo at $repo" ostree init --repo="$repo" echo "creating source file tree at $src" mkdir -p "$src" echo hi > "$src"/hello ostree commit --repo="$repo" --branch=foo --gpg-sign="$keyid" "$src" if ostree show --repo="$repo" foo; then echo --- echo success! else echo --- ostree show --repo="$repo" --print-detached-metadata-key=ostree.gpgsigs foo echo failure! echo look for null bytes in the above commit signature fi