public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] pnfs/blocklayout: harden GETDEVICEINFO volume parser
@ 2026-04-21 10:03 Werner Kasselman
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Werner Kasselman @ 2026-04-21 10:03 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker
  Cc: Christoph Hellwig, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Werner Kasselman

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-21 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 10:03 [PATCH 0/2] pnfs/blocklayout: harden GETDEVICEINFO volume parser Werner Kasselman
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox