Rebootless kernel updates

Similar documents
Ksplice: An Automatic System for Rebootless Kernel Security Updates. Jeffrey Brian Arnold

Rebootless Kernel Updates

Reboot adieu! Online Linux kernel patching. Udo Seidel

March 10, Linux Live Patching. Adrien schischi Schildknecht. Why? Who? How? When? (consistency model) Conclusion

Automated Kernel SECURITY UPDATES Without Reboots. Safe Kernel. Safer Linux.

Ksplice Is Rebooting Your Oracle Linux Database Server Now Obsolete?

Disclaimer. This talk vastly over-simplifies things. See notes for full details and resources.

Buffer overflow background

Disclaimer. This talk vastly over-simplifies things. See notes for full details and resources.

Live Patching: The long road from Kernel to User Space. João Moreira Toolchain Engineer - SUSE Labs

From local user to root Ac1dB1tch3z s exploit analysis. Nicolò October 28

Keeping customer data safe in EC2 a deep dive. Martin Pohlack Amazon Web Services

libcppa Now: High-Level Distributed Programming Without Sacrificing Performance

C Programming Review CSC 4320/6320

Thwarting unknown bugs: hardening features in the mainline Linux kernel

Elivepatch Flexible distributed Linux Kernel live patching. Alice Ferrazzi

Back to the Future: Fault-tolerant Live Update with Time-traveling State Transfer

Systemtap times April 2009

Distribution Kernel Security Hardening with ftrace

Maintaining Linux Long Term & Adding Specific Features in Telecom Systems. Keika Kobayashi NEC Communication Systems Sep 29, Japan2010

System Administration and Network Security

How Double-Fetch Situations turn into Double-Fetch Vulnerabilities:

The benefits and costs of writing a POSIX kernel in a high-level language

kpatch Have your security and eat it too!

Documentation for exploit entitled nginx 1.3.9/1.4.0 x86 Brute Force Remote Exploit

Automatic program generation for detecting vulnerabilities and errors in compilers and interpreters

Atmel Studio IDE for RIO-2015PG User Guide

Computer Science 61 Scribe Notes Tuesday, November 25, 2014 (aka the day before Thanksgiving Break)

Kernel Probes for ARM. Quentin Barnes Motorola - Mobile Devices April 17, 2007

Buffer Overflows Defending against arbitrary code insertion and execution

EECS 213 Introduction to Computer Systems Dinda, Spring Homework 3. Memory and Cache

SA30228 / CVE

Improving Linux development with better tools

Brave New 64-Bit World. An MWR InfoSecurity Whitepaper. 2 nd June Page 1 of 12 MWR InfoSecurity Brave New 64-Bit World

2 Setting up the RDMA Framework for Development

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Quiz I

Kernel Self Protection

Cucumber Linux Distribution

DDMD AND AUTOMATED CONVERSION FROM C++ TO D

Introduction to Pintos

Linux Kernel Evolution. OpenAFS. Marc Dionne Edinburgh

Subverting the Linux Kernel Linux Kernel Rootkits 101

Fuzzing AOSP. AOSP for the Masses. Attack Android Right Out of the Box Dan Austin, Google. Dan Austin Google Android SDL Research Team

Keeping Up With The Linux Kernel. Marc Dionne AFS and Kerberos Workshop Pittsburgh

Outline. Classic races: files in /tmp. Race conditions. TOCTTOU example. TOCTTOU gaps. Vulnerabilities in OS interaction

String Oriented Programming Exploring Format String Attacks. Mathias Payer

Improving Integer Security for Systems with KINT. Xi Wang, Haogang Chen, Zhihao Jia, Nickolai Zeldovich, Frans Kaashoek MIT CSAIL Tsinghua IIIS

Automatic Source Audit with GCC. CoolQ Redpig Fedora

Debugging Kernel without Debugger

CS 642 Homework #4. Due Date: 11:59 p.m. on Tuesday, May 1, Warning!

Cinema.jnior for Series 3 (310/312) Release Notes

Practical C Programming

HexType: Efficient Detection of Type Confusion Errors for C++ Yuseok Jeon Priyam Biswas Scott A. Carr Byoungyoung Lee Mathias Payer

Linux for Safety Critical Applications: Hunting down bug patterns

An Introduction to Python (TEJ3M & TEJ4M)

Exploiting USB/IP in Linux

Control Flow Hijacking Attacks. Prof. Dr. Michael Backes

#include <stdio.h> int main() { printf ("hello class\n"); return 0; }

Advantech General FAQ. How to change ubuntu specific kernel for quick cross test

CNIT 127: Exploit Development. Ch 2: Stack Overflows in Linux

Advanced Operating Systems and Virtualization. Alessandro Pellegrini A.Y. 2017/2018

Implementing a GDB Stub in Lightweight Kitten OS

Secure Programming Lecture 6: Memory Corruption IV (Countermeasures)

Elivepatch Flexible distributed Linux Kernel live patching. Alice Ferrazzi Takanori Suzuki

CPSC 213. Introduction to Computer Systems. Procedures and the Stack. Unit 1e

Oracle Buys Ksplice Oracle Linux Enhanced with Zero Downtime Software Updates

PCIe Hot-Swap Device Driver

Bypassing Browser Memory Protections

[RFC] Obtaining Management Buy-in for Mainline Development

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Quiz I

High System-Code Security with Low Overhead

Overhead Evaluation about Kprobes and Djprobe (Direct Jump Probe)

Practical Programming Methodology

Newbie s Guide to AVR Interrupts

Exercise Session 6 Computer Architecture and Systems Programming

CPU Cacheline False Sharing - What is it? - How it can impact performance. - How to find it? (new tool)

2 Setting up the RDMA Framework for Development

MWR InfoSecurity Security Advisory. Linux USB Device Driver - Buffer Overflow. 29 th October Contents

CSE 565 Computer Security Fall 2018

On-Demand Proactive Defense against Memory Vulnerabilities

Real-World Buffer Overflow Protection in User & Kernel Space

Finding User/Kernel Pointer Bugs with Type Inference p.1

Improving Linux Development with better tools. Andi Kleen. Oct 2013 Intel Corporation

Language Security. Lecture 40

Final Exam, Spring 2012 Date: May 14th, 2012

John A. Ronciak Staff Engineer NCG/NID/LAO Intel Corp.

Buffer overflow prevention, and other attacks

Multithreading and Interactive Programs

Undefined Behaviour in C

Use Dynamic Analysis Tools on Linux

Dynamic Linux Kernel Instrumentation with SystemTap Eugene Teo, RHCE, RHCX

Lecture Notes for 04/04/06: UNTRUSTED CODE Fatima Zarinni.

Spectre Returns! Speculation Attacks Using Return Stack Buffer

Buffer overflow is still one of the most common vulnerabilities being discovered and exploited in commodity software.

Android Kernel Security

An Architectural Overview of GCC

Spectre and Meltdown: Data leaks during speculative execution

The Kernel Abstraction

Presentation EBW2. By Dominik Pataky Heartbleed

The C Preprocessor (and more)!

Transcription:

Rebootless kernel updates Jeff Arnold jbarnold@ksplice.com http://www.ksplice.com

What is Ksplice?

What is Ksplice? Running kernel with bug

What is Ksplice? Running kernel with bug Ksplice Running kernel without bug Update the kernel without disruption

What is Ksplice? patch Running kernel with bug Ksplice Running kernel without bug Update the kernel without disruption

Why should you care?

Why should you care? Eliminates the need to choose between security and convenience Patch promptly and Avoid reboots

Why is avoiding reboots important?

Why is avoiding reboots important? Downtime Few minutes 1-2 hour announced window during off-peak hours

Why is avoiding reboots important? Downtime Few minutes 1-2 hour announced window during off-peak hours Lose software state

Why is avoiding reboots important? Downtime Few minutes 1-2 hour announced window during off-peak hours Lose software state Reboots commonly cause unexpected problems

Why is patching promptly important? > 90% of attacks exploit known vulnerabilities

Why is patching promptly important? > 90% of attacks exploit known vulnerabilities Days or weeks: too long to wait

Features Any kernel since 2.6.8

Features Any kernel since 2.6.8 No advance preparation

Features Any kernel since 2.6.8 No advance preparation Modules and assembly code

Features Any kernel since 2.6.8 No advance preparation Modules and assembly code Negligible performance impact

What is its status?

What is its status? Initial release: April 2008 (GPLv2)

What is its status? Initial release: April 2008 (GPLv2) Production use at MIT for 1 year

What is its status? Initial release: April 2008 (GPLv2) Production use at MIT for 1 year Tools in Debian sid, Ubuntu Jaunty, Fedora 8-10

What is its status? Initial release: April 2008 (GPLv2) Production use at MIT for 1 year Tools in Debian sid, Ubuntu Jaunty, Fedora 8-10 Proposed for mainline

What is its status? Initial release: April 2008 (GPLv2) Production use at MIT for 1 year Tools in Debian sid, Ubuntu Jaunty, Fedora 8-10 Proposed for mainline 5 engineers working on Ksplice full-time

CVE-2008-0600 fs/splice.c: if (unlikely(!len)) break; error = -EFAULT; - if (unlikely(!base)) + if (!access_ok(verify_read, base, len)) break; /*

$ ksplice-create --patch=splice ~/src

$ ksplice-create --patch=splice ~/src Update written to ksplice-8c4.tar.gz

$ ksplice-create --patch=splice ~/src Update written to ksplice-8c4.tar.gz user then becomes the superuser

$ ksplice-create --patch=splice ~/src Update written to ksplice-8c4.tar.gz user then becomes the superuser # ksplice-apply./ksplice-8c4.tar.gz Done! #

Demo: Protecting against an exploit

Demo: User experience

The Challenge patch: - if(aa) {bb} + if(cc) {dd}? 457f46 4c0102 000100 000002 00e300 Kernel

The rest of this talk How Ksplice works Evaluation: 2005-2008 security vulnerabilities Using Ksplice for debugging Future plans

Design Outline

Design Outline Identify which functions are modified by the source code patch

Design Outline Identify which functions are modified by the source code patch Generate a replacement function for every to-be-replaced function

Design Outline Identify which functions are modified by the source code patch Generate a replacement function for every to-be-replaced function Start redirecting execution to the replacement functions

pre-post differencing pre source post source

pre-post differencing pre source gcc compiled pre post source gcc compiled post

pre-post differencing pre source gcc compiled pre Find what differs post source gcc compiled post

pre-post differencing pre source gcc compiled pre Find what differs post source gcc compiled post replacement functions

Redirect execution foo foo' 55e8f0000001 Replacement function Kernel

Redirect execution foo jmp foo' 55e8f0000001 Replacement function Kernel

Handling symbolic references foo' 55e8[bar] 457f46 4c0102 000100 000002 00e300 Symbol table not sufficient

Matching pre code to running kernel

Matching pre code to running kernel Byte-by-byte comparison

Matching pre code to running kernel Byte-by-byte comparison When pre code refers to symbol, discover symbol value based on running kernel

Matching pre code to running kernel Byte-by-byte comparison When pre code refers to symbol, discover symbol value based on running kernel Discovered symbol values used to resolve symbols in replacement functions

replacement foo':... [bar]...

replacement foo':... [bar]... Any pre function X from same scope:... [bar]...

replacement foo':... [bar]... Kernel's running code: Any pre function X from same scope:... [bar]...

replacement foo':... [bar]... Any pre function X from same scope:... [bar]... Kernel's running code: [addr f0000000] function X:... 00 11 11 00...

replacement foo':... [bar]... Any pre function X from same scope:... [bar]... Kernel's running code: [addr f0000000] function X:... 00 11 11 00... bar = 00111100 + f0000002 - (-4)

replacement foo':... [bar]... Any pre function X from same scope:... [bar]... Kernel's running code: [addr f0000000] function X:... 00 11 11 00... bar = 00111100 + f0000002 - (-4) = f0111106

Kernel's running code: pre function X:... [addr f0000000] function X:... Also serves as extensive safety check

When to switch to new version foo jmp foo' 55e8f0000001 Kernel Should not while foo is running

When to switch to new version foo jmp foo' 55e8f0000001 Kernel Should not while foo is running

Safely redirect execution

Safely redirect execution Temporarily grab all CPUs

Safely redirect execution Temporarily grab all CPUs For every thread, check that the thread is not in the middle of executing any replaced function

Safely redirect execution Temporarily grab all CPUs For every thread, check that the thread is not in the middle of executing any replaced function If necessary, abort (rare)

Safely redirect execution Temporarily grab all CPUs For every thread, check that the thread is not in the middle of executing any replaced function If necessary, abort (rare) Paused less than 0.7ms

Data structure changes Design described so far only changes code not data

Data structure changes Design described so far only changes code not data Sometimes need to walk existing data structures, updating them: Add a field to a struct Change how a data structure is initialized

Ksplice support for data structure changes Simply modify the patch or add code to the patch Can use macros to run code when the update is applied ksplice_pre_apply(func) ksplice_apply(func) (and others...)

CVE-2006-1056 patch a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c @@ 207,6 +207,9 @@ static void init init_amd(struct cpuinfo_x86 *c)... + if (c >x86 >= 6) + set_bit(x86_feature_fxsave_leak, + c >x86_capability);... (and other changes)

+#include "ksplice patch.h" +static void set_fxsave_leak_bit(int id) +{ + int i; + for (i = 0; i < NR_CPUS; i++) { + struct cpuinfo_x86 *c = + cpu_data + i; + if (c >x86 >= 6 && c >x86_vendor == + X86_VENDOR_AMD) + set_bit(x86_feature_fxsave_leak, + c >x86_capability); + } +} +ksplice_apply(set_fxsave_leak_bit);

Hypothesis Most Linux security patches can be hot-applied without writing much new code Interested in: How many patches can be applied without any new code? How much new code is needed to apply the other patches?

Methodology Matched all 'significant' CVEs against Linux patch commit logs

Methodology Matched all 'significant' CVEs against Linux patch commit logs Generated a hot update for each CVE patch, confirming that: Update applies cleanly Still passes POSIX stress test For available exploits: the exploit stops working

Summary of Results Hot-apply most security patches (88%) without any patch changes

Summary of Results Hot-apply most security patches (88%) without any patch changes Hot-apply 100% with modest programmer effort (~17 lines of new code per patch)

CVEs that do not require any new code 2005-1263 2005-1264 2005-1589 2005-2456 2005-3276 2005-2500 2005-2492 2005-3179 2005-3180 2005-2709 2005-4639 2005-3784 2005-4605 2006-0095 2006-0457 2006-2071 2006-1524 2006-1056 2006-1863 2006-1864 2006-0039 2006-1857 2006-1858 2006-1343 2006-2935 2006-2451 2006-3626 2006-3745 2006-5751 2006-6304 2006-5753 2006-6106 2007-0958 2007-1217 2007-0005 2007-1000 2007-1730 2007-1734 2007-2480 2007-1353 2007-2875 2007-3105 2007-3851 2007-3848 2007-3740 2007-4571 2007-4308 2007-5904 2007-6206 2007-6417 2007-6063 2007-6434 2007-5966 2008-0001 2008-0007 2008-0009 2008-0600 2008-1367 2008-1675 2008-1375 2008-2148 2008-1669 2008-1294 2008-1673

CVEs needing new code CVE # Logical Lines 2008-0007 34 2007-4571 10 2007-3851 1 2006-5753 1 2006-2071 14 2006-1056 4 2005-3179 20 2005-2709 48

Debugging or Instrumenting

Debugging or Instrumenting Sometimes, looking inside running system is invaluable kgdb SystemTap

Debugging or Instrumenting Sometimes, looking inside running system is invaluable kgdb SystemTap Advantages of Ksplice

Debugging or Instrumenting Sometimes, looking inside running system is invaluable kgdb SystemTap Advantages of Ksplice Real C

Debugging or Instrumenting Sometimes, looking inside running system is invaluable kgdb SystemTap Advantages of Ksplice Real C Insert code almost anywhere

Debugging or Instrumenting Sometimes, looking inside running system is invaluable kgdb SystemTap Advantages of Ksplice Real C Insert code almost anywhere Discover any symbol value

Impact Not necessary to disrupt operations to stay secure Possible to keep systems fully patched using hot updates Technology also applies to user space applications

Future plans Deliver existing technology Ksplice, Inc. starting to provide rebootless update service Continue advancing hot updates Important to be able to ensure patch safety

Acknowledgments Frans Kaashoek Tim Abbott Anders Kaseorg Waseem Daher MIT SIPB

http://www.ksplice.com Subscribe to ksplice-announce: http://lists.ksplice.com Jeff Arnold jbarnold@ksplice.com