Page MenuHomeFreeBSD

Fix panic with non-cdev un_pager.devp.dev
ClosedPublic

Authored by kib on Mon, Nov 4, 10:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 9:27 AM
Unknown Object (File)
Fri, Nov 8, 1:54 AM
Unknown Object (File)
Tue, Nov 5, 5:46 PM
Unknown Object (File)
Mon, Nov 4, 10:24 PM
Subscribers

Details

Summary
device_pager: rename the un_pager.devp.dev field to handle
because it is not neccessary struct cdev *.

vm_object: do not assume that un_pager.devp.dev is cdev
It is subtype-specific handle.  Mark OBJT_DEVICE that do fill cdev into
the handle, with a new object flag OBJ_CDEVH.

PR:     282533

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Mon, Nov 4, 10:21 PM

There are two additional useful things to do there:

  • stop using devp.handle for handle, it seems to always copy the actual handle. Then, the entry can be renamed back to dev and guaranteed to be either NULL or cdev, and it can be cdev in more cases.
  • add cdev pager method to return user-visible name, to fill into procstat and vmstat -o.

For now I believe my fix is good to stay.

markj added inline comments.
sys/vm/vm_object.c
2519

So for now at least, it is not possible to have a MGTDEVICE object with CDEVH set.

A possible enhancement would be to add a "name" field to struct cdev_pager_ops, and use that as the path when available.

This revision is now accepted and ready to land.Mon, Nov 4, 10:31 PM