[PATCH 2/2] livepatch: Allow loading modules on architectures without HAVE_RELIABLE_STACKTRACE

From: Miroslav Benes
Date: Fri Dec 08 2017 - 12:25:48 EST


Now that immediate feature was removed, it is not possible to load
livepatch modules on architectures without HAVE_RELIABLE_STACKTRACE. Fix
it by removing guilty check in klp_register_patch().

The architectures without HAVE_RELIABLE_STACKTRACE will now rely only on
kernelspace/userspace boundary switching, the (fake) signal and force
feature.

Also remove the check from all sample modules.

Signed-off-by: Miroslav Benes <mbenes@xxxxxxx>
---
kernel/livepatch/core.c | 6 ++----
samples/livepatch/livepatch-callbacks-demo.c | 3 ---
samples/livepatch/livepatch-sample.c | 3 ---
samples/livepatch/livepatch-shadow-fix1.c | 3 ---
samples/livepatch/livepatch-shadow-fix2.c | 3 ---
5 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 461c0b7dc913..fa7e33aeb2a6 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -890,10 +890,8 @@ int klp_register_patch(struct klp_patch *patch)
if (!klp_initialized())
return -ENODEV;

- if (!klp_have_reliable_stack()) {
- pr_err("This architecture doesn't have support for the livepatch consistency model.\n");
- return -ENOSYS;
- }
+ if (!klp_have_reliable_stack())
+ pr_notice("This architecture doesn't have full support for the livepatch consistency model. The transition may not finish.\n");

return klp_init_patch(patch);
}
diff --git a/samples/livepatch/livepatch-callbacks-demo.c b/samples/livepatch/livepatch-callbacks-demo.c
index bda7f3841f3e..72f9e6d1387b 100644
--- a/samples/livepatch/livepatch-callbacks-demo.c
+++ b/samples/livepatch/livepatch-callbacks-demo.c
@@ -197,9 +197,6 @@ static int livepatch_callbacks_demo_init(void)
{
int ret;

- if (!klp_have_reliable_stack())
- pr_notice("The consistency model isn't supported for your architecture. The transition may not finish.\n");
-
ret = klp_register_patch(&patch);
if (ret)
return ret;
diff --git a/samples/livepatch/livepatch-sample.c b/samples/livepatch/livepatch-sample.c
index a150fca6f7cd..2d554dd930e2 100644
--- a/samples/livepatch/livepatch-sample.c
+++ b/samples/livepatch/livepatch-sample.c
@@ -71,9 +71,6 @@ static int livepatch_init(void)
{
int ret;

- if (!klp_have_reliable_stack())
- pr_notice("The consistency model isn't supported for your architecture. The transition may not finish.\n");
-
ret = klp_register_patch(&patch);
if (ret)
return ret;
diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c
index 415db31aca8d..830c55514f9f 100644
--- a/samples/livepatch/livepatch-shadow-fix1.c
+++ b/samples/livepatch/livepatch-shadow-fix1.c
@@ -133,9 +133,6 @@ static int livepatch_shadow_fix1_init(void)
{
int ret;

- if (!klp_have_reliable_stack())
- pr_notice("The consistency model isn't supported for your architecture. The transition may not finish.\n");
-
ret = klp_register_patch(&patch);
if (ret)
return ret;
diff --git a/samples/livepatch/livepatch-shadow-fix2.c b/samples/livepatch/livepatch-shadow-fix2.c
index 04b3fe23bfd3..ff9948f0ec00 100644
--- a/samples/livepatch/livepatch-shadow-fix2.c
+++ b/samples/livepatch/livepatch-shadow-fix2.c
@@ -128,9 +128,6 @@ static int livepatch_shadow_fix2_init(void)
{
int ret;

- if (!klp_have_reliable_stack())
- pr_notice("The consistency model isn't supported for your architecture. The transition may not finish.\n");
-
ret = klp_register_patch(&patch);
if (ret)
return ret;
--
2.15.1