Page MenuHomeFreeBSD

Disallow fcntl(F_READAHEAD) when the vnode is not a regular file.
ClosedPublic

Authored by markj on Tue, Oct 1, 8:19 PM.

Details

Summary

f_iosize is 0 for devfs vnodes, resulting in a divide by zero if one
calls, for example, fcntl(STDIN_FILENO, F_READAHEAD, 4096).

The sequential heuristic is not applied to I/O to or from device files,
and posix_fadvise(2) returns an error for v_type != VREG, so do the same
here too.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj created this revision.Tue, Oct 1, 8:19 PM
mjg added a subscriber: mjg.Tue, Oct 1, 8:31 PM
mjg added inline comments.
sys/kern/kern_descrip.c
791 ↗(On Diff #62807)

vnode is assigned the line prior

markj updated this revision to Diff 62809.Tue, Oct 1, 8:34 PM

Address mjg's note.

kib accepted this revision.Tue, Oct 1, 9:14 PM
This revision is now accepted and ready to land.Tue, Oct 1, 9:14 PM
This revision was automatically updated to reflect the committed changes.