Fix: compat ioctl for flush/get metadata version
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2016 01:16:22 +0000 (21:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2016 19:36:04 +0000 (15:36 -0400)
Unlike the non-compat version, the compat ioctl lttng ABI code for the
ring buffer flush operation does not invoke
lttng_metadata_output_channel before calling the ring buffer operation.
This could lead to incomplete metadata on 64-bit kernels running with
32-bit lttng userland.

There is also a discrepancy between the non-compat and compat code: the
GET_METADATA_VERSION operation is performed before calling the ring
buffer code. Ensure both non-compat and compat code are alike.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-abi.c

index 9845930d9ebc87bd7e86f0c0bd06eb95317d66da..cc3d4b5bf37765a50f8b8860b28b22e9639a241e 100644 (file)
@@ -739,6 +739,21 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
                 */
                return -ENOSYS;
        }
+       case RING_BUFFER_FLUSH:
+       {
+               struct lttng_metadata_stream *stream = filp->private_data;
+               struct lib_ring_buffer *buf = stream->priv;
+               struct channel *chan = buf->backend.chan;
+
+               /*
+                * Before doing the actual ring buffer flush, write up to one
+                * packet of metadata in the ring buffer.
+                */
+               ret = lttng_metadata_output_channel(stream, chan);
+               if (ret < 0)
+                       goto err;
+               break;
+       }
        default:
                break;
        }
This page took 0.027129 seconds and 4 git commands to generate.