Re: [lttng-dev] [PATCH] Fix: SUNRPC: Fix oops when trace sunrpc_task events in nfs client

2019-12-12 Thread Mathieu Desnoyers
Merged into lttng-modules master, 2.11, 2.10 branches, thanks!

I added the following commits on top, taking care of another OOPS
that was missed by this patch, and adapting the type of the field
to a signed integer:

commit b6903d57e4c3234ec5b1c7f72e232023cdee0fab
Author: Mathieu Desnoyers 
Date:   Thu Dec 12 10:39:38 2019 -0500

sunrpc: introduce lttng_get_clid helper

Introduce the lttng_get_clid helper to always check for NULL pointer
when getting the client id. While not always strictly needed depending
on the tracepoint callsite, prefer robustness of instrumentation and
always check for NULL rather than play whack-a-mole.

Signed-off-by: Mathieu Desnoyers 

commit 70389e422dd3146161089d454f525367c9046ecd
Author: Mathieu Desnoyers 
Date:   Thu Dec 12 10:29:37 2019 -0500

Fix: sunrpc: use signed integer for client id

Within include/linux/sunrpc/clnt.h:struct rpc_cltn, the cl_clid field
is an unsigned integer, which is the type expected by the tracepoint
signature.

However, looking into net/sunrpc/clnt.c:rpc_alloc_clid(), its allocation
considers negative signed integer as errors.

Therefore, in order to properly show "-1" in the trace output (rather
than MAX_INT) when called with a NULL task->tk_client, move to a
signed integer as backing type for the client_id field.

Signed-off-by: Mathieu Desnoyers 

commit 032a74d83b263c4faead8e4c25d497fb8ea07b6e
Author: Mathieu Desnoyers 
Date:   Thu Dec 12 10:29:02 2019 -0500

Fix: sunrpc: null rpc_clnt dereference in rpc_task_queued tracepoint

Based on upstream Linux commit:

commit 0be283f676a1e7b208db0c992283197ef8b52158
Author: Benjamin Coddington 
Date:   Tue Jan 23 09:32:35 2018 -0500

SUNRPC: Fix null rpc_clnt dereference in rpc_task_queued tracepoint

Backchannel tasks will not have a reference to the rpc_clnt.  Return -1 
for
cl_clid in that case.

Signed-off-by: Benjamin Coddington 
Signed-off-by: Trond Myklebust 

Signed-off-by: Mathieu Desnoyers 




- On Dec 5, 2019, at 2:35 AM, quanyang wang quanyang.w...@windriver.com 
wrote:

> From: Quanyang Wang 
> 
> See upstream commit :
> 
>   commit 2ca310fc4160ed0420da65534a21ae77b24326a8
>   Author: Ditang Chen 
>   Date: Fri, 7 Mar 2014 13:27:57 +0800
>   Subject: SUNRPC: Fix oops when trace sunrpc_task events in nfs client
> 
>   When tracking sunrpc_task events in nfs client, the clnt pointer may be 
> NULL.
> 
>   [  139.269266] BUG: unable to handle kernel NULL pointer dereference at
>   0004
>   [  139.269915] IP: []
>   ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
>   [  139.269915] PGD 1d293067 PUD 1d294067 PMD 0
>   [  139.269915] Oops:  [#1] SMP
>   [  139.269915] Modules linked in: nfsv4 dns_resolver nfs lockd sunrpc 
> fscache sg
>   ppdev e1000
>   serio_raw pcspkr parport_pc parport i2c_piix4 i2c_core microcode xfs 
> libcrc32c
>   sd_mod sr_mod
>   cdrom ata_generic crc_t10dif crct10dif_common pata_acpi ahci libahci 
> ata_piix
>   libata dm_mirror
>   dm_region_hash dm_log dm_mod
>   [  139.269915] CPU: 0 PID: 59 Comm: kworker/0:2 Not tainted 
> 3.10.0-84.el7.x86_64
>   #1
>   [  139.269915] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
>   VirtualBox 12/01/2006
>   [  139.269915] Workqueue: rpciod rpc_async_schedule [sunrpc]
>   [  139.269915] task: 88001b598000 ti: 88001b632000 task.ti:
>   88001b632000
>   [  139.269915] RIP: 0010:[]  []
>   ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
>   [  139.269915] RSP: 0018:88001b633d70  EFLAGS: 00010206
>   [  139.269915] RAX: 88001dfc5338 RBX: 88001cc37a00 RCX: 
> 88001dfc5334
>   [  139.269915] RDX: 88001dfc5338 RSI:  RDI: 
> 88001dfc533c
>   [  139.269915] RBP: 88001b633db0 R08: 002c R09: 
> 000a
>   [  139.269915] R10: 00062180 R11: 0020759fb9dc R12: 
> a0292c20
>   [  139.269915] R13: 88001dfc5334 R14:  R15: 
> 
>   [  139.269915] FS:  () GS:88001fc0()
>   knlGS:
>   [  139.269915] CS:  0010 DS:  ES:  CR0: 8005003b
>   [  139.269915] CR2: 0004 CR3: 1d29 CR4: 
> 06f0
>   [  139.269915] DR0:  DR1:  DR2: 
> 
>   [  139.269915] DR3:  DR6: 0ff0 DR7: 
> 0400
>   [  139.269915] Stack:
>   [  139.269915]  1b633d98 0246 88001df1dc00
>   88001cc37a00
>   [  139.269915]  88001bc35e60  88001ffa0a48
>   88001bc35ee0
>   [  139.269915]  88001b633e08 a02704b5 0001000

Re: [lttng-dev] [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up

2019-12-12 Thread Jérémie Galarneau
All patches of this series were merged in stable-1.5.

Thanks!
Jérémie

On Thu, 5 Dec 2019 at 01:58, Mathieu Desnoyers
 wrote:
>
> Attaching to a stream hung up before providing any trace packet
> causes ctf_open_mmap_stream_read() to return an error.
>
> This kind of scenario can happen with the upcoming "lttng clear"
> feature.
>
> Signed-off-by: Mathieu Desnoyers 
> ---
>  formats/ctf/ctf.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index 980ebc9a..1ba9017f 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -2571,8 +2571,13 @@ int ctf_open_mmap_stream_read(struct ctf_trace *td,
> }
>
> ret = prepare_mmap_stream_definition(td, file_stream, packet_seek);
> -   if (ret)
> +   if (ret) {
> +   /* We need to check for EOF here for empty files. */
> +   if (unlikely(file_stream->pos.offset == EOF)) {
> +   ret = 0;
> +   }
> goto error_index;
> +   }
>
> /*
>  * For now, only a single clock per trace is supported.
> --
> 2.17.1
>


-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev