From: Mathieu Desnoyers Date: Thu, 21 Jul 2011 16:18:35 +0000 (-0400) Subject: Fix vpid/vppid/vtid contexts handling of sched_switch vs exit NULL nsproxy X-Git-Tag: v2.0-pre1~6 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=90f96adf9b02ecdb8c982bfda64fbfd4b11c34a8;p=lttng-modules.git Fix vpid/vppid/vtid contexts handling of sched_switch vs exit NULL nsproxy Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-context-vpid.c b/lttng-context-vpid.c index f12eb97e..3f16e03a 100644 --- a/lttng-context-vpid.c +++ b/lttng-context-vpid.c @@ -32,7 +32,13 @@ void vpid_record(struct lttng_ctx_field *field, { pid_t vpid; - vpid = task_tgid_vnr(current); + /* + * nsproxy can be NULL when scheduled out of exit. + */ + if (!current->nsproxy) + vpid = 0; + else + vpid = task_tgid_vnr(current); lib_ring_buffer_align_ctx(ctx, ltt_alignof(vpid)); chan->ops->event_write(ctx, &vpid, sizeof(vpid)); } diff --git a/lttng-context-vppid.c b/lttng-context-vppid.c index 4abf7846..f01b0206 100644 --- a/lttng-context-vppid.c +++ b/lttng-context-vppid.c @@ -31,10 +31,18 @@ void vppid_record(struct lttng_ctx_field *field, struct lib_ring_buffer_ctx *ctx, struct ltt_channel *chan) { + struct task_struct *parent; pid_t vppid; + /* + * nsproxy can be NULL when scheduled out of exit. + */ rcu_read_lock(); - vppid = task_tgid_vnr(current->real_parent); + parent = rcu_dereference(current->real_parent); + if (!parent->nsproxy) + vppid = 0; + else + vppid = task_tgid_vnr(parent); rcu_read_unlock(); lib_ring_buffer_align_ctx(ctx, ltt_alignof(vppid)); chan->ops->event_write(ctx, &vppid, sizeof(vppid)); diff --git a/lttng-context-vtid.c b/lttng-context-vtid.c index c428911e..264bbb30 100644 --- a/lttng-context-vtid.c +++ b/lttng-context-vtid.c @@ -32,7 +32,13 @@ void vtid_record(struct lttng_ctx_field *field, { pid_t vtid; - vtid = task_pid_vnr(current); + /* + * nsproxy can be NULL when scheduled out of exit. + */ + if (!current->nsproxy) + vtid = 0; + else + vtid = task_pid_vnr(current); lib_ring_buffer_align_ctx(ctx, ltt_alignof(vtid)); chan->ops->event_write(ctx, &vtid, sizeof(vtid)); }