public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* knfsd server bug when GETATTR follows READDIR
@ 2024-12-17 22:10 Rick Macklem
  2024-12-18  1:51 ` Chuck Lever
  0 siblings, 1 reply; 12+ messages in thread
From: Rick Macklem @ 2024-12-17 22:10 UTC (permalink / raw)
  To: Linux NFS Mailing List, J David

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

Hi,

The attached pcap file shows that the knfsd server generates
bogus XDR for the reply to a GETATTR that follows a READDIR
operation.

More specifically, if you look at the pcap file in wireshark
and go to packet#22 and then click on the operations and
then "Opcode: GETATTR (9)", the start of
the XDR for the GETATTR will be highlighted in the hexadecimal
window.
Now, if you look at what follows (in the hexadeciaml window),
you'll see that the GETATTR reply looks like:
- GETATTR (9)
- NFS4_OK (0)
- Length of bitmap (0) <-- Not (2)
- 2 words of attribute bitmap
- 98 (length of attributes in hex)
- attribute values

Everything looks ok, except the number of bitmap words is
0 and not 2.

Since the knfsd does not do this normally, I'd guess it is
some sort of runaway pointer or use after free type bug that
causes this, maybe?

Sofar, it only appears to happen when the GETATTR follows a
READDIR operation.

This was reported to me for a FreeBSD client mounting the following:
Debian 12 w/kernel:
$ uname -r
6.1.0-25-amd64

> - what type of file system it exports

ZFS:

$ dpkg -l | fgrep libzfs4linux
ii  libzfs4linux                    2.1.11-1
               amd64
I suspect that ZFS exports are not common for the Linux knfsd?

Anyhow, I am not sure if you have seen such a problem before,
but I thought I would at least report it.
(I have cc'd the reporter, in case you have questions for him.)

rick
ps: If the pcap file does not make it through the mailing list,
       email me and I'll send you a copy.

[-- Attachment #2: rpc-struct-is-bad.pcap --]
[-- Type: application/octet-stream, Size: 10666 bytes --]

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

end of thread, other threads:[~2024-12-24 13:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 22:10 knfsd server bug when GETATTR follows READDIR Rick Macklem
2024-12-18  1:51 ` Chuck Lever
2024-12-21  2:16   ` J David
2024-12-21 17:34     ` Chuck Lever
2024-12-21 20:52       ` J David
2024-12-21 23:27       ` Rick Macklem
2024-12-21 23:53         ` Rick Macklem
2024-12-22  0:29           ` Rick Macklem
2024-12-22  1:02             ` J David
2024-12-22 20:17           ` Chuck Lever
2024-12-24  6:51             ` Cedric Blancher
2024-12-24 13:45               ` Chuck Lever

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