From: Mathieu Desnoyers Date: Thu, 5 Oct 2017 18:45:43 +0000 (-0400) Subject: Revert "Fix: update block instrumentation for kernel 4.14" X-Git-Tag: v2.9.5~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88fe59a551a7828b676b81ca8284d475083fc73f;p=lttng-modules.git Revert "Fix: update block instrumentation for kernel 4.14" This reverts commit 49447902967115fe5a07ee7a1df3d17fbf4b1ab8. It introduces a NULL pointer dereference: [ 37.862398] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 181.3 [ 37.864108] IP: [] __event_probe__block_get_rq+0x127/0x4b0 [lttng_probe_block] 181.4 [ 37.864108] PGD 7a402067 PUD 7a4c7067 PMD 0 181.5 [ 37.864108] Oops: 0000 [#1] SMP 181.6 [ 37.864108] Modules linked in: lttng_probe_x86_exceptions(OE) lttng_probe_x86_irq_vectors(OE) lttng_probe_writeback(OE) lttng_probe_workqueue(OE) lttng_probe_vmscan(OE) lttng_probe_udp(OE) lttng_probe_timer(OE) lttng_probe_sunrpc(OE) lttng_probe_statedump(OE) lttng_probe_sock(OE) lttng_probe_skb(OE) lttng_probe_signal(OE) lttng_probe_scsi(OE) lttng_probe_sched(OE) lttng_probe_regulator(OE) lttng_probe_regmap(OE) lttng_probe_rcu(OE) lttng_probe_random(OE) lttng_probe_printk(OE) lttng_probe_power(OE) lttng_probe_net(OE) lttng_probe_napi(OE) lttng_probe_module(OE) lttng_probe_kvm_x86_mmu(OE) lttng_probe_kvm_x86(OE) lttng_probe_kvm(OE) lttng_probe_kmem(OE) lttng_probe_jbd2(OE) lttng_probe_irq(OE) lttng_probe_i2c(OE) lttng_probe_gpio(OE) lttng_probe_ext4(OE) lttng_probe_compaction(OE) lttng_probe_btrfs(OE) lttng_probe_block(OE) lttng_ring_buffer_metadata_mmap_client(OE) lttng_ring_buffer_client_mmap_overwrite(OE) lttng_ring_buffer_client_mmap_discard(OE) lttng_ring_buffer_metadata_client(OE) lttng_ring_buffer_client_overwrite(OE) lttng_ring_buffer_client_discard(OE) lttng_tracer(OE) lttng_statedump(OE) lttng_ftrace(OE) lttng_kprobes(OE) lttng_clock(OE) lttng_lib_ring_buffer(OE) lttng_kretprobes(OE) 181.7 [ 37.864108] CPU: 1 PID: 6 Comm: kworker/u4:0 Tainted: G OE 4.4.90 #1 181.8 [ 37.864108] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 181.9 [ 37.864108] Workqueue: events_freezable_power_ disk_events_workfn 181.10 [ 37.864108] task: ffff88007c861bc0 ti: ffff88007c868000 task.ti: ffff88007c868000 181.11 [ 37.864108] RIP: 0010:[] [] __event_probe__block_get_rq+0x127/0x4b0 [lttng_probe_block] 181.12 [ 37.864108] RSP: 0018:ffff88007c86ba98 EFLAGS: 00010246 181.13 [ 37.864108] RAX: 0000000000000000 RBX: ffff880073683348 RCX: ffff8800747d0000 181.14 [ 37.864108] RDX: 00000008d0c5bde9 RSI: 00000000000009f2 RDI: 0000000000400000 181.15 [ 37.864108] RBP: ffff88007c86bba8 R08: 00000000001789ed R09: 0000000000100000 181.16 [ 37.864108] R10: ffffe8ffffd02460 R11: 0000000000000000 R12: 0000000000000000 181.17 [ 37.864108] R13: 0000000000017fe0 R14: ffff88007363c6e8 R15: ffff88007bef83c0 181.18 [ 37.864108] FS: 0000000000000000(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000 181.19 [ 37.864108] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b 181.20 [ 37.864108] CR2: 0000000000000008 CR3: 000000007a4d0000 CR4: 00000000000006e0 181.21 [ 37.864108] Stack: 181.22 [ 37.864108] 0000000000000000 ffffffff8115a46b ffff88007c86bbe8 ffff88007bc67e30 181.23 [ 37.864108] ffff880073683348 00000000ffffff01 ffff88007a7a1000 ffff88007c86bab8 181.24 [ 37.864108] 0000000000000028 0000000100000001 ffffe8ffffd02460 0000000000000035 181.25 [ 37.864108] Call Trace: 181.26 [ 37.864108] [] ? ktime_get_mono_fast_ns+0x4b/0x90 181.27 [ 37.864108] [] ? alloc_request_struct+0x19/0x20 181.28 [ 37.864108] [] ? mempool_alloc+0x5f/0x150 181.29 [ 37.864108] [] ? __event_probe__kmem_alloc+0x1dc/0x2c0 [lttng_probe_kmem] 181.30 [ 37.864108] [] ? kvm_clock_read+0x1e/0x20 181.31 [ 37.864108] [] get_request+0x4af/0x760 181.32 [ 37.864108] [] ? wake_atomic_t_function+0x60/0x60 181.33 [ 37.864108] [] blk_get_request+0x83/0xe0 181.34 [ 37.864108] [] scsi_execute+0x3d/0x1d0 181.35 [ 37.864108] [] scsi_execute_req_flags+0x8e/0xf0 181.36 [ 37.864108] [] sr_check_events+0x8d/0x2a0 181.37 [ 37.864108] [] ? disk_check_events+0x130/0x130 181.38 [ 37.864108] [] cdrom_check_events+0x18/0x30 181.39 [ 37.864108] [] sr_block_check_events+0x2a/0x30 181.40 [ 37.864108] [] disk_check_events+0x51/0x130 181.41 [ 37.864108] [] disk_events_workfn+0x16/0x20 181.42 [ 37.864108] [] process_one_work+0x165/0x480 181.43 [ 37.864108] [] worker_thread+0x4b/0x4c0 181.44 [ 37.864108] [] ? process_one_work+0x480/0x480 181.45 [ 37.864108] [] kthread+0xd6/0xf0 181.46 [ 37.864108] [] ? kthread_create_on_node+0x180/0x180 181.47 [ 37.864108] [] ret_from_fork+0x3f/0x70 181.48 [ 37.864108] [] ? kthread_create_on_node+0x180/0x180 181.49 [ 37.864108] Code: 00 00 00 00 48 89 85 20 ff ff ff 48 8d 85 10 ff ff ff 8b 73 04 48 89 85 28 ff ff ff 49 8b 47 48 ff 50 28 85 c0 0f 88 5d 01 00 00 <49> 8b 44 24 08 48 85 c0 0f 84 3d 03 00 00 8b 00 89 85 08 ff ff 181.50 [ 37.864108] RIP [] __event_probe__block_get_rq+0x127/0x4b0 [lttng_probe_block] 181.51 [ 37.864108] RSP 181.52 [ 37.864108] CR2: 0000000000000008 Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h index 80ea25ca..c43d7471 100644 --- a/instrumentation/events/lttng-module/block.h +++ b/instrumentation/events/lttng-module/block.h @@ -33,13 +33,6 @@ enum { #endif /* _TRACE_BLOCK_DEF_ */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)) -#define lttng_bio_dev(bio) bio_dev(bio) -#else -#define lttng_bio_dev(bio) ((bio)->bi_bdev ? (bio)->bi_bdev->bd_dev : 0) -#endif - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) #define lttng_req_op(rq) req_op(rq) @@ -618,7 +611,7 @@ LTTNG_TRACEPOINT_EVENT(block_bio_bounce, TP_ARGS(q, bio), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) @@ -659,7 +652,7 @@ LTTNG_TRACEPOINT_EVENT(block_bio_complete, #endif TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) @@ -689,7 +682,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge, TP_ARGS(q, rq, bio), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) @@ -751,7 +744,7 @@ LTTNG_TRACEPOINT_EVENT(block_bio_queue, TP_ARGS(q, bio), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) ctf_integer(unsigned int, nr_sector, bio_sectors(bio)) @@ -776,7 +769,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_bio, TP_ARGS(q, bio), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev ? bio->bi_bdev->bd_dev : 0) ctf_integer(sector_t, sector, bio->bi_sector) ctf_integer(unsigned int, nr_sector, bio->bi_size >> 9) blk_rwbs_ctf_integer(unsigned int, rwbs, @@ -838,7 +831,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(block_get_rq, TP_ARGS(q, bio, rw), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio ? bio->bi_bdev->bd_dev : 0) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio ? bio->bi_iter.bi_sector : 0) ctf_integer(unsigned int, nr_sector, @@ -999,7 +992,7 @@ LTTNG_TRACEPOINT_EVENT(block_split, TP_ARGS(q, bio, new_sector), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) blk_rwbs_ctf_integer(unsigned int, rwbs, @@ -1038,7 +1031,7 @@ LTTNG_TRACEPOINT_EVENT(block_remap, TP_ARGS(q, bio, dev, from), TP_FIELDS( - ctf_integer(dev_t, dev, lttng_bio_dev(bio)) + ctf_integer(dev_t, dev, bio->bi_bdev->bd_dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) ctf_integer(sector_t, sector, bio->bi_iter.bi_sector) ctf_integer(unsigned int, nr_sector, bio_sectors(bio))