Bug 2126067 - babeltrace: FTBFS in Fedora Rawhide
Summary: babeltrace: FTBFS in Fedora Rawhide
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: babeltrace
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Keith Seitz
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks: F38FTBFS
TreeView+ depends on / blocked
 
Reported: 2022-09-12 10:41 UTC by Jitka Plesnikova
Modified: 2022-09-16 19:28 UTC (History)
7 users (show)

Fixed In Version: babeltrace-1.5.8-13.fc38
Clone Of:
Environment:
Last Closed: 2022-09-16 19:28:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jitka Plesnikova 2022-09-12 10:41:26 UTC
Description of problem:
Package babeltrace fails to build from source in Fedora Rawhide.

FAIL: bin/test_trace_read 1 - Run babeltrace with trace env-warning
FAIL: bin/test_trace_read 2 - Run babeltrace with trace lttng-modules-2.0-pre5
FAIL: bin/test_trace_read 3 - Run babeltrace with trace sequence
FAIL: bin/test_trace_read 4 - Run babeltrace with trace smalltrace
FAIL: bin/test_trace_read 5 - Run babeltrace with trace succeed1
FAIL: bin/test_trace_read 6 - Run babeltrace with trace succeed2
FAIL: bin/test_trace_read 7 - Run babeltrace with trace succeed3
FAIL: bin/test_trace_read 8 - Run babeltrace with trace succeed4
FAIL: bin/test_trace_read 9 - Run babeltrace with trace warnings
FAIL: bin/test_trace_read 10 - Run babeltrace with trace wk-heartbeat-u
<...>
ERROR: bin/test_trace_read - exited with status 10
FAIL: bin/test_packet_seq_num 1 - Trace parses
PASS: bin/test_packet_seq_num 2 - No events lost
FAIL: bin/test_packet_seq_num 3 - Trace parses
PASS: bin/test_packet_seq_num 4 - No events lost
FAIL: bin/test_packet_seq_num 5 - Trace parses
FAIL: bin/test_packet_seq_num 6 - Lost events string matches 2
FAIL: bin/test_packet_seq_num 7 - Trace parses
FAIL: bin/test_packet_seq_num 8 - Lost events string matches 2
FAIL: bin/test_packet_seq_num 9 - Trace parses
FAIL: bin/test_packet_seq_num 10 - Lost events string matches 3,2,1
ERROR: bin/test_packet_seq_num - exited with status 8
FAIL: bin/intersection/test_intersection 1 - 8 events in the whole trace
FAIL: bin/intersection/test_intersection 2 - 3 events in packets intersecting
FAIL: bin/intersection/test_intersection 3 - 8 events in the whole trace
FAIL: bin/intersection/test_intersection 4 - 3 events in packets intersecting
FAIL: bin/intersection/test_intersection 5 - 6 events in the whole trace
PASS: bin/intersection/test_intersection 6 - 0 events in packets intersecting
FAIL: bin/intersection/test_intersection 7 - 3 events in the whole trace
FAIL: bin/intersection/test_intersection 8 - 3 events in packets intersecting
PASS: bin/intersection/test_intersection 9 - 0 events in the whole trace
PASS: bin/intersection/test_intersection 10 - 0 events in packets intersecting
ERROR: bin/intersection/test_intersection - exited with status 7

Version-Release number of selected component (if applicable):
1.5.8-12.fc37

Steps to Reproduce:
koji build --scratch f38 babeltrace-1.5.8-12.fc37.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/babeltrace

Dependency changes from the last successful build:
https://koschei.fedoraproject.org/build/13571370

Comment 1 Keith Seitz 2022-09-15 20:40:42 UTC
[hasty analysis]

This happens because there appears to be a use-after-free error
after adding input path names to `opt_input_paths':

In main():

        for (i = 0; i < opt_input_paths->len; i++) {
                const char *ipath = g_ptr_array_index(opt_input_paths, i);
                printf_verbose("    %s\n", ipath);
        }

With "-v", ASAN will call out the above printf:

==66444==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000000050 at pc 0x7fdd8b07481e bp 0x7ffc6f69cde0 sp 0x7ffc6f69c590

In parse_options, we loop over all non-option arguments, adding them to opt_input_paths.
The entire end of this function:

        do {
                ipath = poptGetArg(pc);
                if (ipath)
                        g_ptr_array_add(opt_input_paths, (gpointer) ipath);
        } while (ipath);
        if (opt_input_paths->len == 0) {
                ret = -EINVAL;
                goto end;
        }

end:
        if (pc) {
                poptFreeContext(pc);
        }
        return ret;

Immediately after adding `ipath' to opt_input_paths, we call poptFreeContext.
This has the affect of free'ing pc->leftovers, which is where these non-option
arguments are stored.

This is ultimately due to this upstream commit:
https://github.com/rpm-software-management/popt/commit/7182e4618ad5a0186145fc2aa4a98c2229afdfa8

We can just strdup the paths. Not optimal but sufficient.

Comment 2 Keith Seitz 2022-09-16 19:28:39 UTC
Patch committed and new build created:

https://koji.fedoraproject.org/koji/buildinfo?buildID=2063828


Note You need to log in before you can comment on or make changes to this bug.