Re: [PATCH v4 1/6] fs: add write-stream management ioctls

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
On Thu, Jul 30, 2026 at 10:22:11AM -0700, Darrick J. Wong wrote:
> "The third argument is an untyped pointer to memory.  It's traditionally
> char  *argp (from the days before void * was valid C), and will be so
> named for this discussion."

That documentation is wrong or at least very incomplete.  A pointer
is the typical use, but there are plenty of ioctls passing scalar
values <= sizeof(long), going all the way back to early UNIX days.

> You can also see this reflected in the discussion of the R/W/WR variants
> of _IO:
> https://docs.kernel.org/driver-api/ioctl.html

_IO* are optional helpers, and plenty especially older ioctls are
defined without using them.

> Granted your kernel code can treat that argp as an integer and not a
> __user pointer if it wants to, but that goes against most ioctl
> implementations.  Further, subsystems that marshal ioctl information for
> passing through to another layer (e.g. fuse) assume that the third
> argument is a pointer and that it can copy sizeof(data_type) bytes at
> that address in and out of the kernel as part of marshalling.

That is not a good assumption and things will break.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.