All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-05 15:37 ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-05 15:37 UTC (permalink / raw)
  To: patches
  Cc: linux-kernel, Mathieu Desnoyers, Robert Berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, Kees Cook, Russell King, # v4 . 14+,
	linux-arm-kernel

commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
triggers "invalid instruction" oopses when using kprobes instrumentation
through lttng and perf. This commit was introduced in kernel v4.20, and
has been backported to stable kernels 4.19 and 4.14.

This crash was also reported by Hongzhi Song on the redhat bugzilla
where the patch was originally introduced.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
Link: https://bugs.lttng.org/issues/1174
Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Acked-by: Kees Cook <keescook@chromium.org>
CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Masami Hiramatsu <mhiramat@kernel.org>
CC: William Cohen <wcohen@redhat.com>
CC: Laura Abbott <labbott@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: <stable@vger.kernel.org> # v4.14+
CC: linux-arm-kernel@lists.infradead.org
CC: patches@armlinux.org.uk
---
KernelVersion: 5.0.0-rc5
 arch/arm/probes/kprobes/opt-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
 	}
 
 	/* Copy arch-dep-instance from template. */
-	memcpy(code, (unsigned char *)optprobe_template_entry,
+	memcpy(code, (unsigned long *)&optprobe_template_entry,
 			TMPL_END_IDX * sizeof(kprobe_opcode_t));
 
 	/* Adjust buffer according to instruction. */
-- 
2.11.0


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

* [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-05 15:37 ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-05 15:37 UTC (permalink / raw)
  To: patches
  Cc: Kees Cook, linux-kernel, # v4 . 14+,
	Russell King, Mathieu Desnoyers, Masami Hiramatsu, Robert Berger,
	William Cohen, Laura Abbott, linux-arm-kernel

commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
triggers "invalid instruction" oopses when using kprobes instrumentation
through lttng and perf. This commit was introduced in kernel v4.20, and
has been backported to stable kernels 4.19 and 4.14.

This crash was also reported by Hongzhi Song on the redhat bugzilla
where the patch was originally introduced.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
Link: https://bugs.lttng.org/issues/1174
Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Acked-by: Kees Cook <keescook@chromium.org>
CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Masami Hiramatsu <mhiramat@kernel.org>
CC: William Cohen <wcohen@redhat.com>
CC: Laura Abbott <labbott@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: <stable@vger.kernel.org> # v4.14+
CC: linux-arm-kernel@lists.infradead.org
CC: patches@armlinux.org.uk
---
KernelVersion: 5.0.0-rc5
 arch/arm/probes/kprobes/opt-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
 	}
 
 	/* Copy arch-dep-instance from template. */
-	memcpy(code, (unsigned char *)optprobe_template_entry,
+	memcpy(code, (unsigned long *)&optprobe_template_entry,
 			TMPL_END_IDX * sizeof(kprobe_opcode_t));
 
 	/* Adjust buffer according to instruction. */
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
  2019-02-05 15:37 ` Mathieu Desnoyers
@ 2019-02-06  4:39   ` Masami Hiramatsu
  -1 siblings, 0 replies; 9+ messages in thread
From: Masami Hiramatsu @ 2019-02-06  4:39 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: patches, linux-kernel, Robert Berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, Kees Cook, Russell King, # v4 . 14+,
	linux-arm-kernel

On Tue,  5 Feb 2019 10:37:40 -0500
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:

> commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
> FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
> triggers "invalid instruction" oopses when using kprobes instrumentation
> through lttng and perf. This commit was introduced in kernel v4.20, and
> has been backported to stable kernels 4.19 and 4.14.
> 
> This crash was also reported by Hongzhi Song on the redhat bugzilla
> where the patch was originally introduced.

Thank you for fixing this.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>


> 
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
> Link: https://bugs.lttng.org/issues/1174
> Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
> Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> Acked-by: Kees Cook <keescook@chromium.org>
> CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> CC: Masami Hiramatsu <mhiramat@kernel.org>
> CC: William Cohen <wcohen@redhat.com>
> CC: Laura Abbott <labbott@redhat.com>
> CC: Kees Cook <keescook@chromium.org>
> CC: Russell King <rmk+kernel@armlinux.org.uk>
> CC: <stable@vger.kernel.org> # v4.14+
> CC: linux-arm-kernel@lists.infradead.org
> CC: patches@armlinux.org.uk
> ---
> KernelVersion: 5.0.0-rc5
>  arch/arm/probes/kprobes/opt-arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
> index 2c118a6ab358..0dc23fc227ed 100644
> --- a/arch/arm/probes/kprobes/opt-arm.c
> +++ b/arch/arm/probes/kprobes/opt-arm.c
> @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
>  	}
>  
>  	/* Copy arch-dep-instance from template. */
> -	memcpy(code, (unsigned char *)optprobe_template_entry,
> +	memcpy(code, (unsigned long *)&optprobe_template_entry,
>  			TMPL_END_IDX * sizeof(kprobe_opcode_t));
>  
>  	/* Adjust buffer according to instruction. */
> -- 
> 2.11.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-06  4:39   ` Masami Hiramatsu
  0 siblings, 0 replies; 9+ messages in thread
From: Masami Hiramatsu @ 2019-02-06  4:39 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Kees Cook, linux-kernel, # v4 . 14+,
	Russell King, Masami Hiramatsu, Robert Berger, William Cohen,
	Laura Abbott, linux-arm-kernel, patches

On Tue,  5 Feb 2019 10:37:40 -0500
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:

> commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
> FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
> triggers "invalid instruction" oopses when using kprobes instrumentation
> through lttng and perf. This commit was introduced in kernel v4.20, and
> has been backported to stable kernels 4.19 and 4.14.
> 
> This crash was also reported by Hongzhi Song on the redhat bugzilla
> where the patch was originally introduced.

Thank you for fixing this.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>


> 
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
> Link: https://bugs.lttng.org/issues/1174
> Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
> Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> Acked-by: Kees Cook <keescook@chromium.org>
> CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> CC: Masami Hiramatsu <mhiramat@kernel.org>
> CC: William Cohen <wcohen@redhat.com>
> CC: Laura Abbott <labbott@redhat.com>
> CC: Kees Cook <keescook@chromium.org>
> CC: Russell King <rmk+kernel@armlinux.org.uk>
> CC: <stable@vger.kernel.org> # v4.14+
> CC: linux-arm-kernel@lists.infradead.org
> CC: patches@armlinux.org.uk
> ---
> KernelVersion: 5.0.0-rc5
>  arch/arm/probes/kprobes/opt-arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
> index 2c118a6ab358..0dc23fc227ed 100644
> --- a/arch/arm/probes/kprobes/opt-arm.c
> +++ b/arch/arm/probes/kprobes/opt-arm.c
> @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
>  	}
>  
>  	/* Copy arch-dep-instance from template. */
> -	memcpy(code, (unsigned char *)optprobe_template_entry,
> +	memcpy(code, (unsigned long *)&optprobe_template_entry,
>  			TMPL_END_IDX * sizeof(kprobe_opcode_t));
>  
>  	/* Adjust buffer according to instruction. */
> -- 
> 2.11.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-05 15:28 ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-05 15:28 UTC (permalink / raw)
  To: patches
  Cc: linux-kernel, Mathieu Desnoyers, Robert Berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, Kees Cook, Russell King, # v4 . 14+,
	linux-arm-kernel

commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
triggers "invalid instruction" oopses when using kprobes instrumentation
through lttng and perf. This commit was introduced in kernel v4.20, and
has been backported to stable kernels 4.19 and 4.14.

This crash was also reported by Hongzhi Song on the redhat bugzilla
where the patch was originally introduced.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
Link: https://bugs.lttng.org/issues/1174
Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Acked-by: Kees Cook <keescook@chromium.org>
CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Masami Hiramatsu <mhiramat@kernel.org>
CC: William Cohen <wcohen@redhat.com>
CC: Laura Abbott <labbott@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: <stable@vger.kernel.org> # v4.14+
CC: linux-arm-kernel@lists.infradead.org
CC: patches@armlinux.org.uk
---
 arch/arm/probes/kprobes/opt-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
 	}
 
 	/* Copy arch-dep-instance from template. */
-	memcpy(code, (unsigned char *)optprobe_template_entry,
+	memcpy(code, (unsigned long *)&optprobe_template_entry,
 			TMPL_END_IDX * sizeof(kprobe_opcode_t));
 
 	/* Adjust buffer according to instruction. */
-- 
2.11.0


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

* [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-05 15:28 ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-05 15:28 UTC (permalink / raw)
  To: patches
  Cc: Kees Cook, linux-kernel, # v4 . 14+,
	Russell King, Mathieu Desnoyers, Masami Hiramatsu, Robert Berger,
	William Cohen, Laura Abbott, linux-arm-kernel

commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
FORTIFY_SOURCE") introduced a regression in optimized kprobes. It
triggers "invalid instruction" oopses when using kprobes instrumentation
through lttng and perf. This commit was introduced in kernel v4.20, and
has been backported to stable kernels 4.19 and 4.14.

This crash was also reported by Hongzhi Song on the redhat bugzilla
where the patch was originally introduced.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
Link: https://bugs.lttng.org/issues/1174
Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Acked-by: Kees Cook <keescook@chromium.org>
CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Masami Hiramatsu <mhiramat@kernel.org>
CC: William Cohen <wcohen@redhat.com>
CC: Laura Abbott <labbott@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: <stable@vger.kernel.org> # v4.14+
CC: linux-arm-kernel@lists.infradead.org
CC: patches@armlinux.org.uk
---
 arch/arm/probes/kprobes/opt-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
 	}
 
 	/* Copy arch-dep-instance from template. */
-	memcpy(code, (unsigned char *)optprobe_template_entry,
+	memcpy(code, (unsigned long *)&optprobe_template_entry,
 			TMPL_END_IDX * sizeof(kprobe_opcode_t));
 
 	/* Adjust buffer according to instruction. */
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
  2019-02-05 15:04 ` Kees Cook
@ 2019-02-05 15:27   ` Mathieu Desnoyers
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-05 15:27 UTC (permalink / raw)
  To: Kees Cook
  Cc: Russell King, linux-kernel, robert berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, stable

----- On Feb 5, 2019, at 10:04 AM, Kees Cook keescook@chromium.org wrote:

> On Mon, Feb 4, 2019 at 9:52 PM Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com> wrote:
>>
>> commit e46daee53bb5 "ARM: 8806/1: kprobes: Fix false positive with
>> FORTIFY_SOURCE"
>> introduced a regression in optimized kprobes. It triggers "invalid
>> instruction" oopses when using kprobes instrumentation through lttng and
>> perf. This commit was introduced in kernel v4.20, and has been backported
>> to stable kernels 4.19 and 4.14.
>>
>> This crash was also reported by Hongzhi Song on the redhat bugzilla
>> where the patch was originally introduced.
> 
> Ew, yes. Thanks for catching this.
> 
> Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
> FORTIFY_SOURCE")
> Acked-by: Kees Cook <keescook@chromium.org>
> 
> Can you send this to the ARM patch tracker, please?

Sure, will do right away,

Thanks!

Mathieu

> 
> -Kees
> 
>>
>> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
>> Link: https://bugs.lttng.org/issues/1174
>> Link:
>> https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
>> Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
>> CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
>> CC: Masami Hiramatsu <mhiramat@kernel.org>
>> CC: William Cohen <wcohen@redhat.com>
>> CC: Laura Abbott <labbott@redhat.com>
>> CC: Kees Cook <keescook@chromium.org>
>> CC: Russell King <rmk+kernel@armlinux.org.uk>
>> CC: <stable@vger.kernel.org> # v4.14+
>> ---
>>  arch/arm/probes/kprobes/opt-arm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/probes/kprobes/opt-arm.c
>> b/arch/arm/probes/kprobes/opt-arm.c
>> index 2c118a6ab358..0dc23fc227ed 100644
>> --- a/arch/arm/probes/kprobes/opt-arm.c
>> +++ b/arch/arm/probes/kprobes/opt-arm.c
>> @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe
>> *op, struct kprobe *or
>>         }
>>
>>         /* Copy arch-dep-instance from template. */
>> -       memcpy(code, (unsigned char *)optprobe_template_entry,
>> +       memcpy(code, (unsigned long *)&optprobe_template_entry,
>>                         TMPL_END_IDX * sizeof(kprobe_opcode_t));
>>
>>         /* Adjust buffer according to instruction. */
>> --
>> 2.11.0
>>
> 
> 
> --
> Kees Cook

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

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

* Re: [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
  2019-02-04 21:52 Mathieu Desnoyers
@ 2019-02-05 15:04 ` Kees Cook
  2019-02-05 15:27   ` Mathieu Desnoyers
  0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2019-02-05 15:04 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Russell King, LKML, Robert Berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, # v4 . 14+

On Mon, Feb 4, 2019 at 9:52 PM Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
>
> commit e46daee53bb5 "ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE"
> introduced a regression in optimized kprobes. It triggers "invalid
> instruction" oopses when using kprobes instrumentation through lttng and
> perf. This commit was introduced in kernel v4.20, and has been backported
> to stable kernels 4.19 and 4.14.
>
> This crash was also reported by Hongzhi Song on the redhat bugzilla
> where the patch was originally introduced.

Ew, yes. Thanks for catching this.

Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with
FORTIFY_SOURCE")
Acked-by: Kees Cook <keescook@chromium.org>

Can you send this to the ARM patch tracker, please?

-Kees

>
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
> Link: https://bugs.lttng.org/issues/1174
> Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
> CC: Masami Hiramatsu <mhiramat@kernel.org>
> CC: William Cohen <wcohen@redhat.com>
> CC: Laura Abbott <labbott@redhat.com>
> CC: Kees Cook <keescook@chromium.org>
> CC: Russell King <rmk+kernel@armlinux.org.uk>
> CC: <stable@vger.kernel.org> # v4.14+
> ---
>  arch/arm/probes/kprobes/opt-arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
> index 2c118a6ab358..0dc23fc227ed 100644
> --- a/arch/arm/probes/kprobes/opt-arm.c
> +++ b/arch/arm/probes/kprobes/opt-arm.c
> @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
>         }
>
>         /* Copy arch-dep-instance from template. */
> -       memcpy(code, (unsigned char *)optprobe_template_entry,
> +       memcpy(code, (unsigned long *)&optprobe_template_entry,
>                         TMPL_END_IDX * sizeof(kprobe_opcode_t));
>
>         /* Adjust buffer according to instruction. */
> --
> 2.11.0
>


-- 
Kees Cook

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

* [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction
@ 2019-02-04 21:52 Mathieu Desnoyers
  2019-02-05 15:04 ` Kees Cook
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Desnoyers @ 2019-02-04 21:52 UTC (permalink / raw)
  To: Russell King
  Cc: linux-kernel, Mathieu Desnoyers, Robert Berger, Masami Hiramatsu,
	William Cohen, Laura Abbott, Kees Cook, # v4 . 14+

commit e46daee53bb5 "ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE"
introduced a regression in optimized kprobes. It triggers "invalid
instruction" oopses when using kprobes instrumentation through lttng and
perf. This commit was introduced in kernel v4.20, and has been backported
to stable kernels 4.19 and 4.14.

This crash was also reported by Hongzhi Song on the redhat bugzilla
where the patch was originally introduced.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1639397
Link: https://bugs.lttng.org/issues/1174
Link: https://lore.kernel.org/lkml/342740659.2887.1549307721609.JavaMail.zimbra@efficios.com
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
Tested-by: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Robert Berger <Robert.Berger@ReliableEmbeddedSystems.com>
CC: Masami Hiramatsu <mhiramat@kernel.org>
CC: William Cohen <wcohen@redhat.com>
CC: Laura Abbott <labbott@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Russell King <rmk+kernel@armlinux.org.uk>
CC: <stable@vger.kernel.org> # v4.14+
---
 arch/arm/probes/kprobes/opt-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
 	}
 
 	/* Copy arch-dep-instance from template. */
-	memcpy(code, (unsigned char *)optprobe_template_entry,
+	memcpy(code, (unsigned long *)&optprobe_template_entry,
 			TMPL_END_IDX * sizeof(kprobe_opcode_t));
 
 	/* Adjust buffer according to instruction. */
-- 
2.11.0


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

end of thread, other threads:[~2019-02-06  4:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 15:37 [PATCH 1/1] Fix: arm: kprobes: optimized kprobes illegal instruction Mathieu Desnoyers
2019-02-05 15:37 ` Mathieu Desnoyers
2019-02-06  4:39 ` Masami Hiramatsu
2019-02-06  4:39   ` Masami Hiramatsu
  -- strict thread matches above, loose matches on Subject: below --
2019-02-05 15:28 Mathieu Desnoyers
2019-02-05 15:28 ` Mathieu Desnoyers
2019-02-04 21:52 Mathieu Desnoyers
2019-02-05 15:04 ` Kees Cook
2019-02-05 15:27   ` Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.