Page MenuHomeFreeBSD

nfs: Remove handling for UIO_SYSSPACE from nfsm_mbufuio()
AbandonedPublic

Authored by markj on Dec 20 2023, 1:01 AM.
Tags
None
Referenced Files
F112084358: D43131.diff
Wed, Mar 12, 2:23 PM
Unknown Object (File)
Jan 23 2025, 4:30 PM
Unknown Object (File)
Jan 23 2025, 4:21 PM
Unknown Object (File)
Jan 22 2025, 3:23 PM
Unknown Object (File)
Jan 20 2025, 11:44 PM
Unknown Object (File)
Dec 1 2024, 6:32 PM
Unknown Object (File)
Nov 22 2024, 4:21 PM
Unknown Object (File)
Oct 8 2024, 8:25 PM
Subscribers

Details

Reviewers
rmacklem
Summary

Currently this function appears to always operate on UIO_SYSSPACE uios.
In preparation for annotating copyout() with __result_use_check, remove
support for UIO_USERSPACE. No functional change intended.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 55039
Build 51928: arc lint + arc unit

Event Timeline

markj requested review of this revision.Dec 20 2023, 1:01 AM

Unfortunately,, if you
sysctl vfs.nfs.nfs_directio_enable=1
and the run a program that opens a file O_DIRECT | O_RDONLY
and then reads the file, it will use the copyout().

Does anyone actually do this?
Probably not, since when I did the O_APPEND change for NFSv4
the directio case was broken in an obvious way (wrong value in the
uio structure, if I recall correctly) and no one had reported the bug.

However, I suppose just ripping it out would be a POLA violation?

I can come up with a patch that adds the error return check for copyout()
in a couple of days, unless you think just ripping the nfs_directio_enable
case out is preferrred?

Unfortunately,, if you
sysctl vfs.nfs.nfs_directio_enable=1
and the run a program that opens a file O_DIRECT | O_RDONLY
and then reads the file, it will use the copyout().

Thank you, I see, I had missed that.

Does anyone actually do this?
Probably not, since when I did the O_APPEND change for NFSv4
the directio case was broken in an obvious way (wrong value in the
uio structure, if I recall correctly) and no one had reported the bug.

However, I suppose just ripping it out would be a POLA violation?

In general it would be. Given that this is fairly intricate code that's unlikely to be widely used, though, I think an exception could be made. At least, my personal view is that POLA violations can be justifiable if they help make foundational code less complex in some significant way.

Is there some reason nfs_directio_enable was never flipped on by default? I can't see easily from the code history why it was a flag to begin with.

I can come up with a patch that adds the error return check for copyout()
in a couple of days, unless you think just ripping the nfs_directio_enable
case out is preferrred?

I think my vote would be to:

  1. add error checking first, so that the patch can easily be MFCed
  2. possibly remove nfs_directio_enable in 15.0, assuming a mailing list query doesn't turn up any surprising uses of the flag

For my purposes 1) is sufficient though, thank you. I've just been going through all of the unchecked copyin()/copyout()/etc. calls in the tree, hence my (incorrect) patch. :)

First, I have no idea when/who did the nfs_directio_enable
code. It was either in the old NFS client or, if not, it was in
the OpenBSD2.6 code I used as a base for doing NFSv4, 20+
years ago.

I think your suggestion of #1, then #2 is a good approach.

I'll come up with #1 and put it up here on phabricator in
a few days.