1 / 19

VirtualKd on Linux

VirtualKd on Linux. Tudor Cornea tudor.cornea@gmail.com. As. Dr. Ing. Răzvan Deaconescu Ing. Cosmin Rohat. Bachelor Presentation Session - July 201 2. Content s. Introduction to Kernel Debugging About the VirtualKd Project Implementation Conclusion & Further work. Project idea :

gay-calhoun
Download Presentation

VirtualKd on Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VirtualKd on Linux Tudor Corneatudor.cornea@gmail.com As. Dr. Ing. Răzvan Deaconescu Ing. Cosmin Rohat • Bachelor Presentation Session - July 2012

  2. Contents • Introduction to Kernel Debugging • About the VirtualKd Project • Implementation • Conclusion & Further work Bachelor Presentation Session - July2012

  3. Project idea : To speed-up kernel module debugging on Linux, using native VMware communication mechanisms. Bachelor Presentation Session - July 2012

  4. Kernel Debugging: Overview • Traditional approach: “printk debugging” • Easy to use • Low/No overhead • Some errors are difficult to find • Serial port debugging • Better error catching • Requires kernel recompilation • Slow Bachelor Presentation Session - July 2012

  5. Motivation for the VirtualKd Project • Virtual machines emulate the serial port • Problem: Serial port is slow (~20 KB/s) • Why not let the VM hypervisor handle the data transfer? • VirtualKd • GuestRPC • Available for the Windows kernel Bachelor Presentation Session - July 2012

  6. Installing VirtualKd First task: Installing VirtualKd and creating a debugging session on Windows Bachelor Presentation Session - July 2012

  7. Project Overview • Keywords: VMware; virtual console; debugger Bachelor Presentation Session - July 2012

  8. Project Steps • Console driver that captures debugging output on the guest • Sending the debugging output to a process on the host • Attaching a debugger Bachelor Presentation Session - July 2012

  9. Registering a Console • Capturing kernel printk() messages • Registering a virtual console driver • Problem : can not use printk() inside write method (recursive printk’s) • => • Write data in memory • Display it after console is unregistered Bachelor Presentation Session - July 2012

  10. VMware Communication • Used Open-Vm-Tools • VMCI Sockets for VM-Host communication • API similar to BSD sockets • Works on a single physical machine Bachelor Presentation Session - July 2012

  11. VMCI-based Kernel Sender • Two components: • Client • On the guest • Inside a kernel module • Registers a console • Sends debug output through a socket • Server • On the host • User space program • Receives the debug output Bachelor Presentation Session - July 2012

  12. Integrating VMCI into the Console Driver • Issues Encountered • Lack of documentation for Open-Vm-Tools • Kernel panic when sending the data through a socket in write() => Need to disable interrupts • Write() will be called each time a printk() call is made => The protocol between the client and server should be as simple as possible Bachelor Presentation Session - July 2012

  13. Adding debugger support • Debugging solution used: kgdb • Kernel patched with kgdb support • Uses gdb on the Linux kernel • Kernel debugging packets : put_packet(), get_packet() Bachelor Presentation Session - July 2012

  14. Kgdb support • Idea: • Using kprobes API, • register hooks to put_packet/get_packet Bachelor Presentation Session - July 2012

  15. Performance analysis Similar functionality with Netconsole No networking required! Bachelor Presentation Session - July 2012

  16. Results • Installed and configured VirtualKd for Windows • Managed to capture printk() messages • Finished host-guest VMCI communication • Relies on VMCI kernel module => Early boot messages can not be captured Bachelor Presentation Session - July 2012

  17. Conclusion • Not as fast as Netconsole .... but • Still better than using serial port • Can be used in networkless environments • Can potentially be improved, using other VMware communication APIs Bachelor Presentation Session - July 2012

  18. Future Work • Possibly test other VMware transport mechanisms • GuestRPC • VMware Shared Memory API • Capturing “early printk” output • Adding support for a kgdb I/O driver Bachelor Presentation Session - July 2012

  19. Questions Bachelor Presentation Session - July 2012

More Related