mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-24 05:01:03 +02:00
livepatch: introduce shadow variable API
Add exported API for livepatch modules: klp_shadow_get() klp_shadow_alloc() klp_shadow_get_or_alloc() klp_shadow_free() klp_shadow_free_all() that implement "shadow" variables, which allow callers to associate new shadow fields to existing data structures. This is intended to be used by livepatch modules seeking to emulate additions to data structure definitions. See Documentation/livepatch/shadow-vars.txt for a summary of the new shadow variable API, including a few common use cases. See samples/livepatch/livepatch-shadow-* for example modules that demonstrate shadow variables. [jkosina@suse.cz: fix __klp_shadow_get_or_alloc() comment as spotted by Josh] Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
committed by
Jiri Kosina
parent
dcba71086e
commit
439e7271dc
@@ -164,6 +164,14 @@ static inline bool klp_have_reliable_stack(void)
|
||||
IS_ENABLED(CONFIG_HAVE_RELIABLE_STACKTRACE);
|
||||
}
|
||||
|
||||
void *klp_shadow_get(void *obj, unsigned long id);
|
||||
void *klp_shadow_alloc(void *obj, unsigned long id, void *data,
|
||||
size_t size, gfp_t gfp_flags);
|
||||
void *klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data,
|
||||
size_t size, gfp_t gfp_flags);
|
||||
void klp_shadow_free(void *obj, unsigned long id);
|
||||
void klp_shadow_free_all(unsigned long id);
|
||||
|
||||
#else /* !CONFIG_LIVEPATCH */
|
||||
|
||||
static inline int klp_module_coming(struct module *mod) { return 0; }
|
||||
|
Reference in New Issue
Block a user