162486687SUlrich Spörlein.\" Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org> 200a5db46SStacey Son.\" The Regents of the University of California. All rights reserved. 300a5db46SStacey Son.\" 400a5db46SStacey Son.\" Redistribution and use in source and binary forms, with or without 500a5db46SStacey Son.\" modification, are permitted provided that the following conditions 600a5db46SStacey Son.\" are met: 700a5db46SStacey Son.\" 1. Redistributions of source code must retain the above copyright 800a5db46SStacey Son.\" notice, this list of conditions and the following disclaimer. 900a5db46SStacey Son.\" 2. Redistributions in binary form must reproduce the above copyright 1000a5db46SStacey Son.\" notice, this list of conditions and the following disclaimer in the 1100a5db46SStacey Son.\" documentation and/or other materials provided with the distribution. 12dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors 1300a5db46SStacey Son.\" may be used to endorse or promote products derived from this software 1400a5db46SStacey Son.\" without specific prior written permission. 1500a5db46SStacey Son.\" 1600a5db46SStacey Son.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1700a5db46SStacey Son.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1800a5db46SStacey Son.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1900a5db46SStacey Son.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2000a5db46SStacey Son.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2100a5db46SStacey Son.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2200a5db46SStacey Son.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2300a5db46SStacey Son.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2400a5db46SStacey Son.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2500a5db46SStacey Son.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2600a5db46SStacey Son.\" SUCH DAMAGE. 2700a5db46SStacey Son.\" 28*22e406c8SMark Johnston.Dd August 2, 2017 2900a5db46SStacey Son.Dt KSYMS 4 3000a5db46SStacey Son.Os 3100a5db46SStacey Son.Sh NAME 3200a5db46SStacey Son.Nm ksyms 3300a5db46SStacey Son.Nd kernel symbol table interface 3400a5db46SStacey Son.Sh SYNOPSIS 3500a5db46SStacey Son.Cd "device ksyms" 3600a5db46SStacey Son.Sh DESCRIPTION 3700a5db46SStacey SonThe 3800a5db46SStacey Son.Pa /dev/ksyms 3900a5db46SStacey Soncharacter device provides a read-only interface to a snapshot of the kernel 4025972509SEdward Tomasz Napieralasymbol table. 4125972509SEdward Tomasz NapieralaThe in-kernel symbol manager is designed to be able to handle 4200a5db46SStacey Sonmany types of symbols tables, however, only 4300a5db46SStacey Son.Xr elf 5 4425972509SEdward Tomasz Napieralasymbol tables are supported by this device. 4525972509SEdward Tomasz NapieralaThe ELF format image contains two 4600a5db46SStacey Sonsections: a symbol table and a corresponding string table. 4700a5db46SStacey Son.Bl -tag -width indent -offset indent 4800a5db46SStacey Son.It Dv Symbol Table 4900a5db46SStacey SonThe SYMTAB section contains the symbol table entries present in the current 5025972509SEdward Tomasz Napieralarunning kernel, including the symbol table entries of any loaded modules. 5125972509SEdward Tomasz NapieralaThe symbols are ordered by the kernel module load time starting with kernel file 5200a5db46SStacey Sonsymbols first, followed by the first loaded module's symbols and so on. 5300a5db46SStacey Son.It Dv String Table 5400a5db46SStacey SonThe STRTAB section contains the symbol name strings from the kernel and any 5500a5db46SStacey Sonloaded modules that the symbol table entries reference. 5600a5db46SStacey Son.El 5700a5db46SStacey Son.Pp 58b06cfd40SJoel DahlElf formatted symbol table data read from the 5900a5db46SStacey Son.Pa /dev/ksyms 6000a5db46SStacey Sonfile represents the state of the kernel at the time when the device is opened. 6100a5db46SStacey SonSince 6200a5db46SStacey Son.Pa /dev/ksyms 6300a5db46SStacey Sonhas no text or data, most of the fields are initialized to NULL. 6400a5db46SStacey SonThe 6500a5db46SStacey Son.Nm 6600a5db46SStacey Sondriver does not block the loading or unloading of modules into the kernel 6700a5db46SStacey Sonwhile the 6800a5db46SStacey Son.Pa /dev/ksyms 6900a5db46SStacey Sonfile is open but may contain stale data. 7000a5db46SStacey Son.Sh FILES 7100a5db46SStacey Son.Bl -tag -width /dev/ksymsX 7200a5db46SStacey Son.It Pa /dev/ksyms 7300a5db46SStacey Son.El 7400a5db46SStacey Son.Sh ERRORS 7500a5db46SStacey SonAn 7600a5db46SStacey Son.Xr open 2 7700a5db46SStacey Sonof 7800a5db46SStacey Son.Pa /dev/ksyms 7900a5db46SStacey Sonwill fail if: 8000a5db46SStacey Son.Bl -tag -width Er 8100a5db46SStacey Son.It Bq Er EBUSY 8225972509SEdward Tomasz NapieralaThe device is already open. 8325972509SEdward Tomasz NapieralaA process must close 8400a5db46SStacey Son.Pa /dev/ksyms 8500a5db46SStacey Sonbefore it can be opened again. 8600a5db46SStacey Son.It Bq Er ENOMEM 8700a5db46SStacey SonThere is a resource shortage in the kernel. 8800a5db46SStacey Son.It Bq Er ENXIO 8900a5db46SStacey SonThe driver was unsuccessful in creating a snapshot of the kernel symbol 9025972509SEdward Tomasz Napieralatable. 9125972509SEdward Tomasz NapieralaThis may occur if the kernel was in the process of loading or 9200a5db46SStacey Sonunloading a module. 9300a5db46SStacey Son.El 9400a5db46SStacey Son.Sh SEE ALSO 9500a5db46SStacey Son.Xr nlist 3 , 9600a5db46SStacey Son.Xr elf 5 , 9700a5db46SStacey Son.Xr kldload 8 9800a5db46SStacey Son.Sh HISTORY 9900a5db46SStacey SonA 10000a5db46SStacey Son.Nm 10100a5db46SStacey Sondevice exists in many different operating systems. 10200a5db46SStacey SonThis implementation is similar in function to the Solaris and NetBSD 10300a5db46SStacey Son.Nm 10400a5db46SStacey Sondriver. 10500a5db46SStacey Son.Pp 10600a5db46SStacey SonThe 10700a5db46SStacey Son.Nm 10800a5db46SStacey Sondriver first appeared in 10900a5db46SStacey Son.Fx 8.0 11000a5db46SStacey Sonto support 11100a5db46SStacey Son.Xr lockstat 1 . 1120afc94c1SUlrich Spörlein.Sh AUTHORS 1130afc94c1SUlrich SpörleinThe 1140afc94c1SUlrich Spörlein.Nm 1150afc94c1SUlrich Spörleindriver was written by 1166c899950SBaptiste Daroussin.An Stacey Son Aq Mt sson@FreeBSD.org . 11700a5db46SStacey Son.Sh BUGS 11800a5db46SStacey SonBecause files can be dynamically linked into the kernel at any time the symbol 11925972509SEdward Tomasz Napieralainformation can vary. 12025972509SEdward Tomasz NapieralaWhen you open the 12100a5db46SStacey Son.Pa /dev/ksyms 12225972509SEdward Tomasz Napieralafile, you have access to an ELF image which represents a snapshot of the state 12325972509SEdward Tomasz Napieralaof the kernel symbol information at that instant in time. 12425972509SEdward Tomasz NapieralaKeeping the device open does not block the loading or unloading of kernel 12525972509SEdward Tomasz Napieralamodules. 12625972509SEdward Tomasz NapieralaTo get a new snapshot you must close and re-open the device. 12700a5db46SStacey Son.Pp 12800a5db46SStacey SonA process is only allowed to open the 12900a5db46SStacey Son.Pa /dev/ksyms 13025972509SEdward Tomasz Napieralafile once at a time. 13125972509SEdward Tomasz NapieralaThe process must close the 13200a5db46SStacey Son.Pa /dev/ksyms 13300a5db46SStacey Sonbefore it is allowed to open it again. 134