All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [RFC PATCH] Fix: x86 unaligned __memcpy to/from virtual memory
Date: Thu, 25 Jun 2015 00:33:52 +0000 (UTC)	[thread overview]
Message-ID: <319273741.2640.1435192432022.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1022548323.2631.1435190096462.JavaMail.zimbra@efficios.com>

----- On Jun 24, 2015, at 7:54 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Jun 24, 2015, at 3:15 PM, Linus Torvalds torvalds@linux-foundation.org
> wrote:
> 
>> On Wed, Jun 24, 2015 at 11:49 AM, Mathieu Desnoyers
>> <mathieu.desnoyers@efficios.com> wrote:
>>>
>>> Here is the output. I added the printk just after the initial range
>>> check within vmalloc_fault.
>> 
>> Good. Can you add printk's to the error return paths too, so that we
>> see which one it is that triggers.
> 
> OK, see below. This time the fault occurred at an unaligned address.
> It fails on the !pte_present(*pte_ref) check.

I just tried to to a bytewise copy in C rather than call
memcpy, and I got the fault to trigger. So I guess I was on
the wrong track assuming __memcpy would be the culprit.
What is odd is that if I issue vmalloc_sync_all() after each
vmalloc call, the OOPS never triggers. It is clearly a test
case that ends up stressing vfree/vmalloc.

[   34.751984] DEBUG: vmalloc_fault at address 0xffffc90007290000
[   34.753188] DEBUG: !pte_present(*pte_ref) error
[   34.753188] BUG: unable to handle kernel paging request at ffffc90007290000
[   34.753188] IP: [<ffffffffa05c77c0>] lttng_event_write+0x90/0xd0 [lttng_ring_buffer_metadata_client]
[   34.753188] PGD 236c92067 PUD 236c93067 PMD b6964067 PTE 0
[   34.753188] Oops: 0000 [#1] SMP 
[   34.753188] Modules linked in: lttng_probe_workqueue(O) lttng_probe_vmscan(O) lttng_probe_udp(O) lttng_probe_timer(O) lttng_probe_sunrpc(O) lttng_probe_statedump(O) lttng_probe_sock(O) lttng_probe_skb(O) lttng_probe_signal(O) lttng_probe_scsi(O) lttng_probe_sched(O) lttng_probe_regmap(O) lttng_probe_rcu(O) lttng_probe_random(O) lttng_probe_power(O) lttng_probe_net(O) lttng_probe_napi(O) lttng_probe_module(O) lttng_probe_kmem(O) lttng_probe_jbd2(O) lttng_probe_irq(O) lttng_probe_ext4(O) lttng_probe_compaction(O) lttng_probe_block(O) lttng_types(O) lttng_ring_buffer_metadata_mmap_client(O) lttng_ring_buffer_client_mmap_overwrite(O) lttng_ring_buffer_client_mmap_discard(O) lttng_ring_buffer_metadata_client(O) lttng_ring_buffer_client_overwrite(O) lttng_ring_buffer_client_discard(O) lttng_tracer(O) lttng_statedump(O) lttng_kprobes(O) lttng_lib_ring_buffer(O) lttng_kretprobes(O) virtio_blk virtio_net virtio_pci virtio_ring virtio [last unloaded: lttng_statedump]
[   34.753188] CPU: 26 PID: 3563 Comm: lttng-consumerd Tainted: G           O    4.1.0+ #11
[   34.753188] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
[   34.753188] task: ffff880234d94880 ti: ffff88022af6c000 task.ti: ffff88022af6c000
[   34.753188] RIP: 0010:[<ffffffffa05c77c0>]  [<ffffffffa05c77c0>] lttng_event_write+0x90/0xd0 [lttng_ring_buffer_metadata_client]
[   34.753188] RSP: 0018:ffff88022af6fda8  EFLAGS: 00010212
[   34.753188] RAX: 000000000000009d RBX: 0000000000000fd8 RCX: 0000000000000025
[   34.753188] RDX: ffff8800b7681120 RSI: ffffc9000728ff63 RDI: 0000000000000000
[   34.753188] RBP: ffff88022af6fdb8 R08: 000000000000009d R09: ffff88022ea33025
[   34.753188] R10: 000000000000003b R11: 0000000000000246 R12: ffff88022af6fdc8
[   34.753188] R13: ffff880231565c00 R14: 0000000000000fd8 R15: 0000000000000fd8
[   34.753188] FS:  00007fd64b5f2700(0000) GS:ffff880237540000(0000) knlGS:0000000000000000
[   34.753188] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   34.753188] CR2: ffffc90007290000 CR3: 0000000233803000 CR4: 00000000000006e0
[   34.753188] Stack:
[   34.753188]  ffff880234cbff00 ffff880234cbff50 ffff88022af6fe48 ffffffffa048e060
[   34.753188]  ffff880231565c00 0000000000000000 0000000000000fd8 ffffffff00000001
[   34.753188]  ffff88023155d000 0000000000000fd8 0000000000004025 0000000000004025
[   34.753188] Call Trace:
[   34.753188]  [<ffffffffa048e060>] lttng_metadata_output_channel+0xd0/0x120 [lttng_tracer]
[   34.753188]  [<ffffffffa04905f9>] lttng_metadata_ring_buffer_ioctl+0x79/0xd0 [lttng_tracer]
[   34.753188]  [<ffffffff8117ba70>] do_vfs_ioctl+0x2e0/0x4e0
[   34.753188]  [<ffffffff812b3627>] ? file_has_perm+0x87/0xa0
[   34.753188]  [<ffffffff8117bcf1>] SyS_ioctl+0x81/0xa0
[   34.753188]  [<ffffffff810115d1>] ? syscall_trace_leave+0xd1/0xe0
[   34.753188]  [<ffffffff818bbdb7>] tracesys_phase2+0x84/0x89
[   34.753188] Code: d9 48 0f 47 cb 48 39 cb 75 46 48 8d 57 02 25 ff 0f 00 00 45 31 c0 48 89 c1 31 c0 48 c1 e2 04 4c 01 ca 66 0f 1f 84 00 00 00 00 00 <44> 0f b6 14 06 49 89 c9 4c 03 0a 41 83 c0 01 45 88 14 01 49 63 
[   34.753188] RIP  [<ffffffffa05c77c0>] lttng_event_write+0x90/0xd0 [lttng_ring_buffer_metadata_client]
[   34.753188]  RSP <ffff88022af6fda8>
[   34.753188] CR2: ffffc90007290000
[   34.753188] ---[ end trace 28951381246c3a2e ]---


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

  reply	other threads:[~2015-06-25  0:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 16:14 [RFC PATCH] Fix: x86 unaligned __memcpy to/from virtual memory Mathieu Desnoyers
2015-06-24 17:00 ` Linus Torvalds
2015-06-24 18:49   ` Mathieu Desnoyers
2015-06-24 18:53     ` H. Peter Anvin
2015-06-24 19:15     ` Linus Torvalds
2015-06-24 23:54       ` Mathieu Desnoyers
2015-06-25  0:33         ` Mathieu Desnoyers [this message]
2015-06-25  0:37         ` Linus Torvalds
2015-06-25 12:58           ` Mathieu Desnoyers

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=319273741.2640.1435192432022.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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.