Page MenuHomeFreeBSD

Implement kvm_kerndisp
ClosedPublic

Authored by luporl on Jan 20 2020, 7:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 9:23 AM
Unknown Object (File)
Fri, Dec 20, 7:09 PM
Unknown Object (File)
Fri, Dec 20, 6:49 PM
Unknown Object (File)
Fri, Dec 20, 1:34 PM
Unknown Object (File)
Nov 7 2024, 3:32 PM
Unknown Object (File)
Nov 4 2024, 9:04 PM
Unknown Object (File)
Nov 3 2024, 12:31 AM
Unknown Object (File)
Oct 20 2024, 10:19 AM
Subscribers

Details

Reviewers
jhb
Group Reviewers
manpages
Commits
rS357615: Implement kvm_kerndisp
Summary

This change adds a new libkvm function, kvm_kerndisp(), that can be used to retrieve the kernel displacement (current/load address minus original base address).

This would be used by kgdb, to find out how to relocate kernel symbols (if needed).

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29184
Build 27116: arc lint + arc unit

Event Timeline

jhb added a subscriber: jhb.

Probably should add the new function to the lvm(3) manpage.

This revision is now accepted and ready to land.Feb 4 2020, 5:07 PM
luporl retitled this revision from WIP: Implement kvm_kerndisp to Implement kvm_kerndisp.

Add man page for kvm_kerndisp

This revision now requires review to proceed.Feb 5 2020, 4:46 PM
lib/libkvm/kvm.h
127

Hmm, is kvaddr_t the better return type? That is, it's a delta in virtual addresses, not file offsets?

I see, it is signed and kvaddr_t is unsigned. I would be tempted to add a kvssize_t that is a int64_t so it's clear that it's a kernel virtual address delta rather than a file offset delta.

lib/libkvm/kvm_kerndisp.3
43

Perhaps:

.fn kvm_kerndsp
returns the number of bytes by which the kernel referenced by
.Fa kd
is displaced.
46

Possibly:

This is the difference between the kernel's base virtual address at run time
and the kernel base virtual address specified in the kernel image file.

(I think it's good to note that this is a virtual address displacement explicitly rather than a PA displacement)

51

If you use my suggestion for the first sentence, s/was/is/ to match the tense change.

Address review's comments

  • change kvm_kerndisp() return type to kvssize_t
  • improve man page text
luporl added inline comments.
lib/libkvm/kvm.h
127

Correct, the returned value is a delta in virtual addresses.
I've replaced the type by the new kvssize_t.

lib/libkvm/kvm_kerndisp.3
46

Right, this description is more clear and easier to understand.

jhb added inline comments.
sys/sys/types.h
263 ↗(On Diff #67822)

My bad, I should have looked first! Since we already have ksize_t, I guess it would be best to call it kssize_t without the 'v'. You can commit it after fixing that without needing another round of review though.

This revision is now accepted and ready to land.Feb 5 2020, 8:01 PM
This revision was automatically updated to reflect the committed changes.
luporl marked 2 inline comments as done.