kpatch/kmod/patch/kpatch-patch.h
Chris J Arges b64ab2b5e4 livepatch-patch-hook: add support for livepatch sympos
Support patching objects that have duplicated function names. This feature was
introduced upstream in Linux v4.5.

This patch appends the symbol position to the symbol structure when
lookup_local_symbol is called. This pos variable is then used when creating the
funcs and dynrelas sections. Finally, incorporate sympos into the livepatch
patch hook only if the kernel version is greater than v4.5. In other cases the
older format is used.

Fixes: #493

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
2016-02-16 10:31:44 -06:00

52 lines
1.3 KiB
C

/*
* kpatch-patch.h
*
* Copyright (C) 2014 Josh Poimboeuf <jpoimboe@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*
* Contains the structs used for the patch module special sections
*/
#ifndef _KPATCH_PATCH_H_
#define _KPATCH_PATCH_H_
struct kpatch_patch_func {
unsigned long new_addr;
unsigned long new_size;
unsigned long old_addr;
unsigned long old_size;
unsigned long sympos;
char *name;
char *objname;
};
struct kpatch_patch_dynrela {
unsigned long dest;
unsigned long src;
unsigned long type;
unsigned long sympos;
char *name;
char *objname;
int external;
int addend;
};
struct kpatch_patch_hook {
void (*hook)(void);
char *objname;
};
#endif /* _KPATCH_PATCH_H_ */