From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 294F63C0A1D for ; Sun, 28 Jun 2026 22:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782684094; cv=none; b=idBcEvXgQQQqAINpN5wpzra6M2wZWgVz9eM0h59a7HKRZp9SmmmtfV870ICHk//0eWN0lnGSN/38m+esN65wlU5UEonejcDDGlWTa+LaeAPX+VyGjCmDLzXbZ1JidpBRfJnHulpYX6LCUIn/gtW1nTkJFslBz3oY12Ywk0MKj8I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782684094; c=relaxed/simple; bh=SB6odGluq7MFUOd2wD6Y8N+9LSJ/HbJ6DIduimGruvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J//Uh0DxNZ4nkeAaOGoneRZT9Jx+LRgqt34glYwLdqinKurDtM9JsfboMionXs6iJVJvf2UXsZLf7vIFw9VdbNxfJKC47Z3EokEb+JgMPaFHkQjPb4VgLnfmqRUj4JJAcf/JD9fAVwKMaZD2BlswYT8WWgWR7mg/6sAPRcL88wE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com; spf=pass smtp.mailfrom=trailofbits.com; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b=cU/iktOB; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b="cU/iktOB" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-92e45cfcc8aso61834285a.0 for ; Sun, 28 Jun 2026 15:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trailofbits.com; s=google; t=1782684091; x=1783288891; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mQT7w+XFNF0kWG249pMHpgoFJTr9NabU1CTzR9Mq/O0=; b=cU/iktOBeAHFgqVkVF0tpCWMWJzmKlX4iXkcSzE4Sw5uhiXqOhuiJp9N9RHGrom7Yx 8Y0KCJse4m46g9lJ9wgaaZ9oR6L9GQP5wArdJyufgR1oXceSH5tZCx0/Q9xUn6/zGnIo 4jAyFk/RwuXhj+EJXi65HnXuz51mnfonvO9ulU850b7SzEhsurprz5mknjDTlak/ii4R x67DtFrpJmAGjPicafUvLF/Atlm/s8B9Js6km1uVoWaE4M4XYKYMjKvJfSuN+5g1Wqsv kjrBamablYFLmD1/OMFPlAXRjJo+EAaGgxuhXzov3sUd5h2wWEpK9S/wq3KHiwqLoBOR iBDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782684091; x=1783288891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mQT7w+XFNF0kWG249pMHpgoFJTr9NabU1CTzR9Mq/O0=; b=VAKJmiSFO9UMWIhdsPcX4lTVlpnnmu50QbJP9l/X5K+mV+KOUKIRrYtCe7VXYtaMUs AGCaIRg1XS0u0ijgHCPdCDNW3BTL+NhFwLkHbCR9oemiKIinfRJK0xCwH9Wxv5/vsI37 UqJiYJVcApp1A8aBTejdd8k21XEGFUM9ZdOiHqJjlwpptBOJG3KAHz0lAPLS58fEb+jj HuqSYXeeUsbbIz93Hybe1Ah8MM9civE9J7SNaUBTlilOj6aQJNVTnlunL30hic6ca7zC nnhud0VR4QzPCj/dGyDy2TNwE2vK+l+vyvUh6pNhbCUdOskjkShHIyTHBOonPhT+ciCx 4H+g== X-Forwarded-Encrypted: i=1; AFNElJ9zkQLLWkLcYcGQ1Wl+f8j88OFBe+LKkuY9citl7YY+Ja6nMDDIUtCSRjIl09byn5AyHV8Voj/FkYuG6pQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzq2eOs5+OhtxJ6X4KhVFcyFYZK74iQZT2KqNrCU+rvzHPoU26+ atTBpUhyYv8kxERE+MKxSRMCLl9LARtzE7CdX01R7p8pOsa3+GDENX7iX1WWnzLwqFk= X-Gm-Gg: AfdE7clt1MKRlQIiPFMf22WZJZKKHLPvKhBRWHDpmwZmyXxo2Z24+5QnWWd4/L2kRE5 /QHVjDwUU/83ix0CwnHgNHsLsGFXKpe5h5KJhoMJ292v1OAso/h2VtPEvBGFL3qbJ8lM32zcT1t /TpaoVsW0H1OT1+wUr9ORYlZkSI7zmb58XGOLvR52U5ed5TDXcl4Y5yHOm+XtU5cAqlW+x0sEXR gmPvJldlyAeVWnAtN0va1g+W+vROsh8QmktPYpyEVfSbflx3CPQcng7DtjfWRKh6gxHjqJe5mxc oXk7zo2kEbH7ut9AcXqGz5SipBXcIQVgkUVEHkcJ5QLR+w4z6XrjBwyUmi1AshxyJzRsr7ycacA c7qzpAd5HMmxFpR/IRc3Y0co/Oq7GTwuDieyJZ12OCKUICVEPV2FpZIB6/5yjRMGeLqnYU+eNWx QURrJNxLDyI5rcjFAI X-Received: by 2002:a05:620a:2684:b0:924:eef7:d017 with SMTP id af79cd13be357-926029ee7c9mr3394033185a.31.1782684090731; Sun, 28 Jun 2026 15:01:30 -0700 (PDT) Received: from localhost ([161.35.96.86]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-92b00852726sm796581885a.41.2026.06.28.15.01.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Jun 2026 15:01:30 -0700 (PDT) From: Samuel Moelius To: kees@kernel.org Cc: brauner@kernel.org, iwasbaeyz@gmail.com, linux-kernel@vger.kernel.org, rmk+kernel@armlinux.org.uk, sam.moelius@trailofbits.com, viro@zeniv.linux.org.uk Subject: [PATCH v2 0/2] adfs: reject disc records smaller than one filesystem block Date: Sun, 28 Jun 2026 22:01:24 +0000 Message-ID: <20260628220126.94212-1-sam.moelius@trailofbits.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <202606101323.0DFB06B054@keescook> References: <202606101323.0DFB06B054@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, This v2 splits the ADFS fix and the requested selftest into separate patches. Patch 1 rejects ADFS disc records whose declared disc size is smaller than one filesystem block. Such an image can otherwise mount and later hit a divide-by-zero in statfs because f_blocks is zero. Patch 2 adds a filesystems/adfs selftest that generates two minimal ADFS images: a valid image with a one-block disc size, and an otherwise identical invalid image whose disc size is smaller than one filesystem block. The test verifies that the valid image mounts and statfs succeeds, and that the invalid image is rejected at mount time. Changes since v1: - Split the selftest into a separate patch. - Added a tools/testing/selftests/filesystems/adfs test target. - Added generated-good-image and generated-bad-image mount validation. Thanks, Sam Samuel Moelius (2): adfs: reject disc records smaller than one filesystem block selftests: filesystems: add ADFS mount validation test fs/adfs/super.c | 4 + tools/testing/selftests/Makefile | 1 + .../selftests/filesystems/adfs/Makefile | 5 + .../filesystems/adfs/adfs_mount_check.sh | 113 ++++++++++++++++++ .../testing/selftests/filesystems/adfs/config | 2 + 5 files changed, 125 insertions(+) create mode 100644 tools/testing/selftests/filesystems/adfs/Makefile create mode 100755 tools/testing/selftests/filesystems/adfs/adfs_mount_check.sh create mode 100644 tools/testing/selftests/filesystems/adfs/config -- 2.43.0