All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH lttng-tools 1/1] Fix: consumer snapshot: handle unsigned long overflow
       [not found] <20190219224749.8979-1-mathieu.desnoyers@efficios.com>
@ 2019-03-29 18:37 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-03-29 18:37 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev, jgalar, joraj

Merged in master, stable-2.11, stable-2.10, and stable-2.9.

Thanks!
Jérémie

On Tue, Feb 19, 2019 at 05:47:49PM -0500, Mathieu Desnoyers wrote:
> Comparing the consumed iterator and the produced position without
> using a difference generates an empty snapshot when the iterator is
> before unsigned long overflow and the produced position is after
> unsigned long overflow.
> 
> This applies to both UST and kernel consumers.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
>  src/common/kernel-consumer/kernel-consumer.c | 2 +-
>  src/common/ust-consumer/ust-consumer.c       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c
> index 9bed7b55..1533e9ef 100644
> --- a/src/common/kernel-consumer/kernel-consumer.c
> +++ b/src/common/kernel-consumer/kernel-consumer.c
> @@ -234,7 +234,7 @@ int lttng_kconsumer_snapshot_channel(struct lttng_consumer_channel *channel,
>  				produced_pos, nb_packets_per_stream,
>  				stream->max_sb_size);
>  
> -		while (consumed_pos < produced_pos) {
> +		while ((long) (consumed_pos - produced_pos) < 0) {
>  			ssize_t read_len;
>  			unsigned long len, padded_len;
>  
> diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
> index 46f33005..94b761cb 100644
> --- a/src/common/ust-consumer/ust-consumer.c
> +++ b/src/common/ust-consumer/ust-consumer.c
> @@ -1168,7 +1168,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
>  				produced_pos, nb_packets_per_stream,
>  				stream->max_sb_size);
>  
> -		while (consumed_pos < produced_pos) {
> +		while ((long) (consumed_pos - produced_pos) < 0) {
>  			ssize_t read_len;
>  			unsigned long len, padded_len;
>  
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH lttng-tools 1/1] Fix: consumer snapshot: handle unsigned long overflow
@ 2019-02-19 22:47 Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2019-02-19 22:47 UTC (permalink / raw)
  To: jgalar, joraj; +Cc: lttng-dev

Comparing the consumed iterator and the produced position without
using a difference generates an empty snapshot when the iterator is
before unsigned long overflow and the produced position is after
unsigned long overflow.

This applies to both UST and kernel consumers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 src/common/kernel-consumer/kernel-consumer.c | 2 +-
 src/common/ust-consumer/ust-consumer.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c
index 9bed7b55..1533e9ef 100644
--- a/src/common/kernel-consumer/kernel-consumer.c
+++ b/src/common/kernel-consumer/kernel-consumer.c
@@ -234,7 +234,7 @@ int lttng_kconsumer_snapshot_channel(struct lttng_consumer_channel *channel,
 				produced_pos, nb_packets_per_stream,
 				stream->max_sb_size);
 
-		while (consumed_pos < produced_pos) {
+		while ((long) (consumed_pos - produced_pos) < 0) {
 			ssize_t read_len;
 			unsigned long len, padded_len;
 
diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index 46f33005..94b761cb 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -1168,7 +1168,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
 				produced_pos, nb_packets_per_stream,
 				stream->max_sb_size);
 
-		while (consumed_pos < produced_pos) {
+		while ((long) (consumed_pos - produced_pos) < 0) {
 			ssize_t read_len;
 			unsigned long len, padded_len;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-29 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190219224749.8979-1-mathieu.desnoyers@efficios.com>
2019-03-29 18:37 ` [PATCH lttng-tools 1/1] Fix: consumer snapshot: handle unsigned long overflow Jérémie Galarneau
2019-02-19 22:47 Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.