KVM_READ(3)
π KVM_READ(3) π
okay bestie, this oneβs from the Library Functions Manual, and itβs all about peeking into β and writing to β kernel virtual memory. iconic behavior, honestly. π«Ά
πΈ NAME πΈ
kvm_read,kvm_read2,kvm_writeβ read or write kernel virtual memory
π LIBRARY π
Kernel Data Access Library (libkvm, -lkvm)
β¨ SYNOPSIS β¨
#include <kvm.h>
ssize_t
kvm_read(kvm_t *kd, unsigned long addr, void *buf, size_t nbytes);
ssize_t
kvm_read2(kvm_t *kd, kvaddr_t addr, void *buf, size_t nbytes);
ssize_t
kvm_write(kvm_t *kd, unsigned long addr, const void *buf,
size_t nbytes);
π¦ DESCRIPTION π¦
so like, kvm_read(), kvm_read2(), and kvm_write() are the functions you use to read and write kernel virtual memory (or a crash dump file). for the whole βhow do I even open kernel virtual memory and crash dumpsβ situation, go check kvm_open(3). iykyk π
kvm_read() and kvm_read2() transfer nbytes bytes of data from the kernel space address addr to buf. meanwhile, kvm_write() goes the other way and transfers data from buf to addr. β¨
and bestie, listen: unlike their SunOS counterparts, these functions cannot be used to read or write process address spaces. periodt. π
kvm_read2() uses a different type (kvaddr_t) for the addr argument, which lets you use addresses larger than ULONG_MAX when youβre examining non-native kernel images. slay. π
π RETURN VALUES π
on success, the number of bytes actually transferred is returned. otherwise, -1 is returned. simple as that. π
π SEE ALSO π
kvm(3)kvm_close(3)kvm_getargv(3)kvm_getenvv(3)kvm_geterr(3)kvm_getprocs(3)kvm_nlist(3)kvm_open(3)kvm_openfiles(3)
π HISTORY π
kvm_read2() first appeared in FreeBSD 11.0. noted. β
peace out, bestie π«Ά β this page is from Debian, dated November 27, 2015, and its title is KVM_READ(3). π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms