Skip to content

Commit

Permalink
syscse: cus__load_files() requires a non NULL conf_load
Browse files Browse the repository at this point in the history
Since ff7bd70 ("core: Allow sizing the loader hash table")
dwarf__load_files(), called by cus__load_files() needs a non-NULL
conf_load argument, add one to avoid:

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7f4b1ed in dwarf__load_file (cus=0x4052a0, conf=0x0, filename=0x7fffffffe4c3 "bla") at /home/acme/git/pahole/dwarf_loader.c:3626
  3626		if (conf->max_hashtable_bits != 0) {
  (gdb) bt
  #0  0x00007ffff7f4b1ed in dwarf__load_file (cus=0x4052a0, conf=0x0, filename=0x7fffffffe4c3 "bla") at /home/acme/git/pahole/dwarf_loader.c:3626
  #1  0x00007ffff7f310f5 in cus__load_file (cus=0x4052a0, conf=0x0, filename=0x7fffffffe4c3 "bla") at /home/acme/git/pahole/dwarves.c:2074
  acmel#2  0x00007ffff7f31ca1 in cus__load_files (cus=0x4052a0, conf=0x0, filenames=0x7fffffffe1c0) at /home/acme/git/pahole/dwarves.c:2577
  acmel#3  0x000000000040177a in main (argc=2, argv=0x7fffffffe1b8) at /home/acme/git/pahole/syscse.c:159
  (gdb)

Fixes: ff7bd70 ("core: Allow sizing the loader hash table")
Reported-by: J B <[email protected]>
Link: https://lore.kernel.org/dwarves/CAJXMFhFbv5MccigKvmQt9MhYwKv2iyigEG3Bhs64BZ=PMWc0WQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Feb 27, 2024
1 parent 461f61e commit b2e0f08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion syscse.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
static const char *prefix = "sys_";
static size_t prefix_len = 4;

static struct conf_fprintf conf;

static struct conf_load conf_load = {
.conf_fprintf = &conf,
};

static bool filter(struct function *f)
{
if (f->proto.nr_parms != 0) {
Expand Down Expand Up @@ -156,7 +162,7 @@ int main(int argc, char *argv[])
argp_help(&argp, stderr, ARGP_HELP_SEE, argv[0]);
return EXIT_FAILURE;
}
err = cus__load_files(cus, NULL, argv + remaining);
err = cus__load_files(cus, &conf_load, argv + remaining);
if (err != 0) {
cus__fprintf_load_files_err(cus, "syscse", argv + remaining, err, stderr);
return EXIT_FAILURE;
Expand Down

0 comments on commit b2e0f08

Please sign in to comment.