All Projects → cloudlinux → libcare

cloudlinux / libcare

Licence: GPL-2.0 license
libcare -- Patch Userspace Code in Live Processes

Programming Languages

c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects
Makefile
30231 projects
awk
318 projects
Dockerfile
14818 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to libcare

ProgramUpdater
PUF - Program Updater Framework. A library to easier the task of program updating
Stars: ✭ 14 (-89.06%)
Mutual labels:  patch
rips-old
Rust IP Stack - A userspace IP stack written in Rust (Work in progress)
Stars: ✭ 32 (-75%)
Mutual labels:  userspace
live-form-validation
⛔ Nice client-side live form validation for Nette Forms.
Stars: ✭ 55 (-57.03%)
Mutual labels:  live
SynnixOS
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.
Stars: ✭ 40 (-68.75%)
Mutual labels:  userspace
YouTube to m3u
Grabs m3u from YouTube live.
Stars: ✭ 95 (-25.78%)
Mutual labels:  live
hexblade
My own Linux desktop and docker image on top of Ubuntu.
Stars: ✭ 15 (-88.28%)
Mutual labels:  live
Windows10Tools
Tools for Windows 10
Stars: ✭ 45 (-64.84%)
Mutual labels:  patch
go-gitdiff
Go library for parsing and applying patches created by Git
Stars: ✭ 41 (-67.97%)
Mutual labels:  patch
live-stream-media-source-extensions
Live stream h264 encoded mp4 video on media source extensions using ffmpeg, node.js, socket.io, and express. Works in chrome, firefox, safari, and android. Not iOS compatible. Work has moved to mse-live-player repo =>
Stars: ✭ 24 (-81.25%)
Mutual labels:  live
wcwidth-icons
Support fonts with double-width icons in xterm/rxvt-unicode/zsh/vim/…
Stars: ✭ 36 (-71.87%)
Mutual labels:  patch
php-aliyun-open-api-live
阿里云直播API,使用guzzleHttp 中间件方式实现,单文件
Stars: ✭ 18 (-85.94%)
Mutual labels:  live
home
厦门大学攻略大全 Import files, learning materials and useful links of XMU to help XMUers live and learn better.
Stars: ✭ 67 (-47.66%)
Mutual labels:  live
like-fx-miniapp
微信小程序直播点赞效果
Stars: ✭ 19 (-85.16%)
Mutual labels:  live
liveshop
融合电商与直播的跨平台APP,主要采用了Flutter技术开发而成,目前开发中
Stars: ✭ 24 (-81.25%)
Mutual labels:  live
streaming-pt
Live TV 📺 and Radio 📻 shell scripts from Portugal 🇵🇹.
Stars: ✭ 52 (-59.37%)
Mutual labels:  live
rt-mrcnn
Real time instance segmentation with Mask R-CNN, live from webcam feed.
Stars: ✭ 47 (-63.28%)
Mutual labels:  live
live-graphql
Código da live de GraphQL do Bootcamp GoStack 🎓
Stars: ✭ 22 (-82.81%)
Mutual labels:  live
hackupc-landing
🚀 HackUPC's landing page
Stars: ✭ 31 (-75.78%)
Mutual labels:  live
DeepCD
[ICCV17] DeepCD: Learning Deep Complementary Descriptors for Patch Representations
Stars: ✭ 39 (-69.53%)
Mutual labels:  patch
blrec
Bilibili Live Streaming Recorder 哔哩哔哩直播录制
Stars: ✭ 124 (-3.12%)
Mutual labels:  live

LibCare -- Patch Userspace Code on Live Processes

https://travis-ci.org/cloudlinux/libcare.svg?branch=master

Welcome to LibCare --- Live Patch Updates for Userspace Processes and Libraries.

LibCare delivers live patches to any of your Linux executables or libraries at the runtime, without the need for restart of your applications. Most frequently it is used to perform critical security updates such as glibc's GHOST (aka CVE-2015-0235, see how we deal with it in GHOST sample) and QEMU's CVE-2017-2615, but can also be used for serious bug fixes on the fly to avoid interruption of service (see server sample).

See https://kernelcare.com for live Linux Kernel updates also.

FAQ

How the live patches are generated?

We use the same code generating procedure we used in production for years in kernelcare.com:

  1. both original and patched source code are translated to assembler,
  2. corresponding assembler files are compared and new instrumented assembler code is generated, where patches are stored into special ELF sections,
  3. instrumented assembler code is compiled using target project's build system while patch ELF sections are collected in binaries',
  4. binary patch files are extracted from the ELF sections.

The libcare-patch-make script is a handy script for the patch generation for a makeable project. Just do:

$ src/libcare-patch-make some_serious_bug.patch

And find binary patches for all the deliverables of the project in the patchroot directory. See our simple server for usage sample.

For more details follow to the patch preparation chapter of the internals.

How the live patches are applied?

It is a lot like loading a shared library into another process' memory:

  1. our binary libcare-ctl (the doctor) attaches to a patient via ptrace(2),
  2. patient's objects are examined by the doctor,
  3. doctor puppets the patient to allocate patch memory near the original object,
  4. references in the patch are resolved by the doctor, the patch code is ready to be executed now,
  5. doctor rewrites targeted original functions with unconditional jumps to the appropriate patched versions, ensuring that no thread of patient is executing them first.

Now the patient executes patched versions of the functions.

For more details follow to the Patching chapter of the internals.

Will my patches re-apply if I restart the process?

Not at the moment. We only track start of the new processes for the tests, see here.

Does live patching affect performance?

Negligibly. Since code patches simply redirect execution from original code functions to the new ones the overhead is small and comparable to additional “jmp” instruction.

Installation and dependencies

All the Linux-distros with available libunwind, elfutils and binutils packages are supported.

However, the libcare is only tested on Ubuntu from 12.04 to 16.04 and on CentOS from 6.8 to 7.x.

Dependencies

To install the dependencies on RHEL/CentOS do the following:

$ sudo yum install -y binutils elfutils elfutils-libelf-devel libunwind-devel

To install the dependencies on Debian/Ubuntu do the following:

$ sudo apt-get install -y binutils elfutils libelf-dev libunwind-dev

Building libcare

To build libcare emit at project's root dir:

$ make -C src
...

This should build all the utilities required to produce a patch out of some project's source code.

It is highly recommended to run the tests as well, enabling Doctor libcare-ctl to attach ptracecles to any of the processes first:

$ sudo setcap cap_sys_ptrace+ep ./src/libcare-ctl
$ make -C tests && echo OK
...
OK

Now all the required tools are built and we can build some patches. Skip to server sample for that.

How does it work?

Internals are quite confusing and are described here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].