kgraft Live patching of the Linux kernel



Similar documents
Running SAP HANA One on SoftLayer Bare Metal with SUSE Linux Enterprise Server CAS19256

Using SUSE Linux Enterprise to "Focus In" on Retail Optical Sales

We are watching SUSE

Advanced Systems Management with Machinery

Configuration Management in SUSE Manager 3

Build Platform as a Service (PaaS) with SUSE Studio, WSO2 Middleware, and EC2 Chris Haddad

Challenges Implementing a Generic Backup-Restore API for Linux

Installing, Tuning, and Deploying Oracle Database on SUSE Linux Enterprise Server 12 Technical Introduction

Relax-and-Recover. Johannes Meixner. on SUSE Linux Enterprise 12.

Implementing Linux Authentication and Authorisation Using SSSD

SUSE Storage. FUT7537 Software Defined Storage Introduction and Roadmap: Getting your tentacles around data growth. Larry Morris

Using btrfs Snapshots for Full System Rollback

SUSE Linux Enterprise 12 Security Certifications

Operating System Security Hardening for SAP HANA

Workflow und Identity Management - Genehmigungsprozesse, Role Mining, Role Design und Compliance Management

SUSE Linux Enterprise 12 Security Certifications Common Criteria, EAL, FIPS, PCI DSS,... What's All This About?

DevOps and SUSE From check-in to deployment

Oracle Products on SUSE Linux Enterprise Server 11

SUSE Linux uutuudet - kuulumiset SUSECon:sta

SUSE Customer Center Roadmap

Big Data, SAP HANA. SUSE Linux Enterprise Server for SAP Applications. Kim Aaltonen

Data Center Automation with SUSE Manager Federal Deployment Agency Bundesagentur für Arbeit Data Center Automation Project

TUT5605: Deploying an elastic Hadoop cluster Alejandro Bonilla

Public Cloud. Build, Use, Manage. Robert Schweikert. Public Cloud Architect

Securing Your System: Security Hardening Techniques for SUSE Linux Enterprise Server

High Availability and Disaster Recovery for SAP HANA with SUSE Linux Enterprise Server for SAP Applications

How To Make A Cloud Work For You

HO15982 Deploy OpenStack. The SUSE OpenStack Cloud Experience. Alejandro Bonilla. Michael Echavarria. Cameron Seader. Sales Engineer

Software Defined Everything

How SUSE Is Helping You Rock The Public Cloud

SUSE Enterprise Storage Highly Scalable Software Defined Storage. Gábor Nyers Sales

Wicked A Network Manager Olaf Kirch

Deploying Hadoop with Manager

SUSE OpenStack Cloud 4 Private Cloud Platform based on OpenStack. Gábor Nyers Sales gnyers@suse.com

Btrfs and Rollback How It Works and How to Avoid Pitfalls

Ceph Distributed Storage for the Cloud An update of enterprise use-cases at BMW

Wicked Trip into Wicked Network Management

How an Open Source Cloud Will Help Keep Your Cloud Strategy Options Open

High Availability Storage

SUSE Cloud 5 Private Cloud based on OpenStack

Novell Collaboration Vibe OnPrem

Of Pets and Cattle and Hearts

Using SUSE Cloud to Orchestrate Multiple Hypervisors and Storage at ADP

HO5604 Deploying MongoDB. A Scalable, Distributed Database with SUSE Cloud. Alejandro Bonilla. Sales Engineer abonilla@suse.com

Linux w chmurze publicznej SUSE na platformie Microsoft Azure

Leveraging Wikis to Manage SCP Documentation TWiki Novell Technical Services

Kangaroot SUSE TechUpdate Interoperability SUSE Linux Enterprise and Windows

File Management Suite. Novell. Intelligently Manage File Storage for Maximum Business Benefit. Sophia Germanides

TUT8155 Best Practices: Linux High Availability with VMware Virtual Machines

CAS18543 Migration from a Windows Environment to a SUSE Linux Enterprise based Infrastructure Liberty Christian School

Open Source High Availability Writing Resource Agents for your own services. Lars Marowsky-Brée Team Lead SUSE Labs

SUSE Virtualization Technologies Roadmap

SUSE Virtualization Technologies Roadmap

NIST ITL July 2012 CA Compromise

Based on Geo Clustering for SUSE Linux Enterprise Server High Availability Extension

White Paper Server. SUSE Linux Enterprise Server 12 Modules

Securing Your System: Security Hardening Techniques for SUSE Linux Enterprise Server 12

ZYPP common package and patch management for SUSE Linux. Duncan Mac-Vicar P. Software Engineer, YaST

Apache LDAP Configuration

Introducing Director 11

TUT19344 Managing RH/CentOS with SUSE Manager

SUSE OpenStack Cloud. Become Your Enterprise s Cloud Service Provider

KVM, OpenStack and the Open Cloud SUSECon November 2015

MySeoNetwork Reseller Agreement -Revised June 2, (800) ; (410)

Taking a Proactive Approach to Linux Server Patch Management Linux server patching

How SUSE Manager Can Help You Achieve Regulatory Compliance

Novell Identity Manager Resource Kit

Automated Deployment of an HA OpenStack Cloud

Patch Management Reference

Web Site Development Agreement

Patch Management Reference

Terms & Conditions. Introduction. The following terms and conditions govern your use of this website (VirginiaHomeRepair.com).

March Oracle Business Intelligence Discoverer Statement of Direction

Patch Management. Module VMware Inc. All rights reserved

Service Agreement: January 2008

SUSE Linux Enterprise 10 SP2: Virtualization Technology Support

How To Migrate To Redhat Enterprise Linux 4

Oracle Data Integrator and Oracle Warehouse Builder Statement of Direction

This document has been provided by the International Center for Not-for-Profit Law (ICNL).

Geomant Americas Inc. END USER SOFTWARE LICENSE AGREEMENT

The Designer estimates reaching satisfactory completion of the Services within six weeks of the Effective Date.

Spambrella SaaS Support Terms & Conditions

End User License Agreement South Jersey CrashPlan: Managed Backup Solutions Last Updated 4/14/2011

TERMS AND CONDITIONS

ALPHA TEST LICENSE AGREEMENT

An Oracle Technical Article October Certification with Oracle Linux 5

Transcription:

kgraft Live patching of the Linux kernel Vojtěch Pavlík Director SUSE Labs vojtech@suse.com

Why live patching? Common tiers of change management: 1. Incident response (we're down, actively exploited ) 2. Emergency change (we could go down, are vulnerable ) 3. Scheduled change (time is not critical, we keep safe) Live patching fits in with 1 and 2 Rebooting a 1000 servers is not a quick way to fix a pressing issue and also carries the risk of them not coming up for other reasons Live patching allows quick response and leaving an actual update to a scheduled downtime window 2

What is kgraft? A research project A live patching technology Developed by SUSE Labs Specifically for the Linux kernel Based on modern Linux technologies INT3/IPI-NMI self-modifying code RCU-like update mechanism mcount-based NOP space allocation standard kernel module loading/linking mechanisms 3

Advantages of kgraft Doesn't require stopping the kernel, ever not even for short time periods unlike other technologies Allows code review on kgraft patch sources kgraft patch can be built from C source directly, without the need for object code manipulation Object-code based automated patch generation is provided as an alternative kgraft is lean Small amount of code thanks to leveraging other Linux technologies, no complex instruction decoders or such 4

How does kgraft work? A kgraft patch is a.ko kernel module in a KMP RPM The.ko is inserted into the kernel using 'insmod' at RPM install or update time kgraft replaces whole functions in the kernel even while those functions may be executed An updated kgraft RPM/module can replace an existing patch 5

Limitations kgraft is designed for fixing critical bugs and thus primarily for simple changes Changes in kernel data structure layout require special care and depending on the size of the change, the change may not be possible to do without rebooting at all same as with other live patching tech kgraft depends on a stable build environment and thus best suited for Linux distributions, their customers or anyone who builds their own kernels, rather than 3 rd party support companies 6

kgraft in detail: where to patch To patch a function, kgraft needs some space at the start of a function This is, fortunately provided by GCC's profiling code ftrace uses the compiler profiling options (-pg) to obtain this space ( fentry call) fentry call instructions are patched out at boot and replaced with 5-byte NOPs kgraft uses the same space 7

8 kgraft in detail: where to patch

kgraft in detail: code flow redirection kgraft uses the same infrastructure as ftrace to perform patching INT3 handler is installed with a JMP to the destination address first byte of NOP is replaced by INT3, taking care of incomplete instruction remaining bytes are replaced by address first byte is replaced by JMP NMI IPIs are used throughout to flush instruction decoders on other CPUs 9

10 kgraft in detail: code flow redirection

kgraft function in detail: new function Patching during runtime, no stop_kernel(); Callers are never patched Rather, callee's NOP is replaced by a JMP to the new function So a JMP remains forever But this takes care of function pointers, including in structures And doesn't require saving any old data in case we want to un-patch 11

12 kgraft function in detail: new function

kgraft in detail: RCU-like replacement So what happens when a replaced function changes semantics and subsequent calls rely on each other? Or when it is called recursively? We need to provide a consistent 'world-view' to each execution thread user processes interrupts kernel processes This is done through a "reality check" trampoline and a per-thread flag set on each kernel entry/exit 13

14 kgraft in detail: RCU-like replacement

15 kgraft in detail: RCU-like replacement

kgraft in detail: RCU-like replacement All processes must wake up or execute a syscall Sometimes this requires a signal to be sent (like for getties) Once all processes have the "new universe" flag set, patching is complete and trampolines can be removed 16

17 kgraft in detail: RCU-like replacement

kgraft in detail: Automatic generation Start with a list of functions to be replaced This is automatically extended by any functions that inline them based on original kernel debuginfo Patched kernel is compiled with -ffunction-sections -fdata-sections Modified objcopy copies all functions and required symbols into a.o file A stub.c file is generated including module init, kgraft register, and references to functions Both are compiled and linked into a.ko module 18

Get it Upstreaming kgraft will be submitted into Linus's upstream kernel SUSE will work together with the community to create a common standard kernel live patching solution Suggestions welcome! Publishing kgraft code has become available in a GIT repository TODAY https://git.kernel.org/cgit/linux/kernel/git/jirislaby/kgraft.git 19

Read more about kgraft Initial blogs https://www.suse.com/communities/conversations/kgraft-live-kernel-patching/ https://www.suse.com/communities/conversations/need-kgraft-2/ Video of kgraft in action https://www.youtube.com/watch?v=d8y89obtni8 Articles/interviews https://www.linux.com/news/featured-blogs/200-libby-clark/764542-suse-labs-directo r-talks-live-kernel-patching-with-kgraft http://www.serverwatch.com/server-news/linux-kernel-patching-get-dynamic.html Collaboration summit talk http://collaborationsummit2014.sched.org/event/0d798ed17bfaa0361d0aec63f233 1c8d 20

Corporate Headquarters Maxfeldstrasse 5 90409 Nuremberg Germany +49 911 740 53 0 (Worldwide) www.suse.com Join us on: www.opensuse.org 22

Unpublished Work of SUSE. All Rights Reserved. This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE. Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability. General Disclaimer This document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for SUSE products remains at the sole discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.