• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 20684862027

03 Jan 2026 10:26PM UTC coverage: 72.702% (+0.03%) from 72.677%
20684862027

push

github

web-flow
core/dynamic-user: two trivial modernizations (#40264)

2 of 4 new or added lines in 1 file covered. (50.0%)

215 existing lines in 37 files now uncovered.

310139 of 426587 relevant lines covered (72.7%)

1143601.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.61
/src/shared/elf-util.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#if HAVE_ELFUTILS
4
#include <dwarf.h>
5
#include <elfutils/libdwelf.h>
6
#include <elfutils/libdwfl.h>
7
#include <libelf.h>
8
#endif
9
#include <unistd.h>
10

11
#include "sd-json.h"
12

13
#include "alloc-util.h"
14
#include "coredump-util.h"
15
#include "dlfcn-util.h"
16
#include "elf-util.h"
17
#include "errno-util.h"
18
#include "escape.h"
19
#include "fd-util.h"
20
#include "fileio.h"
21
#include "format-util.h"
22
#include "io-util.h"
23
#include "json-util.h"
24
#include "log.h"
25
#include "memstream-util.h"
26
#include "path-util.h"
27
#include "process-util.h"
28
#include "set.h"
29
#include "string-util.h"
30

31
#define FRAMES_MAX 64
32
#define THREADS_MAX 64
33
#define ELF_PACKAGE_METADATA_ID 0xcafe1a7e
34

35
/* The amount of data we're willing to write to each of the output pipes. */
36
#define COREDUMP_PIPE_MAX (1024*1024U)
37

38
#if HAVE_ELFUTILS
39

40
static void *dw_dl = NULL;
41
static void *elf_dl = NULL;
42

43
/* libdw symbols */
44
static DLSYM_PROTOTYPE(dwarf_attr_integrate) = NULL;
45
static DLSYM_PROTOTYPE(dwarf_diename) = NULL;
46
static DLSYM_PROTOTYPE(dwarf_formstring) = NULL;
47
static DLSYM_PROTOTYPE(dwarf_getscopes) = NULL;
48
static DLSYM_PROTOTYPE(dwarf_getscopes_die) = NULL;
49
static DLSYM_PROTOTYPE(dwelf_elf_begin) = NULL;
50
static DLSYM_PROTOTYPE(dwelf_elf_e_machine_string) = NULL;
51
static DLSYM_PROTOTYPE(dwelf_elf_gnu_build_id) = NULL;
52
static DLSYM_PROTOTYPE(dwarf_tag) = NULL;
53
static DLSYM_PROTOTYPE(dwfl_addrmodule) = NULL;
54
static DLSYM_PROTOTYPE(dwfl_begin) = NULL;
55
static DLSYM_PROTOTYPE(dwfl_build_id_find_elf) = NULL;
56
static DLSYM_PROTOTYPE(dwfl_core_file_attach) = NULL;
57
static DLSYM_PROTOTYPE(dwfl_core_file_report) = NULL;
58
#if HAVE_DWFL_SET_SYSROOT
59
static DLSYM_PROTOTYPE(dwfl_set_sysroot) = NULL;
60
#endif
61
static DLSYM_PROTOTYPE(dwfl_end) = NULL;
62
static DLSYM_PROTOTYPE(dwfl_errmsg) = NULL;
63
static DLSYM_PROTOTYPE(dwfl_errno) = NULL;
64
static DLSYM_PROTOTYPE(dwfl_frame_pc) = NULL;
65
static DLSYM_PROTOTYPE(dwfl_getmodules) = NULL;
66
static DLSYM_PROTOTYPE(dwfl_getthreads) = NULL;
67
static DLSYM_PROTOTYPE(dwfl_module_addrdie) = NULL;
68
static DLSYM_PROTOTYPE(dwfl_module_addrname) = NULL;
69
static DLSYM_PROTOTYPE(dwfl_module_build_id) = NULL;
70
static DLSYM_PROTOTYPE(dwfl_module_getelf) = NULL;
71
static DLSYM_PROTOTYPE(dwfl_module_info) = NULL;
72
static DLSYM_PROTOTYPE(dwfl_offline_section_address) = NULL;
73
static DLSYM_PROTOTYPE(dwfl_report_end) = NULL;
74
static DLSYM_PROTOTYPE(dwfl_standard_find_debuginfo) = NULL;
75
static DLSYM_PROTOTYPE(dwfl_thread_getframes) = NULL;
76
static DLSYM_PROTOTYPE(dwfl_thread_tid) = NULL;
77

78
/* libelf symbols */
79
static DLSYM_PROTOTYPE(elf_begin) = NULL;
80
static DLSYM_PROTOTYPE(elf_end) = NULL;
81
static DLSYM_PROTOTYPE(elf_getdata_rawchunk) = NULL;
82
static DLSYM_PROTOTYPE(gelf_getehdr) = NULL;
83
static DLSYM_PROTOTYPE(elf_getphdrnum) = NULL;
84
static DLSYM_PROTOTYPE(elf_errmsg) = NULL;
85
static DLSYM_PROTOTYPE(elf_errno) = NULL;
86
static DLSYM_PROTOTYPE(elf_memory) = NULL;
87
static DLSYM_PROTOTYPE(elf_version) = NULL;
88
static DLSYM_PROTOTYPE(gelf_getphdr) = NULL;
89
static DLSYM_PROTOTYPE(gelf_getnote) = NULL;
90

91
#endif
92

93
int dlopen_dw(void) {
33✔
94
#if HAVE_ELFUTILS
95
        int r;
33✔
96

97
        ELF_NOTE_DLOPEN("dw",
33✔
98
                        "Support for backtrace and ELF package metadata decoding from core files",
99
                        ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
100
                        "libdw.so.1");
101

102
        r = dlopen_many_sym_or_warn(
33✔
103
                        &dw_dl, "libdw.so.1", LOG_DEBUG,
104
                        DLSYM_ARG(dwarf_getscopes),
105
                        DLSYM_ARG(dwarf_getscopes_die),
106
                        DLSYM_ARG(dwarf_tag),
107
                        DLSYM_ARG(dwarf_attr_integrate),
108
                        DLSYM_ARG(dwarf_formstring),
109
                        DLSYM_ARG(dwarf_diename),
110
                        DLSYM_ARG(dwelf_elf_gnu_build_id),
111
                        DLSYM_ARG(dwelf_elf_begin),
112
                        DLSYM_ARG(dwelf_elf_e_machine_string),
113
                        DLSYM_ARG(dwfl_addrmodule),
114
                        DLSYM_ARG(dwfl_frame_pc),
115
                        DLSYM_ARG(dwfl_module_addrdie),
116
                        DLSYM_ARG(dwfl_module_addrname),
117
                        DLSYM_ARG(dwfl_module_info),
118
                        DLSYM_ARG(dwfl_module_build_id),
119
                        DLSYM_ARG(dwfl_module_getelf),
120
                        DLSYM_ARG(dwfl_begin),
121
                        DLSYM_ARG(dwfl_core_file_report),
122
#if HAVE_DWFL_SET_SYSROOT
123
                        DLSYM_ARG(dwfl_set_sysroot),
124
#endif
125
                        DLSYM_ARG(dwfl_report_end),
126
                        DLSYM_ARG(dwfl_getmodules),
127
                        DLSYM_ARG(dwfl_core_file_attach),
128
                        DLSYM_ARG(dwfl_end),
129
                        DLSYM_ARG(dwfl_errmsg),
130
                        DLSYM_ARG(dwfl_errno),
131
                        DLSYM_ARG(dwfl_build_id_find_elf),
132
                        DLSYM_ARG(dwfl_standard_find_debuginfo),
133
                        DLSYM_ARG(dwfl_thread_tid),
134
                        DLSYM_ARG(dwfl_thread_getframes),
135
                        DLSYM_ARG(dwfl_getthreads),
136
                        DLSYM_ARG(dwfl_offline_section_address));
137
        if (r <= 0)
33✔
138
                return r;
×
139

140
        return 1;
141
#else
142
        return -EOPNOTSUPP;
143
#endif
144
}
145

146
int dlopen_elf(void) {
33✔
147
#if HAVE_ELFUTILS
148
        int r;
33✔
149

150
        ELF_NOTE_DLOPEN("elf",
33✔
151
                        "Support for backtraces and reading ELF package metadata from core files",
152
                        ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
153
                        "libelf.so.1");
154

155
        r = dlopen_many_sym_or_warn(
33✔
156
                        &elf_dl, "libelf.so.1", LOG_DEBUG,
157
                        DLSYM_ARG(elf_begin),
158
                        DLSYM_ARG(elf_end),
159
                        DLSYM_ARG(elf_getphdrnum),
160
                        DLSYM_ARG(elf_getdata_rawchunk),
161
                        DLSYM_ARG(elf_errmsg),
162
                        DLSYM_ARG(elf_errno),
163
                        DLSYM_ARG(elf_memory),
164
                        DLSYM_ARG(elf_version),
165
                        DLSYM_ARG(gelf_getehdr),
166
                        DLSYM_ARG(gelf_getphdr),
167
                        DLSYM_ARG(gelf_getnote));
168
        if (r <= 0)
33✔
169
                return r;
×
170

171
        return 1;
172
#else
173
        return -EOPNOTSUPP;
174
#endif
175
}
176

177
#if HAVE_ELFUTILS
178

179
typedef struct StackContext {
180
        MemStream m;
181
        Dwfl *dwfl;
182
        Elf *elf;
183
        unsigned n_thread;
184
        unsigned n_frame;
185
        sd_json_variant **package_metadata;
186
        sd_json_variant **dlopen_metadata;
187
        Set **modules;
188
} StackContext;
189

190
static void stack_context_done(StackContext *c) {
28✔
191
        assert(c);
28✔
192

193
        memstream_done(&c->m);
28✔
194

195
        if (c->dwfl) {
28✔
196
                sym_dwfl_end(c->dwfl);
12✔
197
                c->dwfl = NULL;
12✔
198
        }
199

200
        if (c->elf) {
28✔
201
                sym_elf_end(c->elf);
28✔
202
                c->elf = NULL;
28✔
203
        }
204
}
28✔
205

206
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(Elf *, sym_elf_end, elf_endp, NULL);
×
207

208
static int frame_callback(Dwfl_Frame *frame, void *userdata) {
134✔
209
        StackContext *c = ASSERT_PTR(userdata);
134✔
210
        Dwarf_Addr pc, pc_adjusted;
134✔
211
        const char *fname = NULL, *symbol = NULL;
134✔
212
        Dwfl_Module *module;
134✔
213
        bool is_activation;
134✔
214
        uint64_t module_offset = 0;
134✔
215

216
        assert(frame);
134✔
217

218
        if (c->n_frame >= FRAMES_MAX)
134✔
219
                return DWARF_CB_ABORT;
134✔
220

221
        if (!sym_dwfl_frame_pc(frame, &pc, &is_activation))
134✔
222
                return DWARF_CB_ABORT;
223

224
        pc_adjusted = pc - (is_activation ? 0 : 1);
134✔
225

226
        module = sym_dwfl_addrmodule(c->dwfl, pc_adjusted);
134✔
227
        if (module) {
134✔
228
                Dwarf_Addr start, bias = 0;
134✔
229
                Dwarf_Die *cudie;
134✔
230

231
                cudie = sym_dwfl_module_addrdie(module, pc_adjusted, &bias);
134✔
232
                if (cudie) {
134✔
233
                        _cleanup_free_ Dwarf_Die *scopes = NULL;
110✔
234
                        int n;
55✔
235

236
                        n = sym_dwarf_getscopes(cudie, pc_adjusted - bias, &scopes);
55✔
237
                        if (n > 0)
55✔
238
                                for (Dwarf_Die *s = scopes; s && s < scopes + n; s++) {
65✔
239
                                        Dwarf_Attribute *a, space;
65✔
240

241
                                        if (!IN_SET(sym_dwarf_tag(s), DW_TAG_subprogram, DW_TAG_inlined_subroutine, DW_TAG_entry_point))
65✔
242
                                                continue;
10✔
243

244
                                        a = sym_dwarf_attr_integrate(s, DW_AT_MIPS_linkage_name, &space);
55✔
245
                                        if (!a)
55✔
246
                                                a = sym_dwarf_attr_integrate(s, DW_AT_linkage_name, &space);
55✔
247
                                        if (a)
55✔
248
                                                symbol = sym_dwarf_formstring(a);
×
249
                                        if (!symbol)
55✔
250
                                                symbol = sym_dwarf_diename(s);
55✔
251

252
                                        if (symbol)
55✔
253
                                                break;
254
                                }
255
                }
256

257
                if (!symbol)
55✔
258
                        symbol = sym_dwfl_module_addrname(module, pc_adjusted);
79✔
259

260
                fname = sym_dwfl_module_info(module, NULL, &start, NULL, NULL, NULL, NULL, NULL);
134✔
261
                module_offset = pc - start;
134✔
262
        }
263

264
        if (c->m.f)
134✔
265
                fprintf(c->m.f, "#%-2u 0x%016" PRIx64 " %s (%s + 0x%" PRIx64 ")\n", c->n_frame, (uint64_t) pc, strna(symbol), strna(fname), module_offset);
173✔
266
        c->n_frame++;
134✔
267

268
        return DWARF_CB_OK;
134✔
269
}
270

271
static int thread_callback(Dwfl_Thread *thread, void *userdata) {
12✔
272
        StackContext *c = ASSERT_PTR(userdata);
12✔
273
        pid_t tid;
12✔
274

275
        assert(thread);
12✔
276

277
        if (c->n_thread >= THREADS_MAX)
12✔
278
                return DWARF_CB_ABORT;
279

280
        if (c->n_thread != 0 && c->m.f)
12✔
281
                fputc('\n', c->m.f);
×
282

283
        c->n_frame = 0;
12✔
284

285
        if (c->m.f) {
12✔
286
                tid = sym_dwfl_thread_tid(thread);
12✔
287
                fprintf(c->m.f, "Stack trace of thread " PID_FMT ":\n", tid);
12✔
288
        }
289

290
        if (sym_dwfl_thread_getframes(thread, frame_callback, c) < 0)
12✔
291
                return DWARF_CB_ABORT;
292

293
        c->n_thread++;
11✔
294

295
        return DWARF_CB_OK;
11✔
296
}
297

298
static char* build_package_reference(
×
299
                const char *type,
300
                const char *name,
301
                const char *version,
302
                const char *arch) {
303

304
        /* Construct an identifier for a specific version of the package. The syntax is most suitable for
305
         * rpm: the resulting string can be used directly in queries and rpm/dnf/yum commands. For dpkg and
306
         * other systems, it might not be usable directly, but users should still be able to figure out the
307
         * meaning.
308
         */
309

310
        return strjoin(type ?: "package",
×
311
                       " ",
312
                       name,
313

314
                       version ? "-" : "",
315
                       strempty(version),
316

317
                       /* arch is meaningful even without version, so always print it */
318
                       arch ? "." : "",
319
                       strempty(arch));
320
}
321

322
static void report_module_metadata(StackContext *c, const char *name, sd_json_variant *metadata) {
×
323
        assert(c);
×
324
        assert(name);
×
325

326
        if (!c->m.f)
×
327
                return;
328

329
        fprintf(c->m.f, "Module %s", name);
×
330

331
        if (metadata) {
×
332
                const char
×
333
                        *build_id = sd_json_variant_string(sd_json_variant_by_key(metadata, "buildId")),
×
334
                        *type = sd_json_variant_string(sd_json_variant_by_key(metadata, "type")),
×
335
                        *package = sd_json_variant_string(sd_json_variant_by_key(metadata, "name")),
×
336
                        *version = sd_json_variant_string(sd_json_variant_by_key(metadata, "version")),
×
337
                        *arch = sd_json_variant_string(sd_json_variant_by_key(metadata, "architecture"));
×
338

339
                if (package) {
×
340
                        /* Version/architecture is only meaningful with a package name.
341
                         * Skip the detailed fields if package is unknown. */
342
                        _cleanup_free_ char *id = build_package_reference(type, package, version, arch);
×
343
                        fprintf(c->m.f, " from %s", strnull(id));
×
344
                }
345

346
                if (build_id && !(package && version))
×
347
                        fprintf(c->m.f, ", build-id=%s", build_id);
×
348
        }
349

350
        fputs("\n", c->m.f);
×
351
}
352

353
static int parse_metadata(const char *name, sd_json_variant *id_json, Elf *elf, bool *ret_interpreter_found, StackContext *c) {
96✔
354
        bool package_metadata_found = false, interpreter_found = false;
96✔
355
        size_t n_program_headers;
96✔
356
        int r;
96✔
357

358
        assert(name);
96✔
359
        assert(elf);
96✔
360
        assert(c);
96✔
361

362
        /* When iterating over PT_LOAD we will visit modules more than once */
363
        if (set_contains(*c->modules, name))
96✔
364
                return 0;
96✔
365

366
        r = sym_elf_getphdrnum(elf, &n_program_headers);
96✔
367
        if (r < 0) /* Not the handle we are looking for - that's ok, skip it */
96✔
368
                return 0;
369

370
        /* Iterate over all program headers in that ELF object. These will have been copied by
371
         * the kernel verbatim when the core file is generated. */
372
        for (size_t i = 0; i < n_program_headers; ++i) {
1,237✔
373
                GElf_Phdr mem, *program_header;
1,141✔
374
                GElf_Nhdr note_header;
1,141✔
375
                Elf_Data *data;
1,141✔
376

377
                /* Package metadata is in PT_NOTE headers. */
378
                program_header = sym_gelf_getphdr(elf, i, &mem);
1,141✔
379
                if (!program_header || !IN_SET(program_header->p_type, PT_NOTE, PT_INTERP))
1,141✔
380
                        continue;
916✔
381

382
                if (program_header->p_type == PT_INTERP) {
250✔
383
                        interpreter_found = true;
25✔
384
                        continue;
25✔
385
                }
386

387
                /* Fortunately there is an iterator we can use to walk over the
388
                 * elements of a PT_NOTE program header. We are interested in the
389
                 * note with type. */
390
                data = sym_elf_getdata_rawchunk(elf,
450✔
391
                                                program_header->p_offset,
225✔
392
                                                program_header->p_filesz,
225✔
393
                                                ELF_T_NHDR);
394
                if (!data)
225✔
395
                        continue;
×
396

397
                for (size_t note_offset = 0, name_offset, desc_offset;
398
                     note_offset < data->d_size &&
749✔
399
                     (note_offset = sym_gelf_getnote(data, note_offset, &note_header, &name_offset, &desc_offset)) > 0;) {
524✔
400

401
                        _cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL, *w = NULL;
810✔
402
                        const char *payload = (const char *)data->d_buf + desc_offset;
524✔
403

404
                        if (note_header.n_namesz == 0 || note_header.n_descsz == 0)
524✔
405
                                continue;
×
406

407
                        /* Package metadata might have different owners, but the
408
                         * magic ID is always the same. */
409
                        if (!IN_SET(note_header.n_type, ELF_PACKAGE_METADATA_ID, ELF_NOTE_DLOPEN_TYPE))
524✔
410
                                continue;
238✔
411

412
                        _cleanup_free_ char *payload_0suffixed = NULL;
286✔
413
                        assert(note_offset > desc_offset);
286✔
414
                        size_t payload_len = note_offset - desc_offset;
286✔
415

416
                        /* If we are lucky and the payload is NUL-padded, we don't need to copy the string.
417
                         * But if happens to go all the way until the end of the buffer, make a copy. */
418
                        if (payload[payload_len-1] != '\0') {
286✔
419
                                payload_0suffixed = memdup_suffix0(payload, payload_len);
×
420
                                if (!payload_0suffixed)
×
421
                                        return log_oom();
×
422
                                payload = payload_0suffixed;
423
                        }
424

425
                        r = sd_json_parse(payload, 0, &v, NULL, NULL);
286✔
426
                        if (r < 0) {
286✔
427
                                _cleanup_free_ char *esc = cescape(payload);
×
428
                                return log_error_errno(r, "json_parse on \"%s\" failed: %m", strnull(esc));
×
429
                        }
430

431
                        if (note_header.n_type == ELF_PACKAGE_METADATA_ID) {
286✔
432
                                /* If we have a build-id, merge it in the same JSON object so that it appears all
433
                                 * nicely together in the logs/metadata. */
434
                                if (id_json) {
×
435
                                        r = sd_json_variant_merge_object(&v, id_json);
×
436
                                        if (r < 0)
×
437
                                                return log_error_errno(r, "sd_json_variant_merge of package meta with buildId failed: %m");
×
438
                                }
439

440
                                /* Pretty-print to the buffer, so that the metadata goes as plaintext in the
441
                                 * journal. */
442
                                report_module_metadata(c, name, v);
×
443

444
                                /* Then we build a new object using the module name as the key, and merge it
445
                                 * with the previous parses, so that in the end it all fits together in a single
446
                                 * JSON blob. */
447
                                r = sd_json_buildo(&w, SD_JSON_BUILD_PAIR_VARIANT(name, v));
×
448
                                if (r < 0)
×
449
                                        return log_error_errno(r, "Failed to build JSON object: %m");
×
450

451
                                r = sd_json_variant_merge_object(c->package_metadata, w);
×
452
                                if (r < 0)
×
453
                                        return log_error_errno(r, "sd_json_variant_merge of package meta with buildId failed: %m");
×
454

455
                                package_metadata_found = true;
456
                        } else if (c->dlopen_metadata) {
286✔
457
                                sd_json_variant *z;
286✔
458

459
                                JSON_VARIANT_ARRAY_FOREACH(z, v) {
572✔
460
                                        r = sd_json_variant_append_array(c->dlopen_metadata, z);
286✔
461
                                        if (r < 0)
286✔
462
                                                return log_error_errno(r, "Failed to append entry to dlopen metadata: %m");
×
463
                                }
464
                        }
465

466
                        /* Finally stash the name, so we avoid double visits. */
467
                        r = set_put_strdup(c->modules, name);
286✔
468
                        if (r < 0)
286✔
469
                                return log_error_errno(r, "set_put_strdup failed: %m");
×
470

471
                        if (!c->dlopen_metadata) {
286✔
472
                                if (ret_interpreter_found)
×
473
                                        *ret_interpreter_found = interpreter_found;
×
474

475
                                return 1;
×
476
                        }
477
                }
478
        }
479

480
        if (ret_interpreter_found)
96✔
481
                *ret_interpreter_found = interpreter_found;
4✔
482

483
        return c->dlopen_metadata ? 0 : package_metadata_found;
96✔
484
}
485

486
/* Get the build-id out of an ELF object or a dwarf core module. */
487
static int parse_buildid(Dwfl_Module *mod, Elf *elf, const char *name, StackContext *c, sd_json_variant **ret_id_json) {
96✔
488
        _cleanup_(sd_json_variant_unrefp) sd_json_variant *id_json = NULL;
96✔
489
        const unsigned char *id;
96✔
490
        GElf_Addr id_vaddr;
96✔
491
        ssize_t id_len;
96✔
492
        int r;
96✔
493

494
        assert(mod || elf);
96✔
495
        assert(name);
96✔
496
        assert(c);
96✔
497

498
        if (mod)
96✔
499
                id_len = sym_dwfl_module_build_id(mod, &id, &id_vaddr);
92✔
500
        else
501
                id_len = sym_dwelf_elf_gnu_build_id(elf, (const void **)&id);
4✔
502
        if (id_len <= 0) {
96✔
503
                /* If we don't find a build-id, note it in the journal message, and try
504
                 * anyway to find the package metadata. It's unlikely to have the latter
505
                 * without the former, but there's no hard rule. */
506
                if (c->m.f)
×
507
                        fprintf(c->m.f, "Module %s without build-id.\n", name);
×
508
        } else {
509
                /* We will later parse package metadata json and pass it to our caller. Prepare the
510
                * build-id in json format too, so that it can be appended and parsed cleanly. It
511
                * will then be added as metadata to the journal message with the stack trace. */
512
                r = sd_json_buildo(&id_json, SD_JSON_BUILD_PAIR_HEX("buildId", id, id_len));
96✔
513
                if (r < 0)
96✔
514
                        return log_error_errno(r, "json_build on buildId failed: %m");
×
515
        }
516

517
        if (ret_id_json)
96✔
518
                *ret_id_json = TAKE_PTR(id_json);
96✔
519

520
        return 0;
521
}
522

523
static int module_callback(Dwfl_Module *mod, void **userdata, const char *name, Dwarf_Addr start, void *arg) {
92✔
524
        _cleanup_(sd_json_variant_unrefp) sd_json_variant *id_json = NULL;
92✔
525
        StackContext *c = ASSERT_PTR(arg);
92✔
526
        size_t n_program_headers;
92✔
527
        GElf_Addr bias;
92✔
528
        int r;
92✔
529
        Elf *elf;
92✔
530

531
        assert(mod);
92✔
532

533
        if (!name)
92✔
534
                name = "(unnamed)"; /* For logging purposes */
×
535

536
        /* We are iterating on each "module", which is what dwfl calls ELF objects contained in the
537
         * core file, and extracting the build-id first and then the package metadata.
538
         * We proceed in a best-effort fashion - not all ELF objects might contain both or either.
539
         * The build-id is easy, as libdwfl parses it during the sym_dwfl_core_file_report() call and
540
         * stores it separately in an internal library struct. */
541
        r = parse_buildid(mod, NULL, name, c, &id_json);
92✔
542
        if (r < 0)
92✔
543
                return DWARF_CB_ABORT;
544

545
        /* The .note.package metadata is more difficult. From the module, we need to get a reference
546
         * to the ELF object first. We might be lucky and just get it from elfutils. */
547
        elf = sym_dwfl_module_getelf(mod, &bias);
92✔
548
        if (elf) {
92✔
549
                r = parse_metadata(name, id_json, elf, NULL, c);
92✔
550
                if (r < 0)
92✔
551
                        return DWARF_CB_ABORT;
552
                if (r > 0)
92✔
553
                        return DWARF_CB_OK;
554
        } else
555
                elf = c->elf;
×
556

557
        /* We did not get the ELF object, or it's just a reference to the core. That is likely
558
         * because we didn't get direct access to the executable, and the version of elfutils does
559
         * not yet support parsing it out of the core file directly.
560
         * So fallback to manual extraction - get the PT_LOAD section from the core,
561
         * and if it's the right one we can interpret it as an Elf object, and parse
562
         * its notes manually. */
563

564
        r = sym_elf_getphdrnum(elf, &n_program_headers);
92✔
565
        if (r < 0) {
92✔
566
                log_warning("Could not parse number of program headers from core file: %s",
×
567
                            sym_elf_errmsg(-1)); /* -1 retrieves the most recent error */
568
                report_module_metadata(c, name, id_json);
×
569

570
                return DWARF_CB_OK;
571
        }
572

573
        for (size_t i = 0; i < n_program_headers; ++i) {
1,179✔
574
                GElf_Phdr mem, *program_header;
1,087✔
575
                Elf_Data *data;
1,087✔
576
                GElf_Addr end_of_segment;
1,087✔
577

578
                /* The core file stores the ELF files in the PT_LOAD segment. */
579
                program_header = sym_gelf_getphdr(elf, i, &mem);
1,087✔
580
                if (!program_header || program_header->p_type != PT_LOAD)
1,087✔
581
                        continue;
1,087✔
582

583
                /* Check that the end of segment is a valid address. */
584
                if (!ADD_SAFE(&end_of_segment, program_header->p_vaddr, program_header->p_memsz)) {
332✔
585
                        log_error("Abort due to corrupted core dump, end of segment address %#zx + %#zx overflows", (size_t)program_header->p_vaddr, (size_t)program_header->p_memsz);
×
586
                        return DWARF_CB_ABORT;
×
587
                }
588

589
                /* This PT_LOAD segment doesn't contain the start address, so it can't be the module we are looking for. */
590
                if (start < program_header->p_vaddr || start >= end_of_segment)
332✔
591
                        continue;
332✔
592

593
                /* Now get a usable Elf reference, and parse the notes from it. */
594
                data = sym_elf_getdata_rawchunk(elf,
×
595
                                                program_header->p_offset,
×
596
                                                program_header->p_filesz,
×
597
                                                ELF_T_NHDR);
598
                if (!data)
×
599
                        continue;
×
600

601
                _cleanup_(elf_endp) Elf *memelf = sym_elf_memory(data->d_buf, data->d_size);
×
602
                if (!memelf)
×
603
                        continue;
×
604

605
                r = parse_metadata(name, id_json, memelf, NULL, c);
×
606
                if (r < 0)
×
607
                        return DWARF_CB_ABORT;
×
608
                if (r > 0)
×
609
                        break;
610
        }
611

612
        return DWARF_CB_OK;
613
}
614

615
static int parse_core(
12✔
616
                int fd,
617
                const char *root,
618
                char **ret,
619
                sd_json_variant **ret_package_metadata,
620
                sd_json_variant **ret_dlopen_metadata) {
621

622
        const Dwfl_Callbacks callbacks = {
12✔
623
                .find_elf = sym_dwfl_build_id_find_elf,
624
                .section_address = sym_dwfl_offline_section_address,
625
                .find_debuginfo = sym_dwfl_standard_find_debuginfo,
626
        };
627

628
        _cleanup_(sd_json_variant_unrefp) sd_json_variant *package_metadata = NULL, *dlopen_metadata = NULL;
12✔
629
        _cleanup_set_free_ Set *modules = NULL;
12✔
630
        _cleanup_(stack_context_done) StackContext c = {
12✔
631
                .package_metadata = &package_metadata,
632
                .dlopen_metadata = ret_dlopen_metadata ? &dlopen_metadata : NULL,
12✔
633
                .modules = &modules,
634
        };
635
        int r;
12✔
636

637
        assert(fd >= 0);
12✔
638

639
        if (lseek(fd, 0, SEEK_SET) < 0)
12✔
640
                return log_warning_errno(errno, "Failed to seek to beginning of the core file: %m");
×
641

642
        if (ret && !memstream_init(&c.m))
12✔
643
                return log_oom();
×
644

645
        sym_elf_version(EV_CURRENT);
12✔
646

647
        c.elf = sym_elf_begin(fd, ELF_C_READ_MMAP, NULL);
12✔
648
        if (!c.elf)
12✔
649
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, elf_begin() failed: %s", sym_elf_errmsg(sym_elf_errno()));
×
650

651
        c.dwfl = sym_dwfl_begin(&callbacks);
12✔
652
        if (!c.dwfl)
12✔
653
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_begin() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
654

655
        if (empty_or_root(root))
12✔
656
                root = NULL;
657
#if HAVE_DWFL_SET_SYSROOT
658
        if (root && sym_dwfl_set_sysroot(c.dwfl, root) < 0)
×
659
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not set root directory, dwfl_set_sysroot() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
660
#else
661
        if (root)
662
                log_warning("Compiled without dwfl_set_sysroot() support, ignoring provided root directory.");
663
#endif
664

665
        if (sym_dwfl_core_file_report(c.dwfl, c.elf, NULL) < 0)
12✔
666
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_core_file_report() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
667

668
        if (sym_dwfl_report_end(c.dwfl, NULL, NULL) != 0)
12✔
669
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_report_end() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
670

671
        if (sym_dwfl_getmodules(c.dwfl, &module_callback, &c, 0) < 0)
12✔
672
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_getmodules() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
673

674
        if (sym_dwfl_core_file_attach(c.dwfl, c.elf) < 0)
12✔
675
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_core_file_attach() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
676

677
        if (sym_dwfl_getthreads(c.dwfl, thread_callback, &c) < 0)
12✔
678
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse core file, dwfl_getthreads() failed: %s", sym_dwfl_errmsg(sym_dwfl_errno()));
×
679

680
        if (ret) {
12✔
681
                r = memstream_finalize(&c.m, ret, NULL);
12✔
682
                if (r < 0)
12✔
683
                        return log_warning_errno(r, "Could not parse core file, flushing file buffer failed: %m");
×
684
        }
685

686
        if (ret_package_metadata)
12✔
687
                *ret_package_metadata = TAKE_PTR(package_metadata);
12✔
688
        if (ret_dlopen_metadata)
12✔
689
                *ret_dlopen_metadata = TAKE_PTR(dlopen_metadata);
12✔
690

691
        return 0;
692
}
693

694
static int parse_elf(
16✔
695
                int fd,
696
                const char *executable,
697
                const char *root,
698
                char **ret,
699
                sd_json_variant **ret_package_metadata,
700
                sd_json_variant **ret_dlopen_metadata) {
701
        _cleanup_(sd_json_variant_unrefp) sd_json_variant *package_metadata = NULL, *dlopen_metadata = NULL, *elf_metadata = NULL;
29✔
702
        _cleanup_set_free_ Set *modules = NULL;
16✔
703
        _cleanup_(stack_context_done) StackContext c = {
16✔
704
                .package_metadata = &package_metadata,
705
                .dlopen_metadata = ret_dlopen_metadata ? &dlopen_metadata : NULL,
16✔
706
                .modules = &modules,
707
        };
708
        const char *elf_type;
16✔
709
        GElf_Ehdr elf_header;
16✔
710
        int r;
16✔
711

712
        assert(fd >= 0);
16✔
713

714
        if (lseek(fd, 0, SEEK_SET) < 0)
16✔
715
                return log_warning_errno(errno, "Failed to seek to beginning of the ELF file: %m");
×
716

717
        if (ret && !memstream_init(&c.m))
16✔
718
                return log_oom();
×
719

720
        sym_elf_version(EV_CURRENT);
16✔
721

722
        c.elf = sym_elf_begin(fd, ELF_C_READ_MMAP, NULL);
16✔
723
        if (!c.elf)
16✔
724
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse ELF file, elf_begin() failed: %s", sym_elf_errmsg(sym_elf_errno()));
×
725

726
        if (!sym_gelf_getehdr(c.elf, &elf_header))
16✔
727
                return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "Could not parse ELF file, gelf_getehdr() failed: %s", sym_elf_errmsg(sym_elf_errno()));
×
728

729
        if (elf_header.e_type == ET_CORE) {
16✔
730
                _cleanup_free_ char *out = NULL;
12✔
731

732
                r = parse_core(fd, root, ret ? &out : NULL, &package_metadata, &dlopen_metadata);
12✔
733
                if (r < 0)
12✔
734
                        return log_warning_errno(r, "Failed to inspect core file: %m");
×
735

736
                if (out)
12✔
737
                        fprintf(c.m.f, "%s", out);
12✔
738

739
                elf_type = "coredump";
12✔
740
        } else {
741
                _cleanup_(sd_json_variant_unrefp) sd_json_variant *id_json = NULL;
4✔
742
                const char *e = executable ?: "(unnamed)";
4✔
743
                bool interpreter_found = false;
4✔
744

745
                r = parse_buildid(NULL, c.elf, e, &c, &id_json);
4✔
746
                if (r < 0)
4✔
747
                        return log_warning_errno(r, "Failed to parse build-id of ELF file: %m");
×
748

749
                r = parse_metadata(e, id_json, c.elf, &interpreter_found, &c);
4✔
750
                if (r < 0)
4✔
751
                        return log_warning_errno(r, "Failed to parse package metadata of ELF file: %m");
×
752

753
                /* If we found a build-id and nothing else, return at least that. */
754
                if (!package_metadata && id_json) {
4✔
755
                        r = sd_json_buildo(&package_metadata, SD_JSON_BUILD_PAIR_VARIANT(e, id_json));
4✔
756
                        if (r < 0)
4✔
757
                                return log_warning_errno(r, "Failed to build JSON object: %m");
×
758
                }
759

760
                if (interpreter_found)
4✔
761
                        elf_type = "executable";
762
                else
763
                        elf_type = "library";
2✔
764
        }
765

766
        /* Note that e_type is always DYN for both executables and libraries, so we can't tell them apart from the header,
767
         * but we will search for the PT_INTERP section when parsing the metadata. */
768
        r = sd_json_buildo(&elf_metadata, SD_JSON_BUILD_PAIR_STRING("elfType", elf_type));
16✔
769
        if (r < 0)
16✔
770
                return log_warning_errno(r, "Failed to build JSON object: %m");
×
771

772
        const char *elf_architecture = sym_dwelf_elf_e_machine_string(elf_header.e_machine);
16✔
773
        if (elf_architecture) {
16✔
774
                r = sd_json_variant_merge_objectbo(
16✔
775
                                &elf_metadata,
776
                                SD_JSON_BUILD_PAIR_STRING("elfArchitecture", elf_architecture));
777
                if (r < 0)
16✔
778
                        return log_warning_errno(r, "Failed to add elfArchitecture field: %m");
×
779

780
                if (ret)
16✔
781
                        fprintf(c.m.f, "ELF object binary architecture: %s\n", elf_architecture);
14✔
782
        }
783

784
        /* We always at least have the ELF type, so merge that (and possibly the arch). */
785
        r = sd_json_variant_merge_object(&elf_metadata, package_metadata);
16✔
786
        if (r < 0)
16✔
787
                return log_warning_errno(r, "Failed to merge JSON objects: %m");
×
788

789
        if (ret) {
16✔
790
                r = memstream_finalize(&c.m, ret, NULL);
14✔
791
                if (r < 0)
14✔
792
                        return log_warning_errno(r, "Could not parse ELF file, flushing file buffer failed: %m");
×
793
        }
794

795
        if (ret_package_metadata)
16✔
796
                *ret_package_metadata = TAKE_PTR(elf_metadata);
14✔
797
        if (ret_dlopen_metadata)
16✔
798
                *ret_dlopen_metadata = TAKE_PTR(dlopen_metadata);
2✔
799

800
        return 0;
801
}
802

803
#endif
804

805
int parse_elf_object(
32✔
806
                int fd,
807
                const char *executable,
808
                const char *root,
809
                bool fork_disable_dump,
810
                char **ret,
811
                sd_json_variant **ret_package_metadata,
812
                sd_json_variant **ret_dlopen_metadata) {
813
#if HAVE_ELFUTILS
814
        _cleanup_close_pair_ int error_pipe[2] = EBADF_PAIR,
16✔
815
                                 return_pipe[2] = EBADF_PAIR,
16✔
816
                                 package_metadata_pipe[2] = EBADF_PAIR,
16✔
817
                                 dlopen_metadata_pipe[2] = EBADF_PAIR;
16✔
818
        _cleanup_(sd_json_variant_unrefp) sd_json_variant *package_metadata = NULL, *dlopen_metadata = NULL;
16✔
819
        _cleanup_free_ char *buf = NULL;
16✔
820
        int r;
32✔
821

822
        assert(fd >= 0);
32✔
823

824
        r = dlopen_dw();
32✔
825
        if (r < 0)
32✔
826
                return r;
827

828
        r = dlopen_elf();
32✔
829
        if (r < 0)
32✔
830
                return r;
831

832
        r = RET_NERRNO(pipe2(error_pipe, O_CLOEXEC|O_NONBLOCK));
32✔
833
        if (r < 0)
×
834
                return r;
835

836
        if (ret) {
32✔
837
                r = RET_NERRNO(pipe2(return_pipe, O_CLOEXEC|O_NONBLOCK));
28✔
838
                if (r < 0)
×
839
                        return r;
840
        }
841

842
        if (ret_package_metadata) {
32✔
843
                r = RET_NERRNO(pipe2(package_metadata_pipe, O_CLOEXEC|O_NONBLOCK));
28✔
844
                if (r < 0)
×
845
                        return r;
846
        }
847

848
        if (ret_dlopen_metadata) {
32✔
849
                r = RET_NERRNO(pipe2(dlopen_metadata_pipe, O_CLOEXEC|O_NONBLOCK));
4✔
850
                if (r < 0)
×
851
                        return r;
852
        }
853

854
        /* Parsing possibly malformed data is crash-happy, so fork. In case we crash,
855
         * the core file will not be lost, and the messages will still be attached to
856
         * the journal. Reading the elf object might be slow, but it still has an upper
857
         * bound since the core files have an upper size limit. It's also not doing any
858
         * system call or interacting with the system in any way, besides reading from
859
         * the file descriptor and writing into these four pipes. */
860
        r = pidref_safe_fork_full(
64✔
861
                        "(sd-parse-elf)",
862
                        /* stdio_fds= */ NULL,
863
                        (int[]) { fd, error_pipe[1], return_pipe[1], package_metadata_pipe[1], dlopen_metadata_pipe[1] },
32✔
864
                        5,
865
                        FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_NEW_MOUNTNS|FORK_MOUNTNS_SLAVE|FORK_NEW_USERNS|FORK_WAIT|FORK_REOPEN_LOG,
866
                        /* ret= */ NULL);
867
        if (r < 0) {
32✔
868
                if (r == -EPROTO) { /* We should have the errno from the child, but don't clobber original error */
×
869
                        ssize_t k;
×
UNCOV
870
                        int e;
×
871

872
                        k = read(error_pipe[0], &e, sizeof(e));
×
873
                        if (k < 0 && errno != EAGAIN) /* Pipe is non-blocking, EAGAIN means there's nothing */
×
874
                                return -errno;
×
875
                        if (k == sizeof(e))
×
876
                                return e; /* propagate error sent to us from child */
×
UNCOV
877
                        if (k != 0)
×
878
                                return -EIO;
879
                }
880

UNCOV
881
                return r;
×
882
        }
883
        if (r == 0) {
32✔
884
                /* We want to avoid loops, given this can be called from systemd-coredump */
885
                if (fork_disable_dump) {
16✔
886
                        r = set_dumpable(SUID_DUMP_DISABLE);
×
887
                        if (r < 0)
×
UNCOV
888
                                report_errno_and_exit(error_pipe[1], r);
×
889
                }
890

891
                r = parse_elf(
34✔
892
                                fd,
893
                                executable,
894
                                root,
895
                                ret ? &buf : NULL,
896
                                ret_package_metadata ? &package_metadata : NULL,
897
                                ret_dlopen_metadata ? &dlopen_metadata : NULL);
898
                if (r < 0)
16✔
UNCOV
899
                        report_errno_and_exit(error_pipe[1], r);
×
900

901
                if (buf) {
16✔
902
                        size_t len = strlen(buf);
14✔
903

904
                        if (len > COREDUMP_PIPE_MAX) {
14✔
905
                                /* This is iffy. A backtrace can be a few hundred kilobytes, but too much is
906
                                 * too much. Let's log a warning and ignore the rest. */
UNCOV
907
                                log_warning("Generated backtrace is %zu bytes (more than the limit of %u bytes), backtrace will be truncated.",
×
908
                                            len, COREDUMP_PIPE_MAX);
909
                                len = COREDUMP_PIPE_MAX;
910
                        }
911

912
                        /* Bump the space for the returned string.
913
                         * Failure is ignored, because partial output is still useful. */
914
                        (void) fcntl(return_pipe[1], F_SETPIPE_SZ, len);
14✔
915

916
                        r = loop_write(return_pipe[1], buf, len);
14✔
917
                        if (r == -EAGAIN)
14✔
UNCOV
918
                                log_warning("Write failed, backtrace will be truncated.");
×
919
                        else if (r < 0)
14✔
UNCOV
920
                                report_errno_and_exit(error_pipe[1], r);
×
921

922
                        return_pipe[1] = safe_close(return_pipe[1]);
14✔
923
                }
924

925
                if (package_metadata) {
16✔
UNCOV
926
                        _cleanup_fclose_ FILE *json_out = NULL;
×
927

928
                        /* Bump the space for the returned string. We don't know how much space we'll need in
929
                         * advance, so we'll just try to write as much as possible and maybe fail later. */
930
                        (void) fcntl(package_metadata_pipe[1], F_SETPIPE_SZ, COREDUMP_PIPE_MAX);
14✔
931

932
                        json_out = take_fdopen(&package_metadata_pipe[1], "w");
14✔
933
                        if (!json_out)
14✔
UNCOV
934
                                report_errno_and_exit(error_pipe[1], -errno);
×
935

936
                        r = sd_json_variant_dump(package_metadata, SD_JSON_FORMAT_FLUSH, json_out, NULL);
14✔
937
                        if (r < 0)
14✔
938
                                log_warning_errno(r, "Failed to write JSON package metadata, ignoring: %m");
14✔
939
                }
940

941
                if (dlopen_metadata) {
16✔
UNCOV
942
                        _cleanup_fclose_ FILE *json_out = NULL;
×
943

944
                        /* Bump the space for the returned string. We don't know how much space we'll need in
945
                         * advance, so we'll just try to write as much as possible and maybe fail later. */
946
                        (void) fcntl(dlopen_metadata_pipe[1], F_SETPIPE_SZ, COREDUMP_PIPE_MAX);
2✔
947

948
                        json_out = take_fdopen(&dlopen_metadata_pipe[1], "w");
2✔
949
                        if (!json_out)
2✔
UNCOV
950
                                report_errno_and_exit(error_pipe[1], -errno);
×
951

952
                        r = sd_json_variant_dump(dlopen_metadata, SD_JSON_FORMAT_FLUSH, json_out, NULL);
2✔
953
                        if (r < 0)
2✔
954
                                log_warning_errno(r, "Failed to write JSON package metadata, ignoring: %m");
2✔
955
                }
956

957
                _exit(EXIT_SUCCESS);
16✔
958
        }
959

960
        error_pipe[1] = safe_close(error_pipe[1]);
16✔
961
        return_pipe[1] = safe_close(return_pipe[1]);
16✔
962
        package_metadata_pipe[1] = safe_close(package_metadata_pipe[1]);
16✔
963
        dlopen_metadata_pipe[1] = safe_close(dlopen_metadata_pipe[1]);
16✔
964

965
        if (ret) {
16✔
UNCOV
966
                _cleanup_fclose_ FILE *in = NULL;
×
967

968
                in = take_fdopen(&return_pipe[0], "r");
14✔
969
                if (!in)
14✔
UNCOV
970
                        return -errno;
×
971

972
                r = read_full_stream(in, &buf, NULL);
14✔
973
                if (r < 0)
14✔
974
                        return r;
975
        }
976

977
        if (ret_package_metadata) {
16✔
UNCOV
978
                _cleanup_fclose_ FILE *json_in = NULL;
×
979

980
                json_in = take_fdopen(&package_metadata_pipe[0], "r");
14✔
981
                if (!json_in)
14✔
UNCOV
982
                        return -errno;
×
983

984
                r = sd_json_parse_file(json_in, NULL, 0, &package_metadata, NULL, NULL);
14✔
985
                if (r < 0 && r != -ENODATA) /* ENODATA: json was empty, so we got nothing, but that's ok */
14✔
986
                        log_warning_errno(r, "Failed to read or parse package metadata, ignoring: %m");
14✔
987
        }
988

989
        if (ret_dlopen_metadata) {
16✔
990
                _cleanup_fclose_ FILE *json_in = NULL;
16✔
991

992
                json_in = take_fdopen(&dlopen_metadata_pipe[0], "r");
2✔
993
                if (!json_in)
2✔
UNCOV
994
                        return -errno;
×
995

996
                r = sd_json_parse_file(json_in, NULL, 0, &dlopen_metadata, NULL, NULL);
2✔
997
                if (r < 0 && r != -ENODATA) /* ENODATA: json was empty, so we got nothing, but that's ok */
2✔
998
                        log_warning_errno(r, "Failed to read or parse dlopen metadata, ignoring: %m");
2✔
999
        }
1000

1001
        if (ret)
16✔
1002
                *ret = TAKE_PTR(buf);
14✔
1003
        if (ret_package_metadata)
16✔
1004
                *ret_package_metadata = TAKE_PTR(package_metadata);
14✔
1005
        if (ret_dlopen_metadata)
16✔
1006
                *ret_dlopen_metadata = TAKE_PTR(dlopen_metadata);
2✔
1007

1008
        return 0;
1009
#else
1010
        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "elfutils disabled, parsing ELF objects not supported");
1011
#endif
1012
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc