diff mbox

[v3,03/15] livepatch: temporary stubs for klp_patch_pending() and klp_update_patch_state()

Message ID 26bb2315093328bf31e94fdd6eec61c341a6e924.1481220077.git.jpoimboe@redhat.com (mailing list archive)
State Superseded
Headers show

Commit Message

Josh Poimboeuf Dec. 8, 2016, 6:08 p.m. UTC
Create temporary stubs for klp_patch_pending() and
klp_update_patch_state() so we can add TIF_PATCH_PENDING to different
architectures in separate patches without breaking build bisectability.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/livepatch.h | 7 ++++++-
 kernel/livepatch/core.c   | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Petr Mladek Dec. 16, 2016, 2:41 p.m. UTC | #1
On Thu 2016-12-08 12:08:28, Josh Poimboeuf wrote:
> Create temporary stubs for klp_patch_pending() and
> klp_update_patch_state() so we can add TIF_PATCH_PENDING to different
> architectures in separate patches without breaking build bisectability.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  include/linux/livepatch.h | 7 ++++++-
>  kernel/livepatch/core.c   | 3 +++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> index 9072f04..60558d8 100644
> --- a/include/linux/livepatch.h
> +++ b/include/linux/livepatch.h
> @@ -123,10 +123,15 @@ void arch_klp_init_object_loaded(struct klp_patch *patch,
>  int klp_module_coming(struct module *mod);
>  void klp_module_going(struct module *mod);
>  
> +static inline bool klp_patch_pending(struct task_struct *task) { return false; }

I was curious about this. It is implemented correctly in the 13th
patch and it is never used until 13th patch.

> +void klp_update_patch_state(struct task_struct *task);

It seems that the stub for this function is enough.

Well, the extra function is just a cosmetic problem. If it could be
fixed, it would be great. But the patch makes sense:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr
Josh Poimboeuf Dec. 16, 2016, 10:15 p.m. UTC | #2
On Fri, Dec 16, 2016 at 03:41:59PM +0100, Petr Mladek wrote:
> On Thu 2016-12-08 12:08:28, Josh Poimboeuf wrote:
> > Create temporary stubs for klp_patch_pending() and
> > klp_update_patch_state() so we can add TIF_PATCH_PENDING to different
> > architectures in separate patches without breaking build bisectability.
> > 
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > ---
> >  include/linux/livepatch.h | 7 ++++++-
> >  kernel/livepatch/core.c   | 3 +++
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> > index 9072f04..60558d8 100644
> > --- a/include/linux/livepatch.h
> > +++ b/include/linux/livepatch.h
> > @@ -123,10 +123,15 @@ void arch_klp_init_object_loaded(struct klp_patch *patch,
> >  int klp_module_coming(struct module *mod);
> >  void klp_module_going(struct module *mod);
> >  
> > +static inline bool klp_patch_pending(struct task_struct *task) { return false; }
> 
> I was curious about this. It is implemented correctly in the 13th
> patch and it is never used until 13th patch.

Yep, I'll move it to patch 13.

> 
> > +void klp_update_patch_state(struct task_struct *task);
> 
> It seems that the stub for this function is enough.
> 
> Well, the extra function is just a cosmetic problem. If it could be
> fixed, it would be great. But the patch makes sense:
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> 
> Best Regards,
> Petr
>
diff mbox

Patch

diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 9072f04..60558d8 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -123,10 +123,15 @@  void arch_klp_init_object_loaded(struct klp_patch *patch,
 int klp_module_coming(struct module *mod);
 void klp_module_going(struct module *mod);
 
+static inline bool klp_patch_pending(struct task_struct *task) { return false; }
+void klp_update_patch_state(struct task_struct *task);
+
 #else /* !CONFIG_LIVEPATCH */
 
 static inline int klp_module_coming(struct module *mod) { return 0; }
-static inline void klp_module_going(struct module *mod) { }
+static inline void klp_module_going(struct module *mod) {}
+static inline bool klp_patch_pending(struct task_struct *task) { return false; }
+static inline void klp_update_patch_state(struct task_struct *task) {}
 
 #endif /* CONFIG_LIVEPATCH */
 
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index af46438..217b39d 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -64,6 +64,9 @@  static LIST_HEAD(klp_ops);
 
 static struct kobject *klp_root_kobj;
 
+/* TODO: temporary stub */
+void klp_update_patch_state(struct task_struct *task) {}
+
 static struct klp_ops *klp_find_ops(unsigned long old_addr)
 {
 	struct klp_ops *ops;