From: Werner Kasselman <werner@verivus.ai>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Werner Kasselman <werner@verivus.ai>
Subject: [PATCH 0/2] pnfs/blocklayout: harden GETDEVICEINFO volume parser
Date: Tue, 21 Apr 2026 10:03:40 +0000 [thread overview]
Message-ID: <20260421100338.1227152-1-werner@verivus.com> (raw)
The recursive-descent volume parser in fs/nfs/blocklayout/dev.c has
three problems reachable from a malicious NFS server:
- Server-supplied volume indices are used without bounds checking,
causing an OOB heap read at volumes[idx].type.
- The mutual recursion between bl_parse_deviceid and the type-specific
parsers has no depth limit, so a cyclic or deeply chained topology
overflows the kernel stack.
- When nr_volumes is 0, the entry point computes nr_volumes - 1 as the
starting index, underflowing to -1.
Patch 1 fixes the memory-safety issues: index validation, depth cap,
and nr_volumes == 0 rejection.
Patch 2 adds a total parse-operation budget (PNFS_BLOCK_MAX_PARSE_OPS)
to prevent resource exhaustion from DAG-shaped topologies where shared
child references cause exponential tree materialization.
A standalone test exercising all three bug classes and the fixes is at:
tools/testing/pnfs-blocklayout/test-volume-parser.c
Werner Kasselman (2):
pnfs/blocklayout: validate volume indices and limit recursion depth
pnfs/blocklayout: cap total parse operations in volume topology
fs/nfs/blocklayout/blocklayout.h | 2 ++
fs/nfs/blocklayout/dev.c | 61 ++++++++++++++++++++++++--------
2 files changed, 49 insertions(+), 14 deletions(-)
--
2.43.0
next reply other threads:[~2026-04-21 10:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 10:03 Werner Kasselman [this message]
2026-04-21 10:03 ` [PATCH 1/2] pnfs/blocklayout: validate volume indices and limit recursion depth Werner Kasselman
2026-04-21 10:03 ` [PATCH 2/2] pnfs/blocklayout: cap total parse operations in volume topology Werner Kasselman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260421100338.1227152-1-werner@verivus.com \
--to=werner@verivus.ai \
--cc=anna@kernel.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox