kpatch/kmod/patch/kpatch-patch.h
Joe Lawrence 926e4e0c7d kmod: add support for in-kernel livepatch hooks
Upstream 4.15 kernels provide support for pre and post (un)patch
callbacks, inspired by the kpatch load hooks.  Add support for them
in the livepatch-patch-hook.

At the same time, convert the kpatch hooks to use the same API.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2018-03-23 10:32:14 -04:00

64 lines
1.6 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_pre_patch_callback {
int (*callback)(void *obj);
char *objname;
};
struct kpatch_post_patch_callback {
void (*callback)(void *obj);
char *objname;
};
struct kpatch_pre_unpatch_callback {
void (*callback)(void *obj);
char *objname;
};
struct kpatch_post_unpatch_callback {
void (*callback)(void *obj);
char *objname;
};
#endif /* _KPATCH_PATCH_H_ */