📄 klogd.8
字号:
doing when the error condition occurred.The process of resolving the numeric addresses from the protectionfault printout can be done manually or by using the.B ksymoopsprogram which is included in the kernel sources.As a convenience.B klogdwill attempt to resolve kernel numeric addresses to their symbolicforms if a kernel symbol table is available at execution time. If yourequire the original address of the symbol, use the.B -2switch to preserve the numeric address. Asymbol table may be specified by using the \fB\-k\fR switch on thecommand line. If a symbol file is not explicitly specified thefollowing filenames will be tried:.nf.I /boot/System.map.I /System.map.I /usr/src/linux/System.map.fiVersion information is supplied in the system maps as of kernel1.3.43. This version information is used to direct an intelligentsearch of the list of symbol tables. This feature is useful since itprovides support for both production and experimental kernels.For example a production kernel may have its map file stored in/boot/System.map. If an experimental or test kernel is compiled withthe sources in the 'standard' location of /usr/src/linux the systemmap will be found in /usr/src/linux/System.map. When klogd startsunder the experimental kernel the map in /boot/System.map will bebypassed in favor of the map in /usr/src/linux/System.map.Modern kernels as of 1.3.43 properly format important kernel addressesso that they will be recognized and translated by klogd. Earlierkernels require a source code patch be applied to the kernel sources.This patch is supplied with the sysklogd sources.The process of analyzing kernel protections faults works very wellwith a static kernel. Additional difficulties are encountered whenattempting to diagnose errors which occur in loadable kernel modules.Loadable kernel modules are used to implement kernel functionality ina form which can be loaded or unloaded at will. The use of loadablemodules is useful from a debugging standpoint and can also be usefulin decreasing the amount of memory required by a kernel.The difficulty with diagnosing errors in loadable modules is due tothe dynamic nature of the kernel modules. When a module is loaded thekernel will allocate memory to hold the module, when the module isunloaded this memory will be returned back to the kernel. Thisdynamic memory allocation makes it impossible to produce a map filewhich details the addresses of the variable and functions in a kernelloadable module. Without this location map it is not possible for akernel developer to determine what went wrong if a protection faultinvolves a kernel module..B klogdhas support for dealing with the problem of diagnosing protectionfaults in kernel loadable modules. At program start time or inresponse to a signal the daemon will interrogate the kernel for alisting of all modules loaded and the addresses in memory they areloaded at. Individual modules can also register the locations ofimportant functions when the module is loaded. The addresses of theseexported symbols are also determined during this interrogationprocess.When a protection fault occurs an attempt will be made to resolvekernel addresses from the static symbol table. If this fails thesymbols from the currently loaded modules are examined in an attemptto resolve the addresses. At the very minimum this allows klogd toindicate which loadable module was responsible for generating theprotection fault. Additional information may be available if themodule developer chose to export symbol information from the module.Proper and accurate resolution of addresses in kernel modules requiresthat.B klogdbe informed whenever the kernel module status changes. The.B \-iand.B \-Iswitches can be used to signal the currently executing daemon thatsymbol information be reloaded. Of most importance to properresolution of module symbols is the.B \-iswitch. Each time a kernel module is loaded or removed from thekernel the following command should be executed:.nf.I klogd \-i.fiThe.B \-pswitch can also be used to insure that module symbol information is upto date. This switch instructs.B klogdto reload the module symbol information whenever a protection faultis detected. Caution should be used before invoking the program in\'paranoid\' mode. The stability of the kernel and the operatingenvironment is always under question when a protection fault occurs.Since the klogd daemon must execute system calls in order to read themodule symbol information there is the possibility that the system maybe too unstable to capture useful information. A much better policyis to insure that klogd is updated whenever a module is loaded orunloaded. Having uptodate symbol information loaded increases theprobability of properly resolving a protection fault if it should occur.Included in the sysklogd source distribution is a patch to themodules-2.0.0 package which allows the.B insmod,.B rmmodand.B modprobeutilities to automatically signal.B klogdwhenever a module is inserted or removed from the kernel. Using thispatch will insure that the symbol information maintained in klogd isalways consistent with the current kernel state..PP.SH SIGNAL HANDLINGThe .B klogdwill respond to eight signals:.BR SIGHUP ", " SIGINT ", " SIGKILL ", " SIGTERM ", " SIGTSTP ", ".BR SIGUSR1 ", "SIGUSR2 " and " SIGCONT ". The".BR SIGINT ", " SIGKILL ", " SIGTERM " and " SIGHUPsignals will cause the daemon to close its kernel log sources andterminate gracefully.The .BR SIGTSTP " and " SIGCONTsignals are used to start and stop kernel logging. Upon receipt of a .B SIGTSTPsignal the daemon will close itslog sources and spin in an idle loop. Subsequent receipt of a .B SIGCONTsignal will cause the daemon to go through its initialization sequenceand re-choose an input source. Using.BR SIGSTOP " and " SIGCONTin combination the kernel log input can be re-chosen without stopping andrestarting the daemon. For example if the \fI/proc\fR file system is to beun-mounted the following command sequence should be used:.PP.PD 0.TP # kill -TSTP pid.TP # umount /proc.TP # kill -CONT pid.PD.PPNotations will be made in the system logs with .B LOG_INFOprioritydocumenting the start/stop of logging.The .BR SIGUSR1 " and " SIGUSR2signals are used to initiate loading/reloading of kernel symbol information.Receipt of the.B SIGUSR1signal will cause the kernel module symbols to be reloaded. Signaling thedaemon with.B SIGUSR2will cause both the static kernel symbols and the kernel module symbols tobe reloaded.Provided that the System.map file is placed in an appropriate location thesignal of generally greatest usefulness is the.B SIGUSR1signal. This signal is designed to be used to signal the daemon when kernelmodules are loaded/unloaded. Sending this signal to the daemon after akernel module state change will insure that proper resolution of symbols willoccur if a protection fault occurs in the address space occupied by a kernelmodule..LP.SH FILES.PD 0.TP.I /proc/kmsgOne Source for kernel messages.B klogd.TP.I /var/run/klogd.pidThe file containing the process id of .B klogd.TP.I /boot/System.map, /System.map, /usr/src/linux/System.mapDefault locations for kernel system maps..PD.SH BUGSProbably numerous. Well formed context diffs appreciated..LP.SH AUTHORThe.B klogdwas originally written by Steve Lord (lord@cray.com), Greg Wettsteinmade major improvements..PD 0.TPDr. Greg Wettstein (greg@wind.enjellic.com).TPEnjellic Systems Development.PD.PP.PD 0.TPOncology Research Divsion Computing Facility.TPRoger Maris Cancer Center.TPFargo, ND 58122.PD.zZ
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -