Development of Kprobes and Relayfs Based on SystemTap
- Author
- XieYuChen
- Advisor
- YuZheZhou
- School
- Jilin University
- Major
- Applied Computer Technology
- Classification
- TP311.52 Software Development
- Degree
- Master's thesis
- Year
- 2007
- Downloads
- 100
- Citations
- 0
Abstract
Acomputer is only a pile of electronic components giving out heat withoutsoftware. Ifwesaythehardwareis theheart ofthecomputer,thensoftwareis thesoul of it. Operating system is the most fundamental system software thatcontrols all the resouces of the computer and offers a foundation for applicationdevelopment. The operating system gives an abstract of the real hardware of thesystemandofferstheusersandtheotherapplicationsavirtualmachine.Linuxisanexcellentoperatingsystemthat conforms tothePOSIXstandard.It’s no worse than the other commercial operating systems with its excellentcapability.Atthesametime,withtheexcellentkernelarchitecture,object-orienteddesign,highmodularizationandportability,Linux kernel has alreadybeen runningon almost all of the popular hardware platforms. We will greatly improve theoperating system design techniques,reduce development cycle by studying thearchitecture of the Linux kernel, mastering the development skills andimplementationmechanisms.Debugging is an absolutely necessary phase during software development,and wewill encounter the problem of how to debug the kernel when developingLinux kernel inevitably. But the Linux system developers wouldn’t add adebugger in the Linux kernel souce tree in order to ensure the correctness of thekernel souce code. They assume the debugger in the kernel will mislead thedeveloper and introduce bad amendment. So the kernel developer has alwaysbeen feeling a delicacy about Linux kernel debugging which is a notabledistinctionbetweenakernelleveldeveloperandauserleveldeveloper.Today, identifying functional problems in Linux systems often involvesmodifying kernel source with diagnostic print statements. The process can betime-consuming and require detailed knowledge of multiple subsystems.Diagnosing complex performance or kernel debugging problems often requires kernel modifications withmultiple rebuilds and reboots. This is a tedious,time-consuming work that most developers would prefer to minimize. As thevolumeoftheLinuxkernelgrowsbiggerandbigger,thetimeconsumedinkernelmodification and compilation increases continually. The goals of SystemTap areto reduce the time and complexity for analyzing problems that involve kernelactivity,togreatlyexpandthecommunityofengineerstowhichsuchanalyses areavailable, and to reduce the need to modify and rebuild the kernel as atroubleshootingtechnique.SystemTap which conforms to GPL provides a scripting environment thatcan eliminate the modify-build-test loop often required for understanding detailsof Linux kernel behavior. The developer and adminstrator can write or reusesimple scripts to examine the Linux system activities more deeply, also the datacan be quickly accsessed、filterd and gathered. Systemtap uses the kprobesinfrastructure to dynamically instrument the kernel and user applications.Systemtapinstrumentationincurs lowoverheadwhenenabled, andzerooverheadwhendisabled.SystemTapprovidesfacilitiestodefineinstrumentationpointsinahigh-levellanguage,andtoaggregateandanalyzetheinstrumentationdata.This paper mainly describes the kprobes and relayfs used in SystemTap.KernelDynamicProbes(kprobes)isamechanismusedinLinuxkerneldebugging.It can also be used to instrumente events,locate system performancebottleneck,record specific evens and trace problems in production systems. Theimplementation of kprobes is architecutures dependent, now it supportsarchitectures like x86,x86-64,ia64,sparc64 and ppc64. It has not been ported tos390ors390xfornow.Currentlytherearethreekindsofprobes:kprobe:itcanbeinsertedonvirtuallyanyinstructioninthekernel.jprobe: it is inserted at the entryto a kernel function, and provideconvenientaccesstothefunction’sarguments.kretprobe:itfireswhenaspecifiedfunctionreturns.Relayfs is a filesystem designed to provide an efficient mechanism for tools and facilities to relay large and potentially sustained streams of data from kernelspace to user space. The main abstraction of relayfs is the ’channel’. A channelconsists of a set of per-cpu kernel buffers each represented bya file in the relayfsfilesystem. Kernel clients write into a channel using efficient write functionswhich automatically log to the current cpu’s channel buffer. User spaceapplications mmap() the per-cpu files and retrieve the data as it becomesavailable. SystemTap is an open source project started in 2005. Now the primarydevelopers of SystemTap come from Red Hat,IBM,Intel and Hitachi, includingdevelopers from IBM China Development Lab. Inthis project, IBM is in chargeofkprobeskernelsupportforx86,x86<sub>6</sub>4,ppc64,relayfsandtesting;RedHatisincharge of the development of translator and runtime; Intel is in charge of kprobeskernel support for ia64,safety and instrumentation monitor of tapset. Theemergence of SystemTap makes the Linux community has its own powerful andeasy to use dynamic kernel debug tool. Now SystemTap has been included inFedora Core 6,Red Hat Enterprise Linux 5 and Debian, also we are still workingtoimproveitandaddnewfeaturestoit.
Table of contents
Feed 4-7
Chapter Introduction 7-17
1.1 the Linux features an overview of 7-9
1.2 Linux Kernel Architecture Overview 9-12
1.3 Linux2.6 kernel new features 12-14
1.4 the GNU general-purpose Public License (GPL).; 14-15
1.5 In this paper, the background and the main work 15-17
1.5.1 Background 15-16
1.5.2 main work 16-17
Chapter II analysis of system-level debugging of Linux kernel 17-25
2.1 Oo, ps, tracing 17-20
2.2 the printk () 20-22 <br / > 2.3 KGDB 22-23
2.4 and Solaris's DTrace 23-25 ??
Chapter III System Tap workflow and structure 25-36
3.1 System Tap About 25
3.2 module 25-27
3.3 workflow 27-30
3.3.1 refinement (Elaborate) 28-29
3.3.2 Conversion (Translate) 29
3.3.3 running (Execution) 29-30
3.3.4 data acquisition 30
3.4 System Tap programming language 30-32
3.4.1 Detection Point (probepoints) 30-31
3.4.2 Language Infrastructure 31-32
3.5 Tapsets is 32-36
the 3.5.1 tapsets the basic concepts 32-34
3.5.2 script tapsets 34 -35
3.5.3 C language system call tapsets 35-36
Chapter Kprobes with relayfs the development 36-55
4.1 Kprobes 36-46
4.1.1 Kprobes basic concept 36-38
the 4.1.2 Kprobes interface analysis 38-40
the 4.1.3 Kprobes Manager 40-41
4.1.4 Kprobes workflow 41-43
4.1.5 Kprobes in SystemTap 43-46
4.2 Relayfs 46-55
4.2.1 Relayfs About 46-47
4.2.2 Relayfs the basic principles of 47-48
4.2.3 Relayfs in the System Tap in to achieve 48-51
4.2.4 The program is running (runtime) process 51-55
Chapter System Tap the safety and testing 55-61
5.1 the System Tap the security 55-57
5.2 test 57-61
Conclusion to Chapter VI 61-63
6.1 summarizes 61-62
6.2 Looking 62-63
References 63-65
Abstract 65-68
Abstract 68-71
thank 71-72
instructor and author 72
Related dissertations
- Design and Implementation of Experiment Platform for Operating System Based on Linux
- Research on GPS Vehicle Navigation System Based on ARM9
- Analysis and reliability of Linux device driver
- Study of Real-time Based on Embedded Linux Operating System
- Linux operating system on the ARM hardware platform transplantation
- Research and Realization of Video Surveillance and Play Based on ARM9Hardware Platform
- Research and Design of Embedded Building Security System
- The Softeware Design and Implement on Integrated Intelligent Camera Platform Based on Davinci DM6446
- The Research of Household Remote Monitoring Based on Embedded Web Server
- Research and Design of Intelligent Video Surveillance System Based on ARM
- Design of Video Monitoring System Based on the Embedded
- The Design of Embedded Network Video Surveillance System Based on ARM9
- Design and Application of the Distributed Monitoring System Based on Embedded Web
- Study on Embedded Data Acquisition System Application
- Embedded Software Design of AC Field Detection Instrument Based on ARM
- Research and Realization on the Key Technology of Monitoring System about Granary Environment Based on ARM9
- Based on the Samsung2440Embedded Home Furnishing Design and Implementation of Intelligent Control System
- The Programing and Development of Automatic Control System for Alpha Gypsum Powder Production Line
- Design of Industrial Ethernet Motion Controller Based on ARM
- Research on Pulsating Vacuum Pressure Steam Sterilization Control System Based on ARM