]> code.ossystems Code Review - openembedded-core.git/blob
bdbc4f811eda33e7d71b1e5e7d3850c5661b71fb
[openembedded-core.git] /
1 From 1ff7013bcf7f068cf4371d12d758f9c0fd16a619 Mon Sep 17 00:00:00 2001
2 From: Quanyang Wang <quanyang.wang@windriver.com>
3 Date: Thu, 5 Dec 2019 15:35:32 +0800
4 Subject: [PATCH 1/4] Fix: SUNRPC: Fix oops when trace sunrpc_task events in
5  nfs client
6
7 See upstream commit :
8
9         commit 2ca310fc4160ed0420da65534a21ae77b24326a8
10         Author: Ditang Chen <chendt.fnst@cn.fujitsu.com>
11         Date: Fri, 7 Mar 2014 13:27:57 +0800
12         Subject: SUNRPC: Fix oops when trace sunrpc_task events in nfs client
13
14         When tracking sunrpc_task events in nfs client, the clnt pointer may be NULL.
15
16         [  139.269266] BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
17         [  139.269915] IP: [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
18         [  139.269915] PGD 1d293067 PUD 1d294067 PMD 0
19         [  139.269915] Oops: 0000 [#1] SMP
20         [  139.269915] Modules linked in: nfsv4 dns_resolver nfs lockd sunrpc fscache sg ppdev e1000
21         serio_raw pcspkr parport_pc parport i2c_piix4 i2c_core microcode xfs libcrc32c sd_mod sr_mod
22         cdrom ata_generic crc_t10dif crct10dif_common pata_acpi ahci libahci ata_piix libata dm_mirror
23         dm_region_hash dm_log dm_mod
24         [  139.269915] CPU: 0 PID: 59 Comm: kworker/0:2 Not tainted 3.10.0-84.el7.x86_64 #1
25         [  139.269915] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
26         [  139.269915] Workqueue: rpciod rpc_async_schedule [sunrpc]
27         [  139.269915] task: ffff88001b598000 ti: ffff88001b632000 task.ti: ffff88001b632000
28         [  139.269915] RIP: 0010:[<ffffffffa026f216>]  [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
29         [  139.269915] RSP: 0018:ffff88001b633d70  EFLAGS: 00010206
30         [  139.269915] RAX: ffff88001dfc5338 RBX: ffff88001cc37a00 RCX: ffff88001dfc5334
31         [  139.269915] RDX: ffff88001dfc5338 RSI: 0000000000000000 RDI: ffff88001dfc533c
32         [  139.269915] RBP: ffff88001b633db0 R08: 000000000000002c R09: 000000000000000a
33         [  139.269915] R10: 0000000000062180 R11: 00000020759fb9dc R12: ffffffffa0292c20
34         [  139.269915] R13: ffff88001dfc5334 R14: 0000000000000000 R15: 0000000000000000
35         [  139.269915] FS:  0000000000000000(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
36         [  139.269915] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
37         [  139.269915] CR2: 0000000000000004 CR3: 000000001d290000 CR4: 00000000000006f0
38         [  139.269915] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
39         [  139.269915] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
40         [  139.269915] Stack:
41         [  139.269915]  000000001b633d98 0000000000000246 ffff88001df1dc00 ffff88001cc37a00
42         [  139.269915]  ffff88001bc35e60 0000000000000000 ffff88001ffa0a48 ffff88001bc35ee0
43         [  139.269915]  ffff88001b633e08 ffffffffa02704b5 0000000000010000 ffff88001cc37a70
44         [  139.269915] Call Trace:
45         [  139.269915]  [<ffffffffa02704b5>] __rpc_execute+0x1d5/0x400 [sunrpc]
46         [  139.269915]  [<ffffffffa0270706>] rpc_async_schedule+0x26/0x30 [sunrpc]
47         [  139.269915]  [<ffffffff8107867b>] process_one_work+0x17b/0x460
48         [  139.269915]  [<ffffffff8107942b>] worker_thread+0x11b/0x400
49         [  139.269915]  [<ffffffff81079310>] ? rescuer_thread+0x3e0/0x3e0
50         [  139.269915]  [<ffffffff8107fc80>] kthread+0xc0/0xd0
51         [  139.269915]  [<ffffffff8107fbc0>] ? kthread_create_on_node+0x110/0x110
52         [  139.269915]  [<ffffffff815d122c>] ret_from_fork+0x7c/0xb0
53         [  139.269915]  [<ffffffff8107fbc0>] ? kthread_create_on_node+0x110/0x110
54         [  139.269915] Code: 4c 8b 45 c8 48 8d 7d d0 89 4d c4 41 89 c9 b9 28 00 00 00 e8 9d b4 e9
55         e0 48 85 c0 49 89 c5 74 a2 48 89 c7 e8 9d 3f e9 e0 48 89 c2 <41> 8b 46 04 48 8b 7d d0 4c
56         89 e9 4c 89 e6 89 42 0c 0f b7 83 d4
57         [  139.269915] RIP  [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
58         [  139.269915]  RSP <ffff88001b633d70>
59         [  139.269915] CR2: 0000000000000004
60         [  140.946406] ---[ end trace ba486328b98d7622 ]---
61
62 Upstream-Status: Backport [https://github.com/lttng/lttng-modules/commit/2b228b503cad10bf0c5a99b42a908ca906eab5b9]
63
64 Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
65 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
66 ---
67  instrumentation/events/lttng-module/rpc.h | 4 ++--
68  1 file changed, 2 insertions(+), 2 deletions(-)
69
70 diff --git a/instrumentation/events/lttng-module/rpc.h b/instrumentation/events/lttng-module/rpc.h
71 index 3798e8e..fb13106 100644
72 --- a/instrumentation/events/lttng-module/rpc.h
73 +++ b/instrumentation/events/lttng-module/rpc.h
74 @@ -139,7 +139,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
75  
76         TP_FIELDS(
77                 ctf_integer(unsigned int, task_id, task->tk_pid)
78 -               ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
79 +               ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1)
80                 ctf_integer_hex(const void *, action, action)
81                 ctf_integer(unsigned long, runstate, task->tk_runstate)
82                 ctf_integer(int, status, task->tk_status)
83 @@ -208,7 +208,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
84  
85         TP_FIELDS(
86                 ctf_integer(unsigned int, task_id, task->tk_pid)
87 -               ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
88 +               ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1)
89                 ctf_integer_hex(const void *, action, action)
90                 ctf_integer(unsigned long, runstate, task->tk_runstate)
91                 ctf_integer(int, status, task->tk_status)
92 -- 
93 2.17.1
94