Linux NFS development
 help / color / mirror / Atom feed
* [PATCH v2 0/7] NFS: harden pNFS XDR decoding
@ 2026-08-31 11:48 Prabhakar Pujeri
  2026-08-31 11:48 ` [PATCH v2 1/7] NFS: free netid when discarding pNFS DS addresses Prabhakar Pujeri
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Prabhakar Pujeri @ 2026-08-31 11:48 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, Prabhakar Pujeri

pNFS device and layout replies contain several counts and strings supplied
by the server.  The current decoders trust some of those values before the
reply has proved that the corresponding XDR objects are present.  A broken
or malicious server can therefore provoke oversized allocations, very long
decode loops, malformed data-server ports, or leaked netid strings on
temporary-address cleanup paths.

This series makes those paths proportional to the received XDR length.  It
also validates both decimal port octets and uses the common data-server
address destructor wherever a temporary address is discarded.

The last patch adds focused, page-backed KUnit coverage for the address,
GETDEVICEINFO, and LAYOUTGET decoders.  It covers 16 universal-address cases
and six flexfiles cases, including cache reuse and malformed multipath,
version, and filehandle counts.

This version is based on v7.3-rc1.

Validation:

  - nfs_pnfs_decode KUnit suite: 16/16 passed
  - nfs_flexfile_deviceid KUnit suite: 6/6 passed
  - GCC 16 W=1 build of fs/nfs/: passed with no NFS diagnostics
  - Clang 22 W=1 build of fs/nfs/: passed with no NFS diagnostics
  - GCC 16 W=1 build of fs/nfs/ with KUnit disabled: passed
  - Sparse C=2 checks of every touched C source: passed with no diagnostics
  - GCC 16 W=1 full kernel and modules build: passed
  - git diff --check: clean
  - per-patch checkpatch: no errors or code warnings; patch 7 reports only
    the generic FILE_PATH_CHANGES warning for the new test files

Changes in v2:

  - rebase from the NFS client linux-next integration commit 10f307e525a1
    to v7.3-rc1
  - free da_netid on file-layout and flexfiles temporary-address paths
  - bound flexfiles GETDEVICEINFO version_count before allocation
  - bound flexfiles LAYOUTGET fh_count before allocation
  - expand flexfiles KUnit coverage from three to six cases, including the
    cache-hit and malformed-version cleanup paths
  - rename the test patch to reflect the broader XDR coverage

v1: https://lore.kernel.org/r/20260823114244.3883-1-prabhakar.pujeri@dell.com

Prabhakar Pujeri (7):
  NFS: free netid when discarding pNFS DS addresses
  NFS: bound flexfiles GETDEVICEINFO version count
  NFS: bound flexfiles filehandle version count
  NFS: validate pNFS data server port octets
  NFS: bound multipath address count in file-layout GETDEVICEINFO
  NFS: bound multipath address count in flexfiles GETDEVICEINFO
  NFS: add KUnit coverage for pNFS XDR decoding

 fs/nfs/Kconfig                               |  34 +++
 fs/nfs/Makefile                              |   3 +
 fs/nfs/filelayout/filelayoutdev.c            |  11 +-
 fs/nfs/flexfilelayout/Makefile               |   3 +
 fs/nfs/flexfilelayout/flexfilelayout.c       |   7 +-
 fs/nfs/flexfilelayout/flexfilelayout.h       |   6 +
 fs/nfs/flexfilelayout/flexfilelayoutdev.c    |  22 +-
 fs/nfs/flexfilelayout/tests/deviceid_kunit.c | 286 +++++++++++++++++++
 fs/nfs/pnfs.h                                |   9 +
 fs/nfs/pnfs_nfs.c                            |  50 ++--
 fs/nfs/tests/pnfs_decode_kunit.c             | 222 ++++++++++++++
 11 files changed, 619 insertions(+), 34 deletions(-)
 create mode 100644 fs/nfs/flexfilelayout/tests/deviceid_kunit.c
 create mode 100644 fs/nfs/tests/pnfs_decode_kunit.c


base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
-- 
2.54.0

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

end of thread, other threads:[~2026-08-31 11:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 11:48 [PATCH v2 0/7] NFS: harden pNFS XDR decoding Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 1/7] NFS: free netid when discarding pNFS DS addresses Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 2/7] NFS: bound flexfiles GETDEVICEINFO version count Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 3/7] NFS: bound flexfiles filehandle " Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 4/7] NFS: validate pNFS data server port octets Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 5/7] NFS: bound multipath address count in file-layout GETDEVICEINFO Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 6/7] NFS: bound multipath address count in flexfiles GETDEVICEINFO Prabhakar Pujeri
2026-08-31 11:48 ` [PATCH v2 7/7] NFS: add KUnit coverage for pNFS XDR decoding Prabhakar Pujeri

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