Skip to content

[LTS 9.2] nfsd: CVE-2026-31402, CVE-2025-40324, CVE-2023-53241#1222

Open
pvts-mat wants to merge 3 commits into
ctrliq:ciqlts9_2from
pvts-mat:CVE-batch-33_ciqlts9_2
Open

[LTS 9.2] nfsd: CVE-2026-31402, CVE-2025-40324, CVE-2023-53241#1222
pvts-mat wants to merge 3 commits into
ctrliq:ciqlts9_2from
pvts-mat:CVE-batch-33_ciqlts9_2

Conversation

@pvts-mat
Copy link
Copy Markdown
Contributor

[LTS 9.2]

CVE-2026-31402 VULN-180163
CVE-2025-40324 VULN-161290
CVE-2023-53241 VULN-154845

Commits

CVE-2026-31402 (+ CVE-2023-53241, CVE-2025-40324)

nfsd: fix heap overflow in NFSv4.0 LOCK replay cache

jira VULN-180163
cve CVE-2026-31402
commit-author Jeff Layton <jlayton@kernel.org>
commit 5133b61aaf437e5f25b1b396b14242a6bb0508e2
upstream-diff Used linux-5.10.y backport
  f9fcb4441f6c02bb20c2eb340101e27dfe23607c for the clean cherry-pick.
  The modified function `nfsd4_encode_operation()' is identical in both
  versions
NFSD: Fix crash in nfsd4_read_release()

jira VULN-161290
cve CVE-2025-40324
commit-author Chuck Lever <chuck.lever@oracle.com>
commit abb1f08a2121dd270193746e43b2a9373db9ad84
nfsd: call op_release, even when op_func returns an error

jira VULN-154845
cve CVE-2023-53241
commit-author Jeff Layton <jlayton@kernel.org>
commit 15a8b55dbb1ba154d82627547c5761cac884d810

The solution is based on the linux-5.10.y backport, which itself doesn't differ from the recent LTS 9.4 fix (see #1153). The nfsd: call op_release, even when op_func returns an error was picked as prerequisite to equalize ciqlts9_2's nfsd4_encode_operation() function with that found in linux-5.10.y from right before the fix, with an added bonus of solving additional CVE. The middle commit NFSD: Fix crash in nfsd4_read_release() was pulled in as a bugfix for nfsd: call op_release, even when op_func returns an error, having its own CVE as well.

kABI check: passed

[0/1] kabi_check_kernel	Check ABI of kernel [ciqlts9_2-CVE-batch-33]	_kabi_check_kernel__x86_64--test--ciqlts9_2-CVE-batch-33
ninja explain: output state/kernels/ciqlts9_2-CVE-batch-33/x86_64/kabi_checked doesn't exist
ninja explain: state/kernels/ciqlts9_2-CVE-batch-33/x86_64/kabi_checked is dirty
+ dist_git_version=el-9.2
+ local_version=ciqlts9_2-CVE-batch-33
+ arch=x86_64
+ user=pvts
+ buildmachine=x86_64--build--ciqlts9_2
+ virsh_timeout=600
+ ssh_daemon_wait=20
+ src_dir=/mnt/code/kernel-dist-git-el-9.2
+ build_dir=/mnt/build_files/kernel-src-tree-ciqlts9_2-CVE-batch-33
+ sudo chmod +x /data/src/ctrliq-github-haskell/kernel-dist-git-el-9.2/SOURCES/check-kabi
+ ninja-back/virssh.xsh --max 8 --shutdown-on-success --shutdown-on-failure --timeout 600 --ssh-daemon-wait 20 pvts x86_64--build--ciqlts9_2 ''\''/mnt/code/kernel-dist-git-el-9.2/SOURCES/check-kabi'\'' -k '\''/mnt/code/kernel-dist-git-el-9.2/SOURCES/Module.kabi_x86_64'\'' -s '\''/mnt/build_files/kernel-src-tree-ciqlts9_2-CVE-batch-33/Module.symvers'\'''
kABI check passed
+ touch state/kernels/ciqlts9_2-CVE-batch-33/x86_64/kabi_checked

Boot test: passed

boot-test.log

Kselftests: passed relative

Reference

kselftests–ciqlts9_2–run1.log
kselftests–ciqlts9_2–run2.log

Patch

kselftests–ciqlts9_2-CVE-batch-33–run1.log
kselftests–ciqlts9_2-CVE-batch-33–run2.log

Comparison

The tests results for the reference and the patch are the same.

$ ktests.xsh diff -d  kselftests*.log

Column    File
--------  --------------------------------------------
Status0   kselftests--ciqlts9_2--run1.log
Status1   kselftests--ciqlts9_2--run2.log
Status2   kselftests--ciqlts9_2-CVE-batch-33--run1.log
Status3   kselftests--ciqlts9_2-CVE-batch-33--run2.log

tests-comparison.txt

pvts-mat added 3 commits May 12, 2026 00:53
jira VULN-154845
cve CVE-2023-53241
commit-author Jeff Layton <jlayton@kernel.org>
commit 15a8b55

For ops with "trivial" replies, nfsd4_encode_operation will shortcut
most of the encoding work and skip to just marshalling up the status.
One of the things it skips is calling op_release. This could cause a
memory leak in the layoutget codepath if there is an error at an
inopportune time.

Have the compound processing engine always call op_release, even when
op_func sets an error in op->status. With this change, we also need
nfsd4_block_get_device_info_scsi to set the gd_device pointer to NULL
on error to avoid a double free.

	Reported-by: Zhi Li <yieli@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2181403
Fixes: 34b1744 ("nfsd4: define ->op_release for compound ops")
	Signed-off-by: Jeff Layton <jlayton@kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit 15a8b55)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-161290
cve CVE-2025-40324
commit-author Chuck Lever <chuck.lever@oracle.com>
commit abb1f08

When tracing is enabled, the trace_nfsd_read_done trace point
crashes during the pynfs read.testNoFh test.

Fixes: 15a8b55 ("nfsd: call op_release, even when op_func returns an error")
	Cc: stable@vger.kernel.org
	Reviewed-by: Jeff Layton <jlayton@kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit abb1f08)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
jira VULN-180163
cve CVE-2026-31402
commit-author Jeff Layton <jlayton@kernel.org>
commit 5133b61
upstream-diff Used linux-5.10.y backport
  f9fcb4441f6c02bb20c2eb340101e27dfe23607c for the clean cherry-pick.
  The modified function `nfsd4_encode_operation()' is identical in both
  versions

The NFSv4.0 replay cache uses a fixed 112-byte inline buffer
(rp_ibuf[NFSD4_REPLAY_ISIZE]) to store encoded operation responses.
This size was calculated based on OPEN responses and does not account
for LOCK denied responses, which include the conflicting lock owner as
a variable-length field up to 1024 bytes (NFS4_OPAQUE_LIMIT).

When a LOCK operation is denied due to a conflict with an existing lock
that has a large owner, nfsd4_encode_operation() copies the full encoded
response into the undersized replay buffer via read_bytes_from_xdr_buf()
with no bounds check. This results in a slab-out-of-bounds write of up
to 944 bytes past the end of the buffer, corrupting adjacent heap memory.

This can be triggered remotely by an unauthenticated attacker with two
cooperating NFSv4.0 clients: one sets a lock with a large owner string,
then the other requests a conflicting lock to provoke the denial.

We could fix this by increasing NFSD4_REPLAY_ISIZE to allow for a full
opaque, but that would increase the size of every stateowner, when most
lockowners are not that large.

Instead, fix this by checking the encoded response length against
NFSD4_REPLAY_ISIZE before copying into the replay buffer. If the
response is too large, set rp_buflen to 0 to skip caching the replay
payload. The status is still cached, and the client already received the
correct response on the original request.

Fixes: 1da177e ("Linux-2.6.12-rc2")
	Cc: stable@kernel.org
	Reported-by: Nicholas Carlini <npc@anthropic.com>
	Tested-by: Nicholas Carlini <npc@anthropic.com>
	Signed-off-by: Jeff Layton <jlayton@kernel.org>
	Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
(cherry picked from commit f9fcb4441f6c02bb20c2eb340101e27dfe23607c)
	Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant