Page MenuHomeFreeBSD

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

Authored by kib on Nov 4 2024, 10:21 PM.
Tags
None
Referenced Files
F106151435: D47443.diff
Thu, Dec 26, 6:04 AM
Unknown Object (File)
Sun, Dec 8, 11:51 PM
Unknown Object (File)
Fri, Dec 6, 1:49 AM
Unknown Object (File)
Tue, Dec 3, 1:22 PM
Unknown Object (File)
Tue, Dec 3, 12:30 AM
Unknown Object (File)
Mon, Dec 2, 2:39 PM
Unknown Object (File)
Nov 12 2024, 9:27 AM
Unknown Object (File)
Nov 8 2024, 1:54 AM
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.Nov 4 2024, 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.Nov 4 2024, 10:31 PM