Project

General

Profile

Actions

Bug #1247

closed

Segfault when using liblttng-ctl to enable events in docker

Added by Christophe Bedard about 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/27/2020
Due date:
% Done:

100%

Estimated time:

Description

With LTTng 2.11

Host: Linux chrisnux 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

See attached archive to reproduce

$ ./docker_build.sh
$ ./docker_run.sh
root@...:/lttng-ctl-docker-segfault# ./build_run_app.sh

Use ./docker_build_2-10.sh to try with LTTng 2.10, which should work (i.e. not segfault).


Files

lttng-ctl-docker-segault.tar.xz (2.38 KB) lttng-ctl-docker-segault.tar.xz Christophe Bedard, 03/27/2020 11:12 AM
Actions #1

Updated by Christophe Bedard about 4 years ago

As can be seen in the Dockerfile, it's using ubuntu:bionic as a base image and uses the stable-2.11/stable-2.10 PPAs

Actions #2

Updated by Jonathan Rajotte Julien about 4 years ago

  • Status changed from New to Feedback

Hi

We were able to reproduce a similar issue with the self_check.cpp you provided using a local 2.11 lttng.

It seems that initializing the struct to zero as documented in the header file fixes it:

/*
 * Generic lttng event
 *
 * The structures should be initialized to zero before use.
 */
#define LTTNG_EVENT_PADDING1               12
#define LTTNG_EVENT_PADDING2               LTTNG_SYMBOL_NAME_LEN + 32
struct lttng_event {

self_check.cpp diff:

@ self_check_orig.cpp:24 @ int lttng_init(

    int ret = 1;
    // struct lttng_domain domain_kernel;
    struct lttng_domain domain_ust;
    struct lttng_domain domain_ust = {};
    // struct lttng_handle * channel_kernel;
    struct lttng_handle * channel_ust;

@ self_check_orig.cpp:77 @ int lttng_init(
    //     }
    // }
    for (auto it = events_ust.begin(); it != events_ust.end(); it++) {
        struct lttng_event event;
        struct lttng_event event = {};
        event.type = LTTNG_EVENT_TRACEPOINT;
        strcpy(event.name, it->c_str());
        event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;

Could you validate that it indeed fixes it inside a docker env?

Cheers

Actions #3

Updated by Christophe Bedard about 4 years ago

Yes, it does fix it!

Actions #4

Updated by Jonathan Rajotte Julien about 4 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF