ivepatch: Fix several bugs found during replace set implementation
v2 cover ivepatch: Fix several bugs found during replace set implementation
These fixes were found while implementing the replace set series [0]. They are independent of that series and can be applied separately.
Changes:v1->v2:
- minor improvements and acked-by (Song)
- fix issues reported by sashiko
v1: https://lore.kernel.org/live-patching/[email protected]/
Yafang Shao (2):
livepatch: Fix wrong index in funcs cleanup error path
livepatch: Fix UAF of unregistered patch kobjects
include/linux/livepatch.h | 6 +++++ kernel/livepatch/core.c | 50 ++++++++++++++++++++++++++++++++++++--- scripts/livepatch/init.c | 2 +- 3 files changed, 54 insertions(+), 4 deletions(-)
Signature · 1 line
2.52.0
PATCH v2 1/2 livepatch: Fix wrong index in funcs cleanup error path
In the object allocation loop, when kzalloc() for funcs fails, the cleanup loop uses objs[i].funcs instead of objs[j].funcs. Since objs[i].funcs is still NULL at that point, it repeatedly calls kfree(NULL) and leaks all previously allocated funcs arrays.
--- scripts/livepatch/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/livepatch/init.c +1 -1
@@ -51,7 +51,7 @@ static int __init livepatch_mod_init(void)if (!funcs) { ret = -ENOMEM ;for (int j =0 ; j < i; j++) -kfree (objs[i].funcs); +kfree (objs[j].funcs); goto err_free_objs; }
Signature · 1 line
2.52.0
[tip: objtool/urgent] klp-build: Fix wrong index in funcs cleanup error path
The following commit has been merged into the objtool/urgent branch of tip:
The following commit has been merged into the objtool/urgent branch of tip:
Commit-ID: 4825ef699cda4c6f2f0586b17a5e225560481da6 Gitweb: https://git.kernel.org/tip/4825ef699cda4c6f2f0586b17a5e225560481da6 Author: Yafang Shao <[email protected]> AuthorDate: Sun, 16 Aug 2026 17:04:41 +08:00 Committer: Josh Poimboeuf <[email protected]> CommitterDate: Mon, 31 Aug 2026 17:50:06 -07:00
klp-build: Fix wrong index in funcs cleanup error path
In the object allocation loop, when kzalloc() for funcs fails, the cleanup loop uses objs[i].funcs instead of objs[j].funcs. Since objs[i].funcs is still NULL at that point, it repeatedly calls kfree(NULL) and leaks all previously allocated funcs arrays.
--- scripts/livepatch/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/livepatch/init.c +1 -1
@@ -51,7 +51,7 @@ static int __init livepatch_mod_init(void)if (!funcs) { ret = -ENOMEM ;for (int j =0 ; j < i; j++) -kfree (objs[i].funcs); +kfree (objs[j].funcs); goto err_free_objs; }
PATCH v2 2/2 livepatch: Fix UAF of unregistered patch kobjects
In reply to Yafang ShaoWhen klp_enable_patch() fails after klp_init_patch_early() has run, the error path calls klp_free_patch_start() and klp_free_patch_finish(). The former drops the references of all object and function kobjects via klp_free_objects(), the latter drops the patch kobject reference and waits for the patch kobject release only:
klp_free_patch_finish():
kobject_put(&patch->kobj);
wait_for_completion(&patch->finish);With CONFIG_DEBUG_KOBJECT_RELEASE enabled, kobject_put() does not release the kobject synchronously but schedules a delayed release with a random delay of up to 4 seconds (see kobject_release() in lib/kobject.c). Because klp_free_patch_finish() only waits for the patch kobject release, it may return while object and function kobject releases are still pending. The caller can then unload the livepatch module, which frees the klp_object and klp_func structures. The delayed kobject release callbacks later access this freed memory in kobject_cleanup(), resulting in a use-after-free.
This issue can occur in two scenarios:
1. The patch kobject was never added to sysfs (e.g., klp_init_patch() failed at kobject_add()). All child kobjects were only initialized via kobject_init() but never added to sysfs. They do not hold references to the patch kobject, so the patch kobject can be released independently, unblocking patch->finish before the child releases complete.
2. The patch kobject was added to sysfs, but a subsequent operation such as klp_add_nops() or klp_init_object() failed. Some child kobjects were initialized but not yet added to sysfs. These un-added children do not hold references to the patch kobject either, so the same race can occur.
Fix this by tracking all static kobject releases with a per-patch atomic counter (kobj_pending). klp_free_patch_start() counts the patch kobject plus all static object and function kobjects. klp_free_patch_finish() waits until kobj_pending reaches zero, ensuring all kobject releases have completed before the module is unloaded.
Dynamic objects and nop functions are excluded from the count because they are freed by their release callbacks (which call kfree) and only exist when the patch kobject was successfully added to sysfs. For patches fully added to sysfs, the kobject parent-child reference chain ensures the patch kobject is released last, so kobj_pending naturally reaches zero when the patch kobject is released. For patches with partial initialization failures, kobj_pending ensures all un-added kobject releases are tracked regardless of release order.
The release callbacks use early return after kfree() for dynamic/nop kobjects to avoid dereferencing freed memory. Static kobjects are not freed by their release callbacks, so accessing obj->patch or func->obj->patch is safe. Furthermore, static functions always belong to static objects, so func->obj is never freed by a release callback.
--- include/linux/livepatch.h | 6 +++++ kernel/livepatch/core.c | 50 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-)
include/linux/livepatch.h +6 -0
@@ -33,6 +33,7 @@* @kobj: kobject for sysfs resources * @node: list node for klp_object func_list * @stack_node: list node for klp_ops func_stack list +* @obj: back pointer to the owning object * @old_size: size of the old function * @new_size: size of the new function * @nop: temporary patch to use the original code again; dyn. allocated
@@ -72,6 +73,7 @@ struct klp_func {struct kobject kobj;struct list_head node;struct list_head stack_node; +struct klp_object *obj;unsigned long old_size, new_size;bool nop;bool patched;
@@ -86,6 +88,7 @@ struct klp_func {* @kobj: kobject for sysfs resources * @func_list: dynamic list of the function entries * @node: list node for klp_patch obj_list +* @patch: back pointer to the owning patch * @mod: kernel module associated with the patched object * (NULL for vmlinux) * @dynamic: temporary object for nop functions; dynamically allocated
@@ -101,6 +104,7 @@ struct klp_object {struct kobject kobj;struct list_head func_list;struct list_head node; +struct klp_patch *patch;struct module *mod;bool dynamic;bool patched;
@@ -127,6 +131,7 @@ struct klp_state {* @list: list node for global list of actively used patches * @kobj: kobject for sysfs resources * @obj_list: dynamic list of the object entries +* @kobj_pending: number of kobjects awaiting release * @enabled: the patch is enabled (but operation may be incomplete) * @forced: was involved in a forced transition * @free_work: patch cleanup from workqueue-context
@@ -140,6 +145,7 @@ struct klp_patch {bool replace;/* internal */ +atomic_t kobj_pending;struct list_head list;struct kobject kobj;struct list_head obj_list;
kernel/livepatch/core.c +47 -3
105 lines not on this page · raw message
Signature · 1 line
2.52.0
Petr Mladek
maintainerRe: [PATCH v2 2/2] livepatch: Fix UAF of unregistered patch kobjects
Quoted 6 lines · Yafang Shao
When
klp_enable_patch()fails afterklp_init_patch_early()has run, the error path callsklp_free_patch_start()andklp_free_patch_finish(). The former drops the references of all object and function kobjects viaklp_free_objects(), the latter drops the patch kobject reference and waits for the patch kobject release only:
Quoted 8 lines
klp_free_patch_finish(): kobject_put(&patch->kobj); wait_for_completion(&patch->finish);With
CONFIG_DEBUG_KOBJECT_RELEASEenabled,kobject_put()does not release the kobject synchronously but schedules a delayed release with a random delay of up to 4 seconds (seekobject_release()inlib/kobject.c).
Yes.
Quoted 16 lines
Because
klp_free_patch_finish()only waits for the
patch kobject release, it may return while object and function kobject releases are still pending. The caller can then unload the livepatch module, which frees theklp_objectandklp_funcstructures. The delayed kobject release callbacks later access this freed memory inkobject_cleanup(), resulting in a use-after-free.This issue can occur in two scenarios:
1. The patch kobject was never added to sysfs (e.g.,
klp_init_patch()failed atkobject_add()). All child kobjects were only initialized viakobject_init()but never added to sysfs. They do not hold references to the patch kobject, so the patch kobject can be released independently, unblockingpatch->finishbefore the child releases complete.
Quoted 5 lines
2. The patch kobject was added to sysfs, but a subsequent operation such as
klp_add_nops()orklp_init_object()failed. Some child kobjects were initialized but not yet added to sysfs. These un-added children do not hold references to the patch kobject either, so the same race can occur.
In short, this says that the races might happen when some kobjects were not added into sysfs. Am I right, please?
I agree. My undestading:
The klp_kobj_release_*() callbacks are called by kobject_cleanup() which calls kobject_put(parent) as the last step. It should make sure that:
+ klp_kobj_release_patch() is scheduled/called only when
klp_kobj_release_object() has been called for all patch->objs.
+ klp_kobj_release_object() is scheduled/called only when
klp_kobj_release_func() has been called for all obj->funcs.
But it works only when "kobj->parent" is set and "parent->kref" has been incremented for each child before.
This is true only when kobject_add() is called for all all used kobjects. But it is not guaranteed when any klp_init_*() failed.
Quoted 6 lines
Fix this by tracking all static kobject releases with a per-patch atomic counter (
kobj_pending).klp_free_patch_start()counts the patch kobject plus all static object and function kobjects.klp_free_patch_finish()waits untilkobj_pendingreaches zero, ensuring all kobject releases have completed before the module is unloaded.
I think that we do not need an extra couter. We might use the existing kobj->kref. We just need to explicitely increment/decrement it.
I mean something like:
kernel/livepatch/core.c +6 -0
@@ -652,6 +652,8 @@ static void klp_kobj_release_object(struct kobject *kobj)if (obj->dynamic)klp_free_object_dynamic (obj); +else +kobject_put (&obj->patch.kobj); }static const struct kobj_type klp_ktype_object = {
@@ -668,6 +670,8 @@ static void klp_kobj_release_func(struct kobject *kobj)if (func->nop)klp_free_func_nop (func); +else +kobject_put (&func->obj.kobj); }static const struct kobj_type klp_ktype_func = {
@@ -946,6 +950,7 @@ static void klp_init_func_early(struct klp_object *obj, struct klp_func *func) {kobject_init (&func->kobj, &klp_ktype_func); +kobject_get (&obj->kobj);list_add_tail (&func->node, &obj->func_list); }
@@ -954,6 +959,7 @@ static void klp_init_object_early(struct klp_patch *patch, {INIT_LIST_HEAD (&obj->func_list);kobject_init (&obj->kobj, &klp_ktype_object); +kobject_get (&patch->kobj);list_add_tail (&obj->node, &patch->obj_list); }
We really would need to add the back references (obj->patch, func->obj) because we could not rely on kobj->parent. It is set only when kobject_add() was called...
That said, I doubt that livepatching is the only subsystem using kobjects in static structures. It might make sense to handle this on the kobject API level. I mean to add a kobject() API which would just set kobj->parent and increment kobj->kref and can't fail. But it seems to be against the existing philosophy of the kobject API. So, we might need the workaround after all.
Best Regards,
Petr
Re: [PATCH v2 2/2] livepatch: Fix UAF of unregistered patch kobjects
Quoted 35 lines · Petr Mladek
Quoted 6 lines · Yafang Shao
When
klp_enable_patch()fails afterklp_init_patch_early()has run, the error path callsklp_free_patch_start()andklp_free_patch_finish(). The former drops the references of all object and function kobjects viaklp_free_objects(), the latter drops the patch kobject reference and waits for the patch kobject release only:Quoted 8 lines
klp_free_patch_finish(): kobject_put(&patch->kobj); wait_for_completion(&patch->finish);With
CONFIG_DEBUG_KOBJECT_RELEASEenabled,kobject_put()does not release the kobject synchronously but schedules a delayed release with a random delay of up to 4 seconds (seekobject_release()inlib/kobject.c).Yes.
Quoted 16 lines
Because
klp_free_patch_finish()only waits for the
patch kobject release, it may return while object and function kobject releases are still pending. The caller can then unload the livepatch module, which frees theklp_objectandklp_funcstructures. The delayed kobject release callbacks later access this freed memory inkobject_cleanup(), resulting in a use-after-free.This issue can occur in two scenarios:
1. The patch kobject was never added to sysfs (e.g.,
klp_init_patch()failed atkobject_add()). All child kobjects were only initialized viakobject_init()but never added to sysfs. They do not hold references to the patch kobject, so the patch kobject can be released independently, unblockingpatch->finishbefore the child releases complete.
Quoted 8 lines
Quoted 5 lines
2. The patch kobject was added to sysfs, but a subsequent operation such as
klp_add_nops()orklp_init_object()failed. Some child kobjects were initialized but not yet added to sysfs. These un-added children do not hold references to the patch kobject either, so the same race can occur.In short, this says that the races might happen when some kobjects were not added into sysfs. Am I right, please?
right
Quoted 10 lines
I agree. My undestading:
The klp_kobj_release_*() callbacks are called by
kobject_cleanup()which callskobject_put(parent)as the last step. It should make sure that:+
klp_kobj_release_patch()is scheduled/called only whenklp_kobj_release_object() has been called for all patch->objs.
Quoted 8 lines
+
klp_kobj_release_object()is scheduled/called only whenklp_kobj_release_func() has been called for all obj->funcs.But it works only when "
kobj->parent" is set and "parent->kref" has been incremented for each child before.This is true only when
kobject_add()is called for all all used kobjects. But it is not guaranteed when any klp_init_*() failed.
correct
Quoted 11 lines
Quoted 7 lines
Fix this by tracking all static kobject releases with a per-patch atomic counter (
kobj_pending).klp_free_patch_start()counts the patch kobject plus all static object and function kobjects.klp_free_patch_finish()waits untilkobj_pendingreaches zero, ensuring all kobject releases have completed before the module is unloaded.I think that we do not need an extra couter. We might use the existing
kobj->kref. We just need to explicitely increment/decrement it.
good idea
Quoted 8 lines
I mean something like:
kernel/livepatch/core.c +0
-0
kernel/livepatch/core.c static void klp_kobj_release_object(struct kobject *kobj) · line 657
Quoted 6 lines
kernel/livepatch/core.c +2
-0@@ -652,6 +652,8 @@ static void klp_kobj_release_object(struct kobject *kobj)if (obj->dynamic)klp_free_object_dynamic (obj); +else +kobject_put (&obj->patch.kobj); }
It appears that klp_init_object_early() also initializes non-dynamic objects, right?
Therefore, we should call kobject_put() unconditionally.
static void klp_kobj_release_object(struct kobject *kobj)
{
struct klp_object *obj;+ struct klp_patch *patch;
obj = container_of(kobj, struct klp_object, kobj);
+ patch = obj->patch;
if (obj->dynamic)
klp_free_object_dynamic(obj);+
+ kobject_put(&patch->kobj);
}
kernel/livepatch/core.c static void klp_kobj_release_func(struct kobject *kobj) · line 675
Quoted 9 lines
kernel/livepatch/core.c +2
-0static const struct kobj_type klp_ktype_object = {@@ -668,6 +670,8 @@ static void klp_kobj_release_func(struct kobject *kobj)if (func->nop)klp_free_func_nop (func); +else +kobject_put (&func->obj.kobj); }
Similarly, klp_init_func_early() initializes the nop function, so kobject_put() must be called unconditionally.
static void klp_kobj_release_func(struct kobject *kobj)
{
struct klp_func *func;+ struct klp_object *obj;
func = container_of(kobj, struct klp_func, kobj);
+ obj = func->obj;
if (func->nop)
klp_free_func_nop(func);+
+ kobject_put(&obj->kobj);
}
Quoted 28 lines
kernel/livepatch/core.c +2
-0static const struct kobj_type klp_ktype_func = {@@ -946,6 +950,7 @@ static void klp_init_func_early(struct klp_object *obj, struct klp_func *func) {kobject_init (&func->kobj, &klp_ktype_func); +kobject_get (&obj->kobj);list_add_tail (&func->node, &obj->func_list); }@@ -954,6 +959,7 @@ static void klp_init_object_early(struct klp_patch *patch, {INIT_LIST_HEAD (&obj->func_list);kobject_init (&obj->kobj, &klp_ktype_object); +kobject_get (&patch->kobj);list_add_tail (&obj->node, &patch->obj_list); }We really would need to add the back references (
obj->patch,func->obj) because we could not rely onkobj->parent. It is set only whenkobject_add()was called...That said, I doubt that livepatching is the only subsystem using kobjects in static structures. It might make sense to handle this on the kobject API level. I mean to add a
kobject()API which would just setkobj->parentand incrementkobj->krefand can't fail. But it seems to be against the existing philosophy of the kobject API. So, we might need the workaround after all.
Signature · 2 lines
Regards Yafang
Petr Mladek
maintainerRe: [PATCH v2 2/2] livepatch: Fix UAF of unregistered patch kobjects
Quoted 91 lines · Yafang Shao
Quoted 35 lines · Petr Mladek
Quoted 6 lines · Yafang Shao
When
klp_enable_patch()fails afterklp_init_patch_early()has run, the error path callsklp_free_patch_start()andklp_free_patch_finish(). The former drops the references of all object and function kobjects viaklp_free_objects(), the latter drops the patch kobject reference and waits for the patch kobject release only:Quoted 8 lines
klp_free_patch_finish(): kobject_put(&patch->kobj); wait_for_completion(&patch->finish);With
CONFIG_DEBUG_KOBJECT_RELEASEenabled,kobject_put()does not release the kobject synchronously but schedules a delayed release with a random delay of up to 4 seconds (seekobject_release()inlib/kobject.c).Yes.
Quoted 16 lines
Because
klp_free_patch_finish()only waits for the
patch kobject release, it may return while object and function kobject releases are still pending. The caller can then unload the livepatch module, which frees theklp_objectandklp_funcstructures. The delayed kobject release callbacks later access this freed memory inkobject_cleanup(), resulting in a use-after-free.This issue can occur in two scenarios:
1. The patch kobject was never added to sysfs (e.g.,
klp_init_patch()failed atkobject_add()). All child kobjects were only initialized viakobject_init()but never added to sysfs. They do not hold references to the patch kobject, so the patch kobject can be released independently, unblockingpatch->finishbefore the child releases complete.Quoted 8 lines
Quoted 5 lines
2. The patch kobject was added to sysfs, but a subsequent operation such as
klp_add_nops()orklp_init_object()failed. Some child kobjects were initialized but not yet added to sysfs. These un-added children do not hold references to the patch kobject either, so the same race can occur.In short, this says that the races might happen when some kobjects were not added into sysfs. Am I right, please?
right
Quoted 10 lines
I agree. My undestading:
The klp_kobj_release_*() callbacks are called by
kobject_cleanup()which callskobject_put(parent)as the last step. It should make sure that:+
klp_kobj_release_patch()is scheduled/called only whenklp_kobj_release_object() has been called for all patch->objs.Quoted 8 lines
+
klp_kobj_release_object()is scheduled/called only whenklp_kobj_release_func() has been called for all obj->funcs.But it works only when "
kobj->parent" is set and "parent->kref" has been incremented for each child before.This is true only when
kobject_add()is called for all all used kobjects. But it is not guaranteed when any klp_init_*() failed.correct
Quoted 11 lines
Quoted 7 lines
Fix this by tracking all static kobject releases with a per-patch atomic counter (
kobj_pending).klp_free_patch_start()counts the patch kobject plus all static object and function kobjects.klp_free_patch_finish()waits untilkobj_pendingreaches zero, ensuring all kobject releases have completed before the module is unloaded.I think that we do not need an extra couter. We might use the existing
kobj->kref. We just need to explicitely increment/decrement it.good idea
Quoted 9 lines
I mean something like:
kernel/livepatch/core.c +0
-0@@ -652,6 +652,8 @@ static void klp_kobj_release_object(struct kobject *kobj)
Quoted 8 lines
kernel/livepatch/core.c static void klp_kobj_release_object(struct kobject *kobj) · line 657
Quoted 5 lines
kernel/livepatch/core.c +2
-0if (obj->dynamic)klp_free_object_dynamic (obj); +else +kobject_put (&obj->patch.kobj); }It appears that
klp_init_object_early()also initializes non-dynamic objects, right?
I was a bit confused by the sentence. The dynamic objects do not exist when klp_init_object_early() is called in klp_init_patch_early().
But I see that it is called also in klp_alloc_object_dynamic().
Quoted 1 line
Therefore, we should call
kobject_put()unconditionally.
Great catch. Yes, we should call it unconditionally.
Review
Quoted 13 lines
static void
klp_kobj_release_object(struct kobject *kobj){ struct klp_object *obj;(quoted diff) +4
-0+ struct klp_patch *patch; obj = container_of(kobj, struct klp_object, kobj); + patch = obj->patch; if (obj->dynamic) klp_free_object_dynamic(obj); + + kobject_put(&patch->kobj); }
Looks good. Same with klp_kobj_release_func().
Best Regards,
Petr
Petr Mladek
maintainerQuoted 10 lines · Yafang Shao
These fixes were found while implementing the replace set series [0]. They are independent of that series and can be applied separately.
Changes:
v1->v2:
- minor improvements and acked-by (Song)
- fix issues reported by sashiko
Quoted 4 lines
v1: https://lore.kernel.org/live-patching/[email protected]/
Yafang Shao (2):
livepatch: Fix wrong index in funcs cleanup error path
This patch is against scripts/livepatch/init.c which is part of klp-build framework. The klp-build-related changes usually go via the "tip" tree by Josh.
Quoted 1 line
livepatch: Fix UAF of unregistered patch kobjects
This patch is against the kernel/livepatch/* code. These changes usually go via the "livepatching" tree by me.
Honestly, I am not sure how to handle this situation. Josh?
Anyway, the 1st patch seems to be ready to go.
The 2nd patch might need some more love. I am going to comment on it...
Best Regards,
Petr
Josh Poimboeuf
maintainerQuoted 20 lines · Petr Mladek
Quoted 10 lines · Yafang Shao
These fixes were found while implementing the replace set series [0]. They are independent of that series and can be applied separately.
Changes:
v1->v2:
- minor improvements and acked-by (Song)
- fix issues reported by sashikoQuoted 4 lines
v1: https://lore.kernel.org/live-patching/[email protected]/
Yafang Shao (2):
livepatch: Fix wrong index in funcs cleanup error pathThis patch is against
scripts/livepatch/init.cwhich is part of klp-build framework. The klp-build-related changes usually go via the "tip" tree by Josh.
Quoted 7 lines
Quoted 1 line
livepatch: Fix UAF of unregistered patch kobjects
This patch is against the
kernel/livepatch/*code. These changes usually go via the "livepatching" tree by me.Honestly, I am not sure how to handle this situation. Josh?
The scripts/livepatch changes have tended to be tied to objtool, which is why they have gone through the tip tree.
I'm open to suggestions or ideas. We could possibly rename or move that scripts/livepatch directory (scripts/klp-build/? tools/objtool/klp-build/?) if that makes the boundary less confusing.
Or might there be some other maintainership model or way of splitting up the files?
In any case, I'll go ahead and queue up patch 1 for tip for now.
Signature · 1 line
Josh
Quoted 33 lines · Josh Poimboeuf
Quoted 20 lines · Petr Mladek
Quoted 10 lines · Yafang Shao
These fixes were found while implementing the replace set series [0]. They are independent of that series and can be applied separately.
Changes:
v1->v2:
- minor improvements and acked-by (Song)
- fix issues reported by sashikoQuoted 4 lines
v1: https://lore.kernel.org/live-patching/[email protected]/
Yafang Shao (2):
livepatch: Fix wrong index in funcs cleanup error pathThis patch is against
scripts/livepatch/init.cwhich is part of klp-build framework. The klp-build-related changes usually go via the "tip" tree by Josh.Quoted 7 lines
Quoted 1 line
livepatch: Fix UAF of unregistered patch kobjects
This patch is against the
kernel/livepatch/*code. These changes usually go via the "livepatching" tree by me.Honestly, I am not sure how to handle this situation. Josh?
The
scripts/livepatchchanges have tended to be tied to objtool, which is why they have gone through the tip tree.
Quoted 6 lines
I'm open to suggestions or ideas. We could possibly rename or move that
scripts/livepatchdirectory (scripts/klp-build/?tools/objtool/klp-build/?) if that makes the boundary less confusing.Or might there be some other maintainership model or way of splitting up the files?
My replace set series [0] touches both kernel/livepatch and scripts/livepatch; I'm not sure whether that would cause conflicts.
Quoted 2 lines
In any case, I'll go ahead and queue up patch 1 for tip for now.
Thanks. I will send a new version excluding patch 1.
Signature · 2 lines
Regards Yafang
Petr Mladek
maintainerQuoted 23 lines · Josh Poimboeuf
Quoted 22 lines · Petr Mladek
Quoted 10 lines · Yafang Shao
These fixes were found while implementing the replace set series [0]. They are independent of that series and can be applied separately.
Changes:
v1->v2:
- minor improvements and acked-by (Song)
- fix issues reported by sashikoQuoted 4 lines
v1: https://lore.kernel.org/live-patching/[email protected]/
Yafang Shao (2):
livepatch: Fix wrong index in funcs cleanup error pathThis patch is against
scripts/livepatch/init.cwhich is part of klp-build framework. The klp-build-related changes usually go via the "tip" tree by Josh.Quoted 1 line
livepatch: Fix UAF of unregistered patch kobjects
Quoted 8 lines
Quoted 5 lines
This patch is against the
kernel/livepatch/*code. These changes usually go via the "livepatching" tree by me.Honestly, I am not sure how to handle this situation. Josh?
The
scripts/livepatchchanges have tended to be tied to objtool, which is why they have gone through the tip tree.
Yup.
Quoted 3 lines
I'm open to suggestions or ideas. We could possibly rename or move that
scripts/livepatchdirectory (scripts/klp-build/?tools/objtool/klp-build/?) if that makes the boundary less confusing.
I like the idea with klp-build name. It might help people to distinguish the two areas.
Quoted 2 lines
Or might there be some other maintainership model or way of splitting up the files?
I guess that we need to keep the core livepatching code and klp-build stuff separated because klp-build is very tight with objtool and objtool is tight with arch code, ...
It might help to crate KLP BUILD section in MAINTAINERS. It would point to the tip tree. You would be the maintainer. And other livepatch people, including live-patching mailing list, might stay as reviewers.
Quoted 1 line
In any case, I'll go ahead and queue up patch 1 for tip for now.
Thanks a lot.
Best Regards,
Petr