Dwarves Archive mirror
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: dwarves@vger.kernel.org, Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: bpf@vger.kernel.org, "Dmitry V. Levin" <ldv@altlinux.org>
Subject: pahole 1.25 SIGSEGV when building kernel (-j when cores > 81)
Date: Wed, 5 Jul 2023 05:00:40 +0300	[thread overview]
Message-ID: <20230705020040.bqhtd3yxpntk44q5@altlinux.org> (raw)

Hi,

After updating Dwarves to v1.25 we are getting SIGSEGV while building
kernel on 32-bit x86 architecture. It looks like this:

    BTF     .btf.vmlinux.bin.o
  scripts/link-vmlinux.sh: line 111: 395728 Segmentation fault      LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1}
    LD      .tmp_vmlinux.kallsyms1
    NM      .tmp_vmlinux.kallsyms1.syms
    KSYMS   .tmp_vmlinux.kallsyms1.S
    AS      .tmp_vmlinux.kallsyms1.S
    LD      .tmp_vmlinux.kallsyms2
    NM      .tmp_vmlinux.kallsyms2.syms
    KSYMS   .tmp_vmlinux.kallsyms2.S
    AS      .tmp_vmlinux.kallsyms2.S
    LD      vmlinux
    BTFIDS  vmlinux
  libbpf: failed to find '.BTF' ELF section in vmlinux
  FAILED: load BTF from vmlinux: No data available

What crashes is this command:

  pahole -J --btf_gen_floats -j --lang_exclude=rust .tmp_vmlinux.btf

I found that cause of the crash is that build box having 128 cores. By
experiment I found that with -j81 pahole works OK, but with -j82 or
greater it crashes.

  $ gdb -q --args pahole -J --btf_gen_floats -j111 --lang_exclude=rust .tmp_vmlinux.btf
  Thread 15 "pahole" received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0xda5ffb40 (LWP 3102466)]
  0xf7f3c944 in btf_encoder__btf (encoder=0x0) at /usr/src/debug/dwarves-1.25/btf_encoder.c:1890
  1890            return encoder->btf;
  (gdb) bt
  #0  0xf7f3c944 in btf_encoder__btf (encoder=0x0) at /usr/src/debug/dwarves-1.25/btf_encoder.c:1890
  #1  0x5655c25d in pahole_stealer (cu=0xd9a01f80, conf_load=0x565640c0 <conf_load>, thr_data=0x56567c18) at /usr/src/debug/dwarves-1.25/pahole.c:3100
  #2  0xf7f452d7 in cu__finalize (cu=cu@entry=0xd9a01f80, conf=0x565640c0 <conf_load>, thr_data=thr_data@entry=0x56567c18)
      at /usr/src/debug/dwarves-1.25/dwarf_loader.c:3001
  #3  0xf7f4541d in cus__finalize (thr_data=0x56567c18, conf=<optimized out>, cu=0xd9a01f80, cus=0x565651c0) at /usr/src/debug/dwarves-1.25/dwarf_loader.c:3008
  #4  dwarf_cus__create_and_process_cu (dcus=dcus@entry=0xffffd19c, cu_die=cu_die@entry=0xda5ff38c, pointer_size=<optimized out>, thr_data=0x56567c18)
      at /usr/src/debug/dwarves-1.25/dwarf_loader.c:3207
  #5  0xf7f461af in dwarf_cus__process_cu_thread (arg=0xffffcbf8) at /usr/src/debug/dwarves-1.25/dwarf_loader.c:3250
  #6  0xf7db4258 in start_thread (arg=<optimized out>) at pthread_create.c:444
  #7  0xf7e3a878 in clone3 () from /lib/libc.so.6
  (gdb) p encoder
  $1 = (struct btf_encoder *) 0x0
  (gdb) f 1
  #1  0x5655c25d in pahole_stealer (cu=0xd9a01f80, conf_load=0x565640c0 <conf_load>, thr_data=0x56567c18) at /usr/src/debug/dwarves-1.25/pahole.c:3100
  3100                                    thread->btf = btf_encoder__btf(thread->encoder);
  (gdb) list -2
  3093                                    thread->encoder =
  3094                                            btf_encoder__new(cu, detached_btf_filename,
  3095                                                             NULL,
  3096                                                             skip_encoding_btf_vars,
  3097                                                             btf_encode_force,
  3098                                                             btf_gen_floats,
  3099                                                             global_verbose);
  3100                                    thread->btf = btf_encoder__btf(thread->encoder);
  3101                            }
  3102                            encoder = thread->encoder;

I think that return value of btf_encoder__new is not checked. But did
not investigate further why is this happening. It would be great to have
this fixed.

Thanks,


             reply	other threads:[~2023-07-05  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05  2:00 Vitaly Chikunov [this message]
2023-07-10 13:42 ` pahole 1.25 SIGSEGV when building kernel (-j when cores > 81) Arnaldo Carvalho de Melo
2023-07-10 20:00   ` Vitaly Chikunov
2023-09-14  3:37     ` Vitaly Chikunov
2023-09-15  2:02       ` Vitaly Chikunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230705020040.bqhtd3yxpntk44q5@altlinux.org \
    --to=vt@altlinux.org \
    --cc=acme@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=ldv@altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).