linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lkdtm: Fix Oops when unloading the module
@ 2017-01-19 10:40 Juerg Haefliger
  2017-01-19 22:03 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Juerg Haefliger @ 2017-01-19 10:40 UTC (permalink / raw)
  To: keescook, linux-kernel; +Cc: Juerg Haefliger

No jprobe is registered when the module is loaded without specifying a
crashpoint that uses a jprobe. At the moment, we unconditionally try to
unregister the jprobe on module unload which results in an Oops. Add a
check to fix this.

Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
---
 drivers/misc/lkdtm_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
index 7eeb71a75549..4d44084071d8 100644
--- a/drivers/misc/lkdtm_core.c
+++ b/drivers/misc/lkdtm_core.c
@@ -535,7 +535,9 @@ static void __exit lkdtm_module_exit(void)
 	/* Handle test-specific clean-up. */
 	lkdtm_usercopy_exit();
 
-	unregister_jprobe(lkdtm_jprobe);
+	if (lkdtm_jprobe != NULL)
+		unregister_jprobe(lkdtm_jprobe);
+
 	pr_info("Crash point unregistered\n");
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lkdtm: Fix Oops when unloading the module
  2017-01-19 10:40 [PATCH] lkdtm: Fix Oops when unloading the module Juerg Haefliger
@ 2017-01-19 22:03 ` Kees Cook
  2017-01-20 10:01   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2017-01-19 22:03 UTC (permalink / raw)
  To: Juerg Haefliger, Greg KH; +Cc: LKML

On Thu, Jan 19, 2017 at 2:40 AM, Juerg Haefliger
<juerg.haefliger@hpe.com> wrote:
> No jprobe is registered when the module is loaded without specifying a
> crashpoint that uses a jprobe. At the moment, we unconditionally try to
> unregister the jprobe on module unload which results in an Oops. Add a
> check to fix this.
>
> Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>

Ah-ha, nice catch, thanks!

Acked-by: Kees Cook <keescook@chromium.org>

Greg, can you please add this to your tree when you get a chance?

-Kees

> ---
>  drivers/misc/lkdtm_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
> index 7eeb71a75549..4d44084071d8 100644
> --- a/drivers/misc/lkdtm_core.c
> +++ b/drivers/misc/lkdtm_core.c
> @@ -535,7 +535,9 @@ static void __exit lkdtm_module_exit(void)
>         /* Handle test-specific clean-up. */
>         lkdtm_usercopy_exit();
>
> -       unregister_jprobe(lkdtm_jprobe);
> +       if (lkdtm_jprobe != NULL)
> +               unregister_jprobe(lkdtm_jprobe);
> +
>         pr_info("Crash point unregistered\n");
>  }
>
> --
> 2.11.0
>



-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lkdtm: Fix Oops when unloading the module
  2017-01-19 22:03 ` Kees Cook
@ 2017-01-20 10:01   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-01-20 10:01 UTC (permalink / raw)
  To: Kees Cook; +Cc: Juerg Haefliger, LKML

On Thu, Jan 19, 2017 at 02:03:11PM -0800, Kees Cook wrote:
> On Thu, Jan 19, 2017 at 2:40 AM, Juerg Haefliger
> <juerg.haefliger@hpe.com> wrote:
> > No jprobe is registered when the module is loaded without specifying a
> > crashpoint that uses a jprobe. At the moment, we unconditionally try to
> > unregister the jprobe on module unload which results in an Oops. Add a
> > check to fix this.
> >
> > Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
> 
> Ah-ha, nice catch, thanks!
> 
> Acked-by: Kees Cook <keescook@chromium.org>
> 
> Greg, can you please add this to your tree when you get a chance?

Will do, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-20 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19 10:40 [PATCH] lkdtm: Fix Oops when unloading the module Juerg Haefliger
2017-01-19 22:03 ` Kees Cook
2017-01-20 10:01   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).