Re: [lttng-dev] [PATCH lttng-tools v3] Fix: use newly created event filter for condition check

2019-09-25 Thread Jérémie Galarneau
Merged in master and stable-2.11.

Backported to stable-2.10, and stable-2.9.

Thanks!
Jérémie

On Tue, Sep 24, 2019 at 11:24:17AM -0400, Jonathan Rajotte wrote:
> The following commit introduced a regression while
> fixing the filter and filter_expression ownership.
> 
> commit b0a23296344e57bd2e48e62ec2d7e0d8a38661bb
> Author: Jérémie Galarneau 
> Date:   Sat Jan 12 14:53:56 2019 -0500
> 
> Fix: leak of filter bytecode and expression on agent event re-enable
> 
> The agent subsystem does not properly assume the clean-up of an
> event's filter bytecode and expression when a previously disabled
> event is re-enabled.
> 
> This change ensures that the ownership of both the filter bytecode
> and expression is assumed by the agent subsystem and discarded
> when a matching event is found.
> 
> Steps to reproduce the leak:
> $ lttng create
> $ lttng enable-event --python allo --filter 'a[42] == 241'
> $ lttng disable-event --python allo
> $ lttng enable-event --python allo --filter 'a[42] == 241'
> 
> Signed-off-by: Jérémie Galarneau 
> 
> Setting the "filter" object to NULL prevents the call to
> add_filter_app_ctx when needed.
> 
> We use the filter from the newly created event to
> perform the check and the call to add_filter_app_ctx.
> 
> Fixes coverity #1399733
> 
> Signed-off-by: Jonathan Rajotte 
> ---
>  src/bin/lttng-sessiond/event.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c
> index f32db4429..a8b7646da 100644
> --- a/src/bin/lttng-sessiond/event.c
> +++ b/src/bin/lttng-sessiond/event.c
> @@ -513,8 +513,9 @@ int event_agent_enable(struct ltt_ust_session *usess,
>   created = 1;
>   }
>  
> - if (created && filter) {
> - ret = add_filter_app_ctx(filter, filter_expression, agt);
> + if (created && aevent->filter) {
> + ret = add_filter_app_ctx(
> + aevent->filter, aevent->filter_expression, agt);
>   if (ret != LTTNG_OK) {
>   goto error;
>   }
> -- 
> 2.17.1
> 
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools] Fix: lttng-crash: detect truncated files

2019-09-25 Thread Jérémie Galarneau
Merged in master, stable-2.11, stable-2.10, and stable-2.9. Thanks!

Jérémie

On Mon, Sep 23, 2019 at 02:31:33PM -0400, Mathieu Desnoyers wrote:
> Detect truncated files which size is smaller than the ring buffer
> header.
> 
> This can be caused by a situation where sessiond is killed with SIGKILL
> while doing a metadata regenerate command.
> 
> Without this fix, lttng-crash is killed with a "Bus error" when
> encountering a truncated file.
> 
> Fixes: #1166
> Signed-off-by: Mathieu Desnoyers 
> ---
>  src/bin/lttng-crash/lttng-crash.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/bin/lttng-crash/lttng-crash.c 
> b/src/bin/lttng-crash/lttng-crash.c
> index 298ed71a..47358df9 100644
> --- a/src/bin/lttng-crash/lttng-crash.c
> +++ b/src/bin/lttng-crash/lttng-crash.c
> @@ -498,7 +498,8 @@ int check_magic(const uint8_t *magic)
>  }
>  
>  static
> -int get_crash_layout(struct lttng_crash_layout *layout, int fd)
> +int get_crash_layout(struct lttng_crash_layout *layout, int fd,
> + const char *input_file)
>  {
>   char *map;
>   int ret = 0, unmapret;
> @@ -509,7 +510,17 @@ int get_crash_layout(struct lttng_crash_layout *layout, 
> int fd)
>   const struct crash_abi_unknown *abi;
>   uint16_t endian;
>   enum lttng_crash_type layout_type;
> + struct stat stat;
>  
> + ret = fstat(fd, &stat);
> + if (ret < 0) {
> + PERROR("fstat");
> + return -1;
> + }
> + if (stat.st_size < RB_CRASH_DUMP_ABI_LEN) {
> + ERR("File: '%s' truncated", input_file);
> + return -1;
> + }
>   map = mmap(NULL, RB_CRASH_DUMP_ABI_LEN, PROT_READ, MAP_PRIVATE,
>   fd, 0);
>   if (map == MAP_FAILED) {
> @@ -838,7 +849,7 @@ int extract_file(int output_dir_fd, const char 
> *output_file,
>   }
>  
>   /* Query the crash ABI layout */
> - ret = get_crash_layout(&layout, fd_src);
> + ret = get_crash_layout(&layout, fd_src, input_file);
>   if (ret) {
>   goto close_src;
>   }
> -- 
> 2.11.0
> 
___
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] Test pid_ns in local build

2019-09-25 Thread Jérémie Galarneau
On Thu, 19 Sep 2019 at 02:12, Polzer, Franz  wrote:
>
> Hi Michael,
>
> Many thanks for your help!
>
> Is there any schedule bringing that feature into LTTng master?

Hi,

I can't give you an exact time line, but within the next 3-4 weeks.

Jérémie

>
> Thanks and br,
> Franz
>
> -Original Message-
> From: lttng-dev [mailto:lttng-dev-boun...@lists.lttng.org] On Behalf Of 
> Michael Jeanson
> Sent: Dienstag, 17. September 2019 16:06
> To: lttng-dev@lists.lttng.org
> Subject: Re: [lttng-dev] Test pid_ns in local build
>
> On 2019-09-17 4:03 a.m., Polzer, Franz wrote:
> > Hello,
> >
> > I wanted to give the pid_ns context tracing a try and built LTTng from
> > master, but I get the following error when applying this command:
> >
> > lttng add-context -k -t procname -t pid -t vpid -t tid -t vtid -t
> > pid_ns
> >
> > Error: Unknown context type pid_ns
> >
> > Maybe I need another branch to build from to get that feature in or
> > forgot to enable the feature during building?
> >
> > Where can I find documentation about the pid_ns tracing and how to
> > test the current version of that implementation?
> >
> > Thanks for your help and best regards,
> >
> > Franz
>
>
> Hi,
>
> The namespace statedump and contexts feature has not been merged in master 
> yet. You can get it from my github in the "ns" feature branches.
>
> https://github.com/mjeanson/lttng-modules/tree/ns
> https://github.com/mjeanson/lttng-ust/tree/ns
> https://github.com/mjeanson/lttng-tools/tree/ns
>
> It's a bit out of date but should work as-is, or it can be easily rebased on 
> current master branches.
>
>
> Cheers,
>
> Michael
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev



-- 
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