add file documentation and copyright

Signed-off-by: Seth Jennings <sjenning@redhat.com>
This commit is contained in:
Seth Jennings 2014-02-11 12:01:51 -06:00
parent 5e3baa4447
commit 628bce2ee8
4 changed files with 72 additions and 2 deletions

View File

@ -1,12 +1,17 @@
#/bin/bash
# kpatch build script
#
# kpatch build script for Fedora
# This script takes a patch based on the version of the kernel
# currently running and creates a kernel module that will
# replace modified functions in the kernel such that the
# patched code takes effect.
# This script contains Fedora specific nuances and will probably
# not work on other distributions; however, it does serve as a tutorial
# on the various steps involved and should be adaptable to other
# distributions.
# This script:
# - Installs the required yum/rpm tools
# - Downloads the kernel src rpm for the currently running kernel

View File

@ -1,3 +1,21 @@
/*
* tools/add-patches-section.c
*
* Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
*
* This tool takes an elf object, the output of create-diff-object
* and the base vmlinux as arguments and adds two new sections
* to the elf object; .patches and .rela.patches.
*
* These two sections allow the kpatch core modules to know which
* functions are overridden by the patch module.
*
* For each struct kpatch_patch entry in the .patches section, the core
* module will register the new function as an ftrace handler for the
* old function. The new function will return to the caller of the old
* function, not the old function itself, bypassing the old function.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -1,3 +1,35 @@
/*
* tools/create-diff-object.c
*
* Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
* Copyright (C) 2013 Josh Poimboeuf <jpoimboe@redhat.com>
*
* This file contains the heart of the ELF object differencing engine.
*
* The tool takes two ELF objects from two versions of the same source
* file; a "base" object and a "patched" object. These object need to have
* been compiled with the -ffunction-sections and -fdata-sections GCC options.
*
* The tool compares the objects at a section level to determine what
* sections have changed. Once a list of changed sections has been generated,
* various rules are applied to determine any object local sections that
* are dependencies of the changed section and also need to be included in
* the output object.
*
* After all the sections for the output object have been selected, a
* reachability test is performed to ensure that every included section
* is reachable from a changed function symbol. If there is a section that
* is not reachable from a changed function, this means that the source-level
* change can not be captured by employing ftrace and therefore can not be
* dynamically patched by kpatch. Changes to static data structures are an
* example.
*
* If the reachability test succeeds
* - Changed text sections are copied into the output object
* - Changed rela sections have there symbol indexes fixed up
* - shstrtab, strtab, and symtab are all rebuilt from scratch
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -1,3 +1,18 @@
/*
* tools/link-vmlinux-syms.c
*
* Copyright (C) Seth Jennings <sjenning@redhat.com>
*
* This tools takes the nearly complete hotfix kernel module and
* the base vmlinux. It hardcodes the addresses of any global symbols
* that are referenced by the output object but are not exported by
* vmlinux into the symbol table of the kernel module.
*
* Global symbols that are exported by the base vmlinux can be
* resolved by the kernel module linker at load time and are
* left unmodified.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>