Skip to contentSkip to conversation

disable/enable_patch manners for interdependent patches

PATCH In review Li Bin 5 participants 16 messages Jan 21, 2015 – Jan 23, 2015 Live patching

lore
Share & tools
lore

Li Bin

author
#0 lore raw

cover disable/enable_patch manners for interdependent patches

Revert commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17
and introduce disable/enable_patch manners for interdependent patches

for disable_patch:
The patch is unallowed to be disabled if one patch after has dependencies with it and has been enabled.

for enable_patch:
The patch is unallowed to be enabled if one patch before has dependencies with it and has been disabled.
Li Bin (2):
livepatch: Revert "livepatch: enforce patch stacking semantics"
livepatch: disable/enable_patch manners for interdependent patches

 kernel/livepatch/core.c |   66 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 58 insertions(+), 8 deletions(-)
author
#1 lore raw

PATCH 1/2 livepatch: Revert "livepatch: enforce patch stacking semantics"

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

---
 kernel/livepatch/core.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
kernel/livepatch/core.c +0 -10
index bc05d39..7861ed2 100644
@@ -468,11 +468,6 @@ static int __klp_disable_patch(struct klp_patch *patch)
 	struct klp_object *obj;
 	int ret;
 
-	/* enforce stacking: only the last enabled patch can be disabled */
-	if (!list_is_last(&patch->list, &klp_patches) &&
-	    list_next_entry(patch, list)->state == KLP_ENABLED)
-		return -EBUSY;
-
 	pr_notice("disabling patch '%s'\n", patch->mod->name);
 
 	for (obj = patch->objs; obj->funcs; obj++) {
@@ -529,11 +524,6 @@ static int __klp_enable_patch(struct klp_patch *patch)
 	if (WARN_ON(patch->state != KLP_DISABLED))
 		return -EINVAL;
 
-	/* enforce stacking: only the first disabled patch can be enabled */
-	if (patch->list.prev != &klp_patches &&
-	    list_prev_entry(patch, list)->state == KLP_DISABLED)
-		return -EBUSY;
-
 	pr_notice_once("tainting kernel with TAINT_LIVEPATCH\n");
 	add_taint(TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
 
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

Quoted 11 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Unregistering disabled patch still works and removes it from the list no matter the position.

So what exactly is the problem?

Signature · 2 lines
Jiri Kosina
SUSE Labs
#3 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Quoted 6 lines

Unregistering disabled patch still works and removes it from the list no matter the position.

So what exactly is the problem?

From a quick glance, it seems that what this set does is it only

enforces the stacking requirements if two patches patch the same function.

I'm not sure if that is correct logically or correctly implemented by these patches yet.

Seth

Quoted 4 lines
Signature · 3 lines
-- 
Jiri Kosina
SUSE Labs
author
#4 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

Quoted 15 lines · Seth Jennings
Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Quoted 9 lines
Quoted 6 lines

Unregistering disabled patch still works and removes it from the list no matter the position.

So what exactly is the problem?

From a quick glance, it seems that what this set does is it only

enforces the stacking requirements if two patches patch the same function.

Yes, this patch is only concerning this case that 'multi patches patch the same function' and solve the problem that mentioned previously:

foo_unpatched()

	foo_patch1()
		foo_patch2()
			foo_patch3()
		disable(foo_patch2)
		disable(foo_patch3)
	foo_patch1()

foo_patch2 is not allowed to be disabled before disable foo_patch3.

Thanks,
Li Bin

Quoted 12 lines

I'm not sure if that is correct logically or correctly implemented by these patches yet.

Seth

Quoted 4 lines
Signature · 3 lines
-- 
Jiri Kosina
SUSE Labs

.

author
#5 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

In reply to Li Bin
Quoted 5 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

Quoted 7 lines

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Correct the log:
... unless disabling the patch1 although ... --> ... unless enabling the patch1 firstly although ...

Quoted 34 lines
---
 kernel/livepatch/core.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
kernel/livepatch/core.c +0 -10
index bc05d39..7861ed2 100644
@@ -468,11 +468,6 @@ static int __klp_disable_patch(struct klp_patch *patch)
 	struct klp_object *obj;
 	int ret;
 
-	/* enforce stacking: only the last enabled patch can be disabled */
-	if (!list_is_last(&patch->list, &klp_patches) &&
-	    list_next_entry(patch, list)->state == KLP_ENABLED)
-		return -EBUSY;
-
 	pr_notice("disabling patch '%s'\n", patch->mod->name);
 
 	for (obj = patch->objs; obj->funcs; obj++) {
@@ -529,11 +524,6 @@ static int __klp_enable_patch(struct klp_patch *patch)
 	if (WARN_ON(patch->state != KLP_DISABLED))
 		return -EINVAL;
 
-	/* enforce stacking: only the first disabled patch can be enabled */
-	if (patch->list.prev != &klp_patches &&
-	    list_prev_entry(patch, list)->state == KLP_DISABLED)
-		return -EBUSY;
-
 	pr_notice_once("tainting kernel with TAINT_LIVEPATCH\n");
 	add_taint(TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
 
maintainer
#6 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

Quoted 10 lines · Li Bin
Quoted 9 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Quoted 7 lines
Quoted 3 lines

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Correct the log:
... unless disabling the patch1 although ... --> ... unless enabling the patch1 firstly although ...

Yes, but in such situation you can unregister patch1 and proceed with new live patch. No problem. As Jiri has already written. Or are we missing something?

Regards,
--
Miroslav Benes
SUSE Labs

author
#7 lore raw

Re: [PATCH 1/2] livepatch: Revert "livepatch: enforce patch stacking semantics"

Quoted 16 lines · Miroslav Benes
Quoted 14 lines · Li Bin
Quoted 12 lines · Li Bin

This reverts commit 83a90bb1345767f0cb96d242fd8b9db44b2b0e17.

The method that only allowing the topmost patch on the stack to be enabled or disabled is unreasonable. Such as the following case:

- do live patch1
- disable patch1
- do live patch2 //error

Now, we will never be able to do new live patch unless disabing the patch1 although there is no dependencies.

Quoted 8 lines
Quoted 3 lines

Correct the log:
... unless disabling the patch1 although ... --> ... unless enabling the patch1 firstly although ...

Yes, but in such situation you can unregister patch1 and proceed with new live patch. No problem. As Jiri has already written. Or are we missing something?

Ok, that is before process with new live patch we must unregister the disabled patch1 previously. Is there need some message to avoid confusing the user?

Thanks,
Li Bin

Quoted 11 lines

Regards,
--
Miroslav Benes
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

.

author
#8 lore raw

PATCH 2/2 livepatch: disable/enable_patch manners for interdependent patches

In reply to Li Bin

for disable_patch:
The patch is unallowed to be disabled if one patch after has dependencies with it and has been enabled.

for enable_patch:
The patch is unallowed to be enabled if one patch before has dependencies with it and has been disabled.

---
 kernel/livepatch/core.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
kernel/livepatch/core.c +60 -0
index 7861ed2..a12a31c 100644
@@ -114,6 +114,21 @@ static bool klp_is_patch_registered(struct klp_patch *patch)
 	return false;
 }
 
+static bool klp_func_in_patch(struct klp_func *kfunc, struct klp_patch *patch)
+{
+	struct klp_object *obj;
+	struct klp_func *func;
+
+	for (obj = patch->objs; obj->funcs; obj++) {
+		for (func = obj->funcs; func->old_name; func++) {
+			if (kfunc->old_addr == func->old_addr) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
 static bool klp_initialized(void)
 {
 	return klp_root_kobj;
@@ -466,8 +481,31 @@ unregister:
 static int __klp_disable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
+	/*
+	 * the patch is unallowed to be disabled if one patch
+	 * after has dependencies with it and has been enabled.
+	 */
+	for (temp = list_next_entry(patch, list);
+			&temp->list != &klp_patches;
+			temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_ENABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please disable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;
+				}
+			}
+		}
+	}
+
 	pr_notice("disabling patch '%s'\n", patch->mod->name);
 
 	for (obj = patch->objs; obj->funcs; obj++) {
@@ -519,11 +557,33 @@ EXPORT_SYMBOL_GPL(klp_disable_patch);
 static int __klp_enable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
 	if (WARN_ON(patch->state != KLP_DISABLED))
 		return -EINVAL;
 
+	/*
+	 * the patch is unallowed to be enabled if one patch
+	 * before has dependencies with it and has been disabled.
+	 */
+	for (temp = list_first_entry(&klp_patches, struct klp_patch, list);
+			temp != patch; temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_DISABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please enable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;
+				}
+			}
+		}
+	}
+
 	pr_notice_once("tainting kernel with TAINT_LIVEPATCH\n");
 	add_taint(TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
 
Signature · 1 line
1.7.1
#9 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 87 lines · Li Bin

for disable_patch:
The patch is unallowed to be disabled if one patch after has dependencies with it and has been enabled.

for enable_patch:
The patch is unallowed to be enabled if one patch before has dependencies with it and has been disabled.

---
 kernel/livepatch/core.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
kernel/livepatch/core.c +45 -0
index 7861ed2..a12a31c 100644
@@ -114,6 +114,21 @@ static bool klp_is_patch_registered(struct klp_patch *patch)
 	return false;
 }
 
+static bool klp_func_in_patch(struct klp_func *kfunc, struct klp_patch *patch)
+{
+	struct klp_object *obj;
+	struct klp_func *func;
+
+	for (obj = patch->objs; obj->funcs; obj++) {
+		for (func = obj->funcs; func->old_name; func++) {
+			if (kfunc->old_addr == func->old_addr) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
 static bool klp_initialized(void)
 {
 	return klp_root_kobj;
@@ -466,8 +481,31 @@ unregister:
 static int __klp_disable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
+	/*
+	 * the patch is unallowed to be disabled if one patch
+	 * after has dependencies with it and has been enabled.
+	 */
+	for (temp = list_next_entry(patch, list);
+			&temp->list != &klp_patches;
+			temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_ENABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please disable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;
+				}
+			}
+		}
+	}
+
 	pr_notice("disabling patch '%s'\n", patch->mod->name);
 
 	for (obj = patch->objs; obj->funcs; obj++) {
@@ -519,11 +557,33 @@ EXPORT_SYMBOL_GPL(klp_disable_patch);
 static int __klp_enable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
 	if (WARN_ON(patch->state != KLP_DISABLED))
 		return -EINVAL;
 
+	/*
+	 * the patch is unallowed to be enabled if one patch
+	 * before has dependencies with it and has been disabled.
+	 */
+	for (temp = list_first_entry(&klp_patches, struct klp_patch, list);

kernel/livepatch/core.c EXPORT_SYMBOL_GPL(klp_disable_patch); · line 581

Quoted 10 lines
kernel/livepatch/core.c +10 -0
+			temp != patch; temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_DISABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please enable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;

By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Signature · 2 lines
Jiri Kosina
SUSE Labs
author
#10 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 95 lines · Jiri Kosina
Quoted 93 lines · Li Bin

for disable_patch:
The patch is unallowed to be disabled if one patch after has dependencies with it and has been enabled.

for enable_patch:
The patch is unallowed to be enabled if one patch before has dependencies with it and has been disabled.

---
 kernel/livepatch/core.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
kernel/livepatch/core.c +51 -0
index 7861ed2..a12a31c 100644
@@ -114,6 +114,21 @@ static bool klp_is_patch_registered(struct klp_patch *patch)
 	return false;
 }
 
+static bool klp_func_in_patch(struct klp_func *kfunc, struct klp_patch *patch)
+{
+	struct klp_object *obj;
+	struct klp_func *func;
+
+	for (obj = patch->objs; obj->funcs; obj++) {
+		for (func = obj->funcs; func->old_name; func++) {
+			if (kfunc->old_addr == func->old_addr) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
 static bool klp_initialized(void)
 {
 	return klp_root_kobj;
@@ -466,8 +481,31 @@ unregister:
 static int __klp_disable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
+	/*
+	 * the patch is unallowed to be disabled if one patch
+	 * after has dependencies with it and has been enabled.
+	 */
+	for (temp = list_next_entry(patch, list);
+			&temp->list != &klp_patches;
+			temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_ENABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please disable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;
+				}
+			}
+		}
+	}
+
 	pr_notice("disabling patch '%s'\n", patch->mod->name);
 
 	for (obj = patch->objs; obj->funcs; obj++) {
@@ -519,11 +557,33 @@ EXPORT_SYMBOL_GPL(klp_disable_patch);
 static int __klp_enable_patch(struct klp_patch *patch)
 {
 	struct klp_object *obj;
+	struct klp_patch *temp;
+	struct klp_func *func;
 	int ret;
 
 	if (WARN_ON(patch->state != KLP_DISABLED))
 		return -EINVAL;
 
+	/*
+	 * the patch is unallowed to be enabled if one patch
+	 * before has dependencies with it and has been disabled.
+	 */
+	for (temp = list_first_entry(&klp_patches, struct klp_patch, list);
+			temp != patch; temp = list_next_entry(temp, list)) {
+		if (temp->state != KLP_DISABLED)
+			continue;
+
+		for (obj = patch->objs; obj->funcs; obj++) {
+			for (func = obj->funcs; func->old_name; func++) {
Quoted 8 lines

kernel/livepatch/core.c EXPORT_SYMBOL_GPL(klp_disable_patch); · line 581

Quoted 4 lines
kernel/livepatch/core.c +4 -0
+				if (klp_func_in_patch(func, temp)) {
+					pr_err("this patch depends on '%s', please enable it firstly\n",
+						   temp->mod->name);
+					return -EBUSY;

By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

Thanks,
Li Bin

Quoted 1 line
#11 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 9 lines · Li Bin
Quoted 4 lines · Jiri Kosina

On Wed, 21 Jan 2015, Li Bin wrote:
By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

But with live patching, there are two users: the patch creator (who creates the patch module) and the end user (who loads it on their system).

We can assume the patch creator knows what he's doing, but the end user doesn't always know or care about low level details like patch dependencies. The easiest and safest way to protect the end user is the current approach, which assumes that each patch depends on all previously applied patches.

Signature · 1 line
Josh
author
#12 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 15 lines · Josh Poimboeuf
Quoted 9 lines · Li Bin
Quoted 4 lines · Jiri Kosina

On Wed, 21 Jan 2015, Li Bin wrote:
By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

But with live patching, there are two users: the patch creator (who creates the patch module) and the end user (who loads it on their system).

Quoted 5 lines

We can assume the patch creator knows what he's doing, but the end user doesn't always know or care about low level details like patch dependencies. The easiest and safest way to protect the end user is the current approach, which assumes that each patch depends on all previously applied patches.

But then, the feature that disable patch dynamically is useless. For example, if user find a bug be introduced by the last patch and disable it directly, the new patch is no longer allowed from now unless enable the old patch firstly but there is a risk window by this way.

Quoted 1 line
author
#13 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 22 lines · Li Bin
Quoted 15 lines · Josh Poimboeuf
Quoted 9 lines · Li Bin
Quoted 4 lines · Jiri Kosina

On Wed, 21 Jan 2015, Li Bin wrote:
By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

But with live patching, there are two users: the patch creator (who creates the patch module) and the end user (who loads it on their system).

Quoted 5 lines

We can assume the patch creator knows what he's doing, but the end user doesn't always know or care about low level details like patch dependencies. The easiest and safest way to protect the end user is the current approach, which assumes that each patch depends on all previously applied patches.

Quoted 5 lines

But then, the feature that disable patch dynamically is useless. For example, if user find a bug be introduced by the last patch and disable it directly, the new patch is no longer allowed from now unless enable the old patch firstly but there is a risk window by this way.

Ok, in this case we can unregister the old patch firstly.
But it seems that the feature that enable/disable patch dynamically indeed useless. (Its value is only for the last patch to enable or disable.)

Quoted 10 lines
Quoted 1 line

--
To unsubscribe from this list: send the line "unsubscribe live-patching" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

.

#14 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 29 lines · Li Bin
Quoted 22 lines · Li Bin
Quoted 15 lines · Josh Poimboeuf
Quoted 9 lines · Li Bin
Quoted 4 lines · Jiri Kosina

On Wed, 21 Jan 2015, Li Bin wrote:
By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

But with live patching, there are two users: the patch creator (who creates the patch module) and the end user (who loads it on their system).

Quoted 5 lines

We can assume the patch creator knows what he's doing, but the end user doesn't always know or care about low level details like patch dependencies. The easiest and safest way to protect the end user is the current approach, which assumes that each patch depends on all previously applied patches.

Quoted 5 lines

But then, the feature that disable patch dynamically is useless. For example, if user find a bug be introduced by the last patch and disable it directly, the new patch is no longer allowed from now unless enable the old patch firstly but there is a risk window by this way.

Quoted 3 lines

Ok, in this case we can unregister the old patch firstly.
But it seems that the feature that enable/disable patch dynamically indeed useless. (Its value is only for the last patch to enable or disable.)

I wouldn't say it's useless... It's just a patch stack. If there's a bug at the bottom of the stack, you can either:

1) push a new patch which does the opposite of the original patch (similar to how "git revert" adds a new commit);

2) or pop everything off the stack and create a new stack to your liking.

It doesn't actually prevent you from doing what you want, it just makes it less convenient (and more safe IMO).

I suppose an alternative would be to allow the patch creator to specify patch dependencies (in addition to something like your patch to catch the obvious dependencies). But dependencies are tricky and I'm not really convinced that would be worth the added risk and code complexity.

Signature · 1 line
Josh
author
#15 lore raw

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

Quoted 37 lines · Josh Poimboeuf
Quoted 29 lines · Li Bin
Quoted 22 lines · Li Bin
Quoted 15 lines · Josh Poimboeuf
Quoted 9 lines · Li Bin
Quoted 4 lines · Jiri Kosina

On Wed, 21 Jan 2015, Li Bin wrote:
By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the dependency can be semantical.

Yes, I agree with you. But I think the other dependencies such as semantical dependency should be judged by the user, like reverting a patch from git repository. Right?

But with live patching, there are two users: the patch creator (who creates the patch module) and the end user (who loads it on their system).

Quoted 5 lines

We can assume the patch creator knows what he's doing, but the end user doesn't always know or care about low level details like patch dependencies. The easiest and safest way to protect the end user is the current approach, which assumes that each patch depends on all previously applied patches.

Quoted 5 lines

But then, the feature that disable patch dynamically is useless. For example, if user find a bug be introduced by the last patch and disable it directly, the new patch is no longer allowed from now unless enable the old patch firstly but there is a risk window by this way.

Quoted 3 lines

Ok, in this case we can unregister the old patch firstly.
But it seems that the feature that enable/disable patch dynamically indeed useless. (Its value is only for the last patch to enable or disable.)

I wouldn't say it's useless... It's just a patch stack. If there's a bug at the bottom of the stack, you can either:

Quoted 9 lines

1) push a new patch which does the opposite of the original patch (similar to how "git revert" adds a new commit);

2) or pop everything off the stack and create a new stack to your liking.

It doesn't actually prevent you from doing what you want, it just makes it less convenient (and more safe IMO).

I am not arguing the value of the patch stack manner, but the sysfs attribute 'enabled'.

Quoted 4 lines

I suppose an alternative would be to allow the patch creator to specify patch dependencies (in addition to something like your patch to catch the obvious dependencies). But dependencies are tricky and I'm not really convinced that would be worth the added risk and code complexity.

Yes, since we can not assume that end users know the low level details, but they have permission to unregister the stacktop patch, and this action will affect the subsequent patch without providing dependencies information.

Quoted 1 line