xxx tolerating malicious drivers in linux
play

XXX Tolerating Malicious Drivers in Linux Silas Boyd-Wickizer and - PowerPoint PPT Presentation

XXX Tolerating Malicious Drivers in Linux Silas Boyd-Wickizer and Nickolai Zeldovich How could a device driver be malicious? Today's device drivers are highly privileged Write kernel memory, allocate memory, ... Drivers are complex;


  1. XXX

  2. Tolerating Malicious Drivers in Linux Silas Boyd-Wickizer and Nickolai Zeldovich

  3. How could a device driver be malicious? Today's device drivers are highly privileged Write kernel memory, allocate memory, ... Drivers are complex; developers write buggy code Result: Attackers exploit vulnerabilities

  4. How could a device driver be malicious? Today's device drivers are highly privileged Write kernel memory, allocate memory, ... Drivers are complex; developers write buggy code Result: Attackers exploit vulnerabilities

  5. How could a device driver be malicious? Today's device drivers are highly privileged Write kernel memory, allocate memory, ... Drivers are complex; developers write buggy code Result: Attackers exploit vulnerabilities

  6. Current approach User-space drivers in µ kernels (Minix, L4, ...) Write device driver in new language (Termite) Handle common faults (Nooks, microdrivers, ...)

  7. Goal Secure, efficient, & unmodified drivers on Linux

  8. Previous user-space drivers µ kernel User User User Ethernet Network Application driver stack Hardware Kernel Kernel core

  9. Previous user-space drivers µ kernel Confine driver in a process User User User Ethernet Network Application driver stack Hardware Kernel Kernel core

  10. Previous user-space drivers µ kernel Confine driver in a process User User User Ethernet Network Application driver stack Hardware Kernel General purpose syscall API to configure device Kernel core

  11. Previous user-space drivers µ kernel Confine driver in a process User User User Ethernet Network Application driver stack Hardware Kernel General purpose syscall API to configure device Kernel core Confine device with IO virtualization HW.

  12. Previous user-space drivers IPC network driver API µ kernel E.g. tx_packet Confine driver in a process User User User Ethernet Network Application driver stack Hardware Kernel General purpose syscall API to configure device Kernel core Confine device with IO virtualization HW.

  13. Current Linux driver architecture User Application Hardware Kernel Ethernet Network driver stack Kernel RT netdevice

  14. Current Linux driver architecture User Application Kernel runtime (e.g. kmalloc ) Hardware Kernel Ethernet Network driver stack Kernel RT netdevice

  15. Current Linux driver architecture User Network driver API (e.g. tx_packet ) Application Kernel runtime (e.g. kmalloc ) Hardware Kernel Ethernet Network driver stack Kernel RT netdevice

  16. Linux user-space driver problem Kernel RT and driver APIs won't work for untrusted drivers in a different AS Ethernet User User driver Application Hardware Kernel Network stack Kernel RT netdevice

  17. SUD's approach Ethernet User User driver Application Hardware Kernel Network stack Kernel RT netdevice

  18. SUD's approach SUD UML handles calls to kernel RT Ethernet User User driver Application Hardware SUD UML Kernel Network stack Kernel RT netdevice

  19. SUD's approach SUD UML handles calls to kernel RT Proxy driver and SUD UML allow reuse of existing driver APIs Ethernet User User driver Application Hardware SUD UML Kernel Ethernet Network proxy driver stack Kernel RT netdevice

  20. SUD's approach SUD UML handles calls to kernel RT Proxy driver and SUD UML allow reuse of existing driver APIs Ethernet User User driver Application Hardware SUD UML Network driver API Kernel Ethernet Network proxy driver stack Kernel RT netdevice

  21. SUD's approach SUD UML handles calls to kernel RT Proxy driver and SUD UML allow reuse of existing driver APIs Ethernet User User driver Application Hardware SUD UML SUD RPC API Network driver API Kernel Ethernet Network proxy driver stack Kernel RT netdevice

  22. SUD's approach SUD UML handles calls to kernel RT Proxy driver and SUD UML allow reuse of existing driver APIs Network driver API Ethernet User User driver Application Hardware SUD UML SUD RPC API Network driver API Kernel Ethernet Network proxy driver stack Kernel RT netdevice

  23. SUD's results Tolerate malicious device drivers Proxy drivers small (~500 LOC) One proxy driver per device class Few kernel modifications (~50 LOC) Unmodified drivers (6 test drivers) High performance, low overhead No need for new OS or language

  24. Security challenge: prevent attacks Problem: driver must perform privileged operations Memory access, driver API, DMA, interrupts, … Attacks from driver code: Direct system attacks: memory corruption, ... Driver API attacks: invalid return value, deadlock, ... Attacks from device: DMA to DRAM, peer-to-peer attacks, interrupt storms

  25. Practical challenges High performance, low overhead Challenge: interact with hardware and kernel at high rate, kernel-user switch expensive E.g. Ethernet driver ~100k times a second Reuse existing drivers and kernel Challenge: drivers assume fully-privileged kernel env. Challenge: kernel driver API complex, non-uniform

  26. SUD overview Hardware User User Driver Application SUD UML Kernel HW access Proxy driver Kernel core module

  27. SUD overview Hardware User User Driver Application SUD UML Kernel HW access Proxy driver Kernel core module

  28. Linux driver APIs Linux defines a driver API for each device class Driver and kernel functions and variables

  29. Example: wireless driver API Linux defines a driver API for each device class Driver and kernel functions and variables struct wireless_ops { int (*tx)(struct sk_buff*); int (*configure_filter)(int); ... }; struct wireless_hw { int conf; int flags .... };

  30. Example: wireless driver API Linux defines a driver API for each device class Driver and kernel functions and variables struct wireless_ops { int (*tx)(struct sk_buff*); int (*configure_filter)(int); ... }; struct wireless_hw { int conf; int flags .... }; Proxy drivers and SUD-UML convert API to RPCs

  31. Example: wireless driver API Linux defines a driver API for each device class Driver and kernel functions and variables struct wireless_ops { int (*tx)(struct sk_buff*); int (*configure_filter)(int); ... }; struct wireless_hw { int conf; int flags .... }; Proxy drivers and SUD-UML convert API to RPCs

  32. Example: wireless driver API Linux defines a driver API for each device class Driver and kernel functions and variables Called in a non- struct wireless_ops { preemptable context int (*tx)(struct sk_buff*); int (*configure_filter)(int); ... }; struct wireless_hw { int conf; int flags .... }; Proxy drivers and SUD-UML convert API to RPCs

  33. Example: wireless driver API Linux defines a driver API for each device class Driver and kernel functions and variables Called in a non- struct wireless_ops { preemptable context int (*tx)(struct sk_buff*); int (*configure_filter)(int); ... Driver API variable }; struct wireless_hw { int conf; int flags .... }; Proxy drivers and SUD-UML convert API to RPCs

  34. Wireless driver in SUD Basic driver API → SUD RPC API→ driver API Non-preemptable function: implement in proxy Driver API variable: shadow variables

  35. Example 1: transmit a packet User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  36. Example 1: transmit a packet User User Socket write Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  37. Example 1: transmit a packet User User Wireless Web driver browser SUD UML Hardware wireless_ops.tx Kernel Wireless Wireless proxy driver core

  38. Example 1: transmit a packet User User TX packet RPC Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  39. Example 1: transmit a packet wireless_ops.tx User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  40. Example 1: transmit a packet DMA TX User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  41. Example 2: non-preemptable callback Problem: unable to switch to user-space User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  42. Example 2: non-preemptable callback Problem: unable to switch to user-space User User Wireless Web driver browser Acquires a SUD UML Hardware spin lock Kernel Wireless Wireless proxy driver core

  43. Example 2: non-preemptable callback Problem: unable to switch to user-space User User Wireless Web driver browser SUD UML Hardware wireless_ops.configure_filter Kernel Wireless Wireless proxy driver core

  44. Example 2: non-preemptable callback Problem: unable to switch to user-space User User Filter RPC Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  45. Example 2: non-preemptable callback Problem: unable to switch to user-space User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

  46. Example 2: non-preemptable callback Problem: unable to switch to user-space Solution: implement directly in proxy driver User User Wireless Web driver browser SUD UML Hardware Kernel Wireless Wireless proxy driver core

Recommend


More recommend