All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Russell King - ARM Linux <linux@armlinux.org.uk>,
	Peter Robinson <pbrobinson@gmail.com>
Cc: netdev@vger.kernel.org, labbott@redhat.com,
	linux-arm-kernel@lists.infradead.org,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [offlist] Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1
Date: Thu, 5 Jul 2018 09:46:31 +0200	[thread overview]
Message-ID: <965d9f3e-cc24-9d7b-6416-f6596ced8e86@iogearbox.net> (raw)
In-Reply-To: <20180705073120.GU17271@n2100.armlinux.org.uk>

On 07/05/2018 09:31 AM, Russell King - ARM Linux wrote:
> On Thu, Jul 05, 2018 at 12:41:54AM +0100, Russell King - ARM Linux wrote:
>> Subject says offlist, but this isn't...
>>
>> On Wed, Jul 04, 2018 at 08:33:20AM +0100, Peter Robinson wrote:
>>> Sorry for the delay on this from my end. I noticed there was some bpf
>>> bits land in the last net fixes pull request landed Monday so I built
>>> a kernel with the JIT reenabled. It seems it's improved in that the
>>> completely dead no output boot has gone but the original problem that
>>> arrived in the merge window still persists:
>>>
>>> [   17.564142] note: systemd-udevd[194] exited with preempt_count 1
>>> [   17.592739] Unable to handle kernel NULL pointer dereference at
>>> virtual address 0000000c
>>> [   17.601002] pgd = (ptrval)
>>> [   17.603819] [0000000c] *pgd=00000000
>>> [   17.607487] Internal error: Oops: 805 [#10] SMP ARM
>>> [   17.612396] Modules linked in:
>>> [   17.615484] CPU: 0 PID: 195 Comm: systemd-udevd Tainted: G      D
>>>         4.18.0-0.rc3.git1.1.bpf1.fc29.armv7hl #1
>>> [   17.626056] Hardware name: Generic AM33XX (Flattened Device Tree)
>>> [   17.632198] PC is at sk_filter_trim_cap+0x218/0x2fc
>>> [   17.637102] LR is at   (null)
>>> [   17.640086] pc : [<c0ab03b4>]    lr : [<00000000>]    psr: 60000013
>>> [   17.646384] sp : cfe1dd48  ip : 00000000  fp : 00000000
>>> [   17.651635] r10: d837e000  r9 : d833be00  r8 : 00000000
>>> [   17.656887] r7 : 00000001  r6 : e003d000  r5 : 00000000  r4 : 00000000
>>> [   17.663447] r3 : 00000007  r2 : 00000000  r1 : 00000000  r0 : 00000000
>>> [   17.670009] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
>>> [   17.677180] Control: 10c5387d  Table: 8fe20019  DAC: 00000051
>>> [   17.682956] Process systemd-udevd (pid: 195, stack limit = 0x(ptrval))
>>> [   17.689518] Stack: (0xcfe1dd48 to 0xcfe1e000)
>>
>> Can you provide a full disassembly of sk_filter_trim_cap from vmlinux
>> (iow, annotated with its linked address) for the above dump please -
>> alternatively a new dump with matching disassembly.  Thanks.
> 
> Also probably a good idea to have bpf_jit_enable set to 2 to get a
> dump of the bpf program being run, which I think for your problem,
> you'll have to hack the kernel source to do that.

Agree, that would be good as well. You could use something like the below
to bail out to interpreter after JIT did the dump.

Dump will then land in kernel log which you could paste here.

diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index f6a62ae..d6a7dfd 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -1844,6 +1844,13 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 		/* there are 2 passes here */
 		bpf_jit_dump(prog->len, image_size, 2, ctx.target);

+	/* Defer to interpreter after dump. */
+	if (1) {
+		bpf_jit_binary_free(header);
+		prog = orig_prog;
+		goto out_imms;
+	}
+
 	bpf_jit_binary_lock_ro(header);
 	prog->bpf_func = (void *)ctx.target;
 	prog->jited = 1;

WARNING: multiple messages have this Message-ID (diff)
From: daniel@iogearbox.net (Daniel Borkmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [offlist] Re: Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1
Date: Thu, 5 Jul 2018 09:46:31 +0200	[thread overview]
Message-ID: <965d9f3e-cc24-9d7b-6416-f6596ced8e86@iogearbox.net> (raw)
In-Reply-To: <20180705073120.GU17271@n2100.armlinux.org.uk>

On 07/05/2018 09:31 AM, Russell King - ARM Linux wrote:
> On Thu, Jul 05, 2018 at 12:41:54AM +0100, Russell King - ARM Linux wrote:
>> Subject says offlist, but this isn't...
>>
>> On Wed, Jul 04, 2018 at 08:33:20AM +0100, Peter Robinson wrote:
>>> Sorry for the delay on this from my end. I noticed there was some bpf
>>> bits land in the last net fixes pull request landed Monday so I built
>>> a kernel with the JIT reenabled. It seems it's improved in that the
>>> completely dead no output boot has gone but the original problem that
>>> arrived in the merge window still persists:
>>>
>>> [   17.564142] note: systemd-udevd[194] exited with preempt_count 1
>>> [   17.592739] Unable to handle kernel NULL pointer dereference at
>>> virtual address 0000000c
>>> [   17.601002] pgd = (ptrval)
>>> [   17.603819] [0000000c] *pgd=00000000
>>> [   17.607487] Internal error: Oops: 805 [#10] SMP ARM
>>> [   17.612396] Modules linked in:
>>> [   17.615484] CPU: 0 PID: 195 Comm: systemd-udevd Tainted: G      D
>>>         4.18.0-0.rc3.git1.1.bpf1.fc29.armv7hl #1
>>> [   17.626056] Hardware name: Generic AM33XX (Flattened Device Tree)
>>> [   17.632198] PC is at sk_filter_trim_cap+0x218/0x2fc
>>> [   17.637102] LR is at   (null)
>>> [   17.640086] pc : [<c0ab03b4>]    lr : [<00000000>]    psr: 60000013
>>> [   17.646384] sp : cfe1dd48  ip : 00000000  fp : 00000000
>>> [   17.651635] r10: d837e000  r9 : d833be00  r8 : 00000000
>>> [   17.656887] r7 : 00000001  r6 : e003d000  r5 : 00000000  r4 : 00000000
>>> [   17.663447] r3 : 00000007  r2 : 00000000  r1 : 00000000  r0 : 00000000
>>> [   17.670009] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
>>> [   17.677180] Control: 10c5387d  Table: 8fe20019  DAC: 00000051
>>> [   17.682956] Process systemd-udevd (pid: 195, stack limit = 0x(ptrval))
>>> [   17.689518] Stack: (0xcfe1dd48 to 0xcfe1e000)
>>
>> Can you provide a full disassembly of sk_filter_trim_cap from vmlinux
>> (iow, annotated with its linked address) for the above dump please -
>> alternatively a new dump with matching disassembly.  Thanks.
> 
> Also probably a good idea to have bpf_jit_enable set to 2 to get a
> dump of the bpf program being run, which I think for your problem,
> you'll have to hack the kernel source to do that.

Agree, that would be good as well. You could use something like the below
to bail out to interpreter after JIT did the dump.

Dump will then land in kernel log which you could paste here.

diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index f6a62ae..d6a7dfd 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -1844,6 +1844,13 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 		/* there are 2 passes here */
 		bpf_jit_dump(prog->len, image_size, 2, ctx.target);

+	/* Defer to interpreter after dump. */
+	if (1) {
+		bpf_jit_binary_free(header);
+		prog = orig_prog;
+		goto out_imms;
+	}
+
 	bpf_jit_binary_lock_ro(header);
 	prog->bpf_func = (void *)ctx.target;
 	prog->jited = 1;

  reply	other threads:[~2018-07-05  7:46 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 11:19 Crash in netlink/sk_filter_trim_cap on ARMv7 on 4.18rc1 Peter Robinson
2018-06-22 11:19 ` Peter Robinson
2018-06-22 12:55 ` Eric Dumazet
2018-06-22 12:55   ` Eric Dumazet
2018-06-24  9:24   ` Peter Robinson
2018-06-24  9:24     ` Peter Robinson
2018-06-25  8:48     ` Daniel Borkmann
2018-06-25  8:48       ` Daniel Borkmann
2018-06-25 12:03       ` Peter Robinson
2018-06-25 12:03         ` Peter Robinson
     [not found]     ` <ad98d60c-bd60-b495-c4bd-507fc29c8bcd@iogearbox.net>
     [not found]       ` <CALeDE9PBZWJBp8KB0mB4zoNXqscmzxWzz+LnuqRA-z4t1e9T8g@mail.gmail.com>
2018-06-25 16:41         ` [offlist] " Peter Robinson
2018-06-25 16:41           ` Peter Robinson
2018-06-26 12:23           ` Peter Robinson
2018-06-26 12:23             ` Peter Robinson
2018-06-26 12:52             ` Daniel Borkmann
2018-06-26 12:52               ` Daniel Borkmann
2018-07-04  7:33               ` Peter Robinson
2018-07-04  7:33                 ` Peter Robinson
2018-07-04 23:10                 ` Daniel Borkmann
2018-07-04 23:10                   ` Daniel Borkmann
2018-07-04 23:41                 ` Russell King - ARM Linux
2018-07-04 23:41                   ` Russell King - ARM Linux
2018-07-05  7:31                   ` Russell King - ARM Linux
2018-07-05  7:31                     ` Russell King - ARM Linux
2018-07-05  7:46                     ` Daniel Borkmann [this message]
2018-07-05  7:46                       ` Daniel Borkmann
2018-08-16 20:35           ` Marc Haber
2018-08-16 20:35             ` Marc Haber
2018-08-16 22:58             ` Russell King - ARM Linux
2018-08-16 22:58               ` Russell King - ARM Linux
2018-08-17 12:25               ` Peter Robinson
2018-08-17 12:25                 ` Peter Robinson
2018-08-17 12:40                 ` Daniel Borkmann
2018-08-17 12:40                   ` Daniel Borkmann
2018-08-17 14:32                   ` Peter Robinson
2018-08-17 14:32                     ` Peter Robinson
2018-08-17 16:17                   ` Russell King - ARM Linux
2018-08-17 16:17                     ` Russell King - ARM Linux
2018-08-17 18:30                     ` Daniel Borkmann
2018-08-17 18:30                       ` Daniel Borkmann
2018-08-17 18:51                       ` Stefan Wahren
2018-08-17 18:51                         ` Stefan Wahren
2018-08-17 21:15                         ` Peter Robinson
2018-08-17 21:15                           ` Peter Robinson
2018-08-17 21:13                       ` Peter Robinson
2018-08-17 21:13                         ` Peter Robinson
2018-08-17 22:06                         ` Daniel Borkmann
2018-08-17 22:06                           ` Daniel Borkmann
2018-08-17 21:12                     ` Peter Robinson
2018-08-17 21:12                       ` Peter Robinson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=965d9f3e-cc24-9d7b-6416-f6596ced8e86@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=eric.dumazet@gmail.com \
    --cc=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pbrobinson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.