From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45B612B9B7 for ; Thu, 11 Jun 2026 18:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781200911; cv=none; b=FE4XDO0fM3btD4st/e3jNz1Qh/CGyZjALbzOu6Y+8vlUTpsHdr25vpRwpKJEYhuxAksrfHAEYsqPaXnuMAhBerP5b2bmKNEaCHm3Lq2XLZqYmbWslZPOUvbH+17OdTjx9RDjohN63XA9DCNX09NkVI7GidPYWfT+xp1aZOVvSLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781200911; c=relaxed/simple; bh=YJFgl3FW9ptuz8HmUGhbUPk137u1ZPYL3WIVCtBVC48=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EH5po8SuxR5S5SgUQzYuQQkIUjtrBsql0wlDAyGh9NmfL/ZbKswC5ecnfTHJQEoZLh0nNT290OGINFFEBjPo5048kbSHuVbbbJLgPGOx5Z2OoR5/cQWY2VZ/RfqGThcQHIRMSNfCK8mT05FKGU1cP9csCtkGM9hOJZkp9skyYPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FwqLv0A9; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FwqLv0A9" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-45eedc94d37so71925f8f.3 for ; Thu, 11 Jun 2026 11:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781200907; x=1781805707; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zM95gdCTPVByK90i40t9RusSaC7GIwD3PMg0Thy0V5k=; b=FwqLv0A9H9SWXNKbfZ1xqypKD1IEPvAhcoEF6K+aOfO5mPxJCfY5eNUDRtGl96+VnD 1pVhMJBTvK2LFZy0gG8FRxwsN4dyZAXj2WQgzkC/gu9PL0GSuElj6blRYzfN7iAwRxt4 MKExqYG27NGsnmcbATrau63JqHM6y6D9kYbk2T4ljSFbSVj4RyCyUMyMAjf3tZoLcdwc yxkpg26VongrRCzU+oSazy1D6WngsncSQ3/7VCLaXty8NYToE0Vm8XrgoupBjRRjxKly uCiwLWf0TNRtaPTBnCo6SNwqD7oJ8FkPr1KDyRx9FrrnlCs3zddF1fOc+mJnfu0bfThH d3Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781200907; x=1781805707; 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=zM95gdCTPVByK90i40t9RusSaC7GIwD3PMg0Thy0V5k=; b=eAVEZW6A7OJiXYDEtBlPF/TV7T9mcix4G3LRnJ2TdpdjwipSOOeV3hOPxU7L1RBpOU /7xZwKLT4wC8Po5bchlJPjcIT3vamYK3RrUbIERF7Lq96G0sSKvaRt/6Rmp0A7IKiIZU 2m93GheeX0oz3mSueQ2HGs6J2/UBI9gSVSwxVtR7SzhYwW6dgJIrM2R3tpuBLU9hmiCO 3Xatg7lOxnhvS08GPgMkFkOsA5B6aK3lm/x20B+G5kaZjyz3VHmaeIlcoBFEQbd/bfA5 QcqetjAjs+EAM6MWmB66r9syIJh4VmH2m1rUPZ8Na+bijMY6S1+DNOKUCDel1E0Uzsde JpCA== X-Forwarded-Encrypted: i=1; AFNElJ+cT51Z1o2vzEOEM0QwEewrFP7crpUNIYihs53bLcjlITpAdKKz5H/ZuCFPbPiaHSDyC48tpy2n7xvM8s0=@vger.kernel.org X-Gm-Message-State: AOJu0YyC8C3E4DWTfGipQWFlooEvq5gBrAiUkqlJmNTKqy6RQ7NUelQS AMdqCE9p/AHZVTon1QKn37veHK66/NIRvSeCX9h9FPf8PvWqhp8azyb+ X-Gm-Gg: Acq92OHYdt5IBKRJUKVNr6Dq58b3fd8cAl5az84Qw2laYGwnOaHXbVG04jzUsA7mnE4 dc61pGDb/CHnrb15N9qvZZEAlQDtUHw2IOc49v/GEd+QKFT4vR7rVy+kgpiGghOxtHSuPntnfYF X8kDa4LIZ7g2ElEEV3h4lFxaXnfZm7hHddCSXDpfmSht/AB80sLcQ1Sg9picu32DyWYWMHpPFJE lv1SGv8M654SmaSkfBDfmRw8q1zJUx/2VOMUxv9LTo2DmAJdL8IQH5+MiOzXfw7MzGcHYkjyY5b 5hQNw490ZGGiAOE6WyC6IkrMgNH/VWmfqp4nbTaUj+DMPWVIxC6n4wyDcU5ZeySlsmueyQ98Y7K rRupS39aJhseWwCkcHe8wPkBCy0mr9KahjyfLWXgI36GGnzH16y2l7FLie747NG3T/HoW325dkn 7v/kJVcrqFDDswzICP31jp+iKe3C865tZzTmq/2ZnRq6BHtfkCe3ex5reFhHFS0gTL3bPxZR4By +sNrkRoqMOGKh9wLgtLZbqM8JmRoDOOS0FhkqV8fVyoFy5psjOxsTyo4gzOX+cM9S6L0I1FypKj 5TlVZPbu8Q== X-Received: by 2002:adf:e008:0:10b0:460:e00:121d with SMTP id ffacd0b85a97d-4606758b140mr4570744f8f.14.1781200907285; Thu, 11 Jun 2026 11:01:47 -0700 (PDT) Received: from instance-20260604-012959.europe-west1-b.c.project-2c9d95d2-bf4e-4d5a-ac6.internal (250.69.76.34.bc.googleusercontent.com. [34.76.69.250]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606c0c9022sm679159f8f.10.2026.06.11.11.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 11:01:46 -0700 (PDT) From: David Maximiliano Hermitte To: Viacheslav Dubeyko , Jori Koolstra Cc: djwong@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com, David Maximiliano Hermitte Subject: Re: [PATCH v2] hfs: return -EFSCORRUPTED instead of BUG() in hfs_write_inode() Date: Thu, 11 Jun 2026 17:57:53 +0000 Message-ID: <20260611175753.1410325-1-davemadmaxxx@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello Slava, Jori, all, I wanted to share one additional diagnostic result from our side. We are not HFS maintainers, and I do not want to present this as a final patch proposal. We used a small change only as a route-checking experiment, to verify whether the crash ending in hfs_write_inode() / BUG() can be prevented by rejecting corrupt metadata earlier. The experimental change was in fs/hfs/btree.c, after reading the HFS B-tree header: if (tree->root >= tree->node_count) goto fail_folio; if (tree->leaf_head >= tree->node_count) goto fail_folio; if (tree->leaf_tail >= tree->node_count) goto fail_folio; if (tree->leaf_count && (!tree->leaf_head || !tree->leaf_tail)) goto fail_folio; if (tree->depth > tree->node_count) goto fail_folio; We specifically did not modify: fs/hfs/inode.c hfs_write_inode() BUG() With the same syzbot-style reproducer and the same QEMU setup, we observed: BEFORE / unpatched: boot_linux_seen=true root_mounted_seen=true repro_started=true VQBIT_HFS_INODE_BUG_SITE_3 line=474 hit kernel_bug_seen=true verdict=BEFORE_BUG_REPRODUCED AFTER / diagnostic btree validation: boot_linux_seen=true root_mounted_seen=true repro_started=true kernel_bug_seen=false hfs_write_inode_seen=false kasan_seen=false oops_seen=false verdict=REPRO_RAN_NO_KERNEL_BUG_SEEN So our current interpretation is: The BUG in hfs_write_inode() appears to be the crash sink. The corrupt state seems to be accepted earlier. Rejecting inconsistent HFS B-tree header fields before traversal prevents the reproducer from reaching hfs_write_inode::BUG(). Again, this is not intended as a polished HFS fix. It is only evidence from a diagnostic route check. I would appreciate your opinion on whether this direction makes sense, and whether the proper fix should live around HFS B-tree / catalog metadata validation rather than changing the final BUG() in hfs_write_inode(). Best regards, David