Re: [RFC PATCH] Fix: x86 unaligned __memcpy to/from virtual memory

H. Peter Anvin
2015-06-24T18:53:55Z

On 06/24/2015 11:49 AM, Mathieu Desnoyers wrote:
>
> [ 53.084521] DEBUG: vmalloc_fault at address 0xffffc9000746e000
> [ 53.085460] BUG: unable to handle kernel paging request at ffffc9000746e000
> [ 53.085460] IP:
> [ 53.090220] [<ffffffff81316f12>] __memcpy+0x12/0x20
> [ 53.090220] PGD 236c92067 PUD 236c93067 PMD 22e840067 PTE 0
> [ 53.090220] Oops: 0000 [#1] SMP
> [ 53.090220] 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]
> [ 53.090220] CPU: 4 PID: 3532 Comm: lttng-consumerd Tainted: G O 4.1.0+ #10
> [ 53.090220] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> [ 53.090220] task: ffff880235355aa0 ti: ffff8800bb6d0000 task.ti: ffff8800bb6d0000
> [ 53.090220] RIP: 0010:[<ffffffff81316f12>] [<ffffffff81316f12>] __memcpy+0x12/0x20
> [ 53.090220] RSP: 0018:ffff8800bb6d3da0 EFLAGS: 00010206
> [ 53.090220] RAX: ffff8802355b3025 RBX: 0000000000000fdb RCX: 00000000000001fb
> [ 53.090220] RDX: 0000000000000003 RSI: ffffc9000746e000 RDI: ffff8802355b3025

Okay, RSI is at the start of a page, but isn't even unaligned. RDI is
unaligned, but that shouldn't matter at all.

So I think the problem is really that you are simply outrunning your
input buffer.

-hpa