[ipxe-devel] make giving segfault

brent s. bts at square-r00t.net
Mon Oct 2 17:23:42 UTC 2017


On 10/02/2017 11:06 AM, Michael Brown wrote:
> On 01/10/17 17:02, brent s. wrote:
>>>    [LD] bin/usbdisk.bin
>>> make: *** [arch/x86/Makefile.pcbios:116: bin/usbdisk.bin] Segmentation
>>> fault (core dumped)
>>> make: *** Deleting file 'bin/usbdisk.bin'
>>> rm bin/version.ipxe.dsk.o bin/ipxe.dsk.bin bin/ipxe.lkrn.zbin
>>> bin/ipxe.dsk.zinfo bin/ipxe.lkrn.zinfo bin/ipxe.dsk.zbin
>>> bin/version.ipxe.lkrn.o bin/ipxe.lkrn.bin
> 
> If you add V=1 to the make command line then you'll see the actual
> command that is being executed.  You can then try variations on this
> command (or on its input files) to see if you can find the root cause of
> the gcc segfault.
> 
> Michael

Thanks, Michael. It seems to be the linking throwing the segfault
(reformatted for readability):

ld \
  -m elf_i386 \
  -N --no-check-sections \
  --section-start=.prefix=0 \
  --gc-sections \
  -static \
  -o bin/usbdisk.bin \
  --oformat binary \
  -e 0 \
  bin/usbdisk.o

I've attached an strace, which I hope helps, but unfortunately I don't
know C so I'm not sure how else I can help.

-- 
brent saner
https://square-r00t.net/
GPG info: https://square-r00t.net/gpg-info
-------------- next part --------------
[bts at cylon src]$ strace ld  -m elf_i386 -N --no-check-sections --section-start=.prefix=0   --gc-sections -static -o bin/usbdisk.bin --oformat binary -e 0 bin/usbdisk.o
execve("/usr/bin/ld", ["ld", "-m", "elf_i386", "-N", "--no-check-sections", "--section-start=.prefix=0", "--gc-sections", "-static", "-o", "bin/usbdisk.bin", "--oformat", "binary", "-e", "0", "bin/usbdisk.o"], 0x7ffdd7473ed0 /* 54 vars */) = 0
brk(NULL)                               = 0x559970512000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=285982, ...}) = 0
mmap(NULL, 285982, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f22eac59000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libbfd-2.29.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\r\4\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1303832, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f22eac57000
mmap(NULL, 3417600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f22ea738000
mprotect(0x7f22ea85d000, 2093056, PROT_NONE) = 0
mmap(0x7f22eaa5c000, 106496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x124000) = 0x7f22eaa5c000
mmap(0x7f22eaa76000, 17920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f22eaa76000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=14144, ...}) = 0
mmap(NULL, 2109584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f22ea534000
mprotect(0x7f22ea537000, 2093056, PROT_NONE) = 0
mmap(0x7f22ea736000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f22ea736000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\20\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2065840, ...}) = 0
mmap(NULL, 3893456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f22ea17d000
mprotect(0x7f22ea32b000, 2093056, PROT_NONE) = 0
mmap(0x7f22ea52a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ad000) = 0x7f22ea52a000
mmap(0x7f22ea530000, 14544, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f22ea530000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360!\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=92056, ...}) = 0
mmap(NULL, 2187280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f22e9f66000
mprotect(0x7f22e9f7c000, 2093056, PROT_NONE) = 0
mmap(0x7f22ea17b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f22ea17b000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f22eac55000
arch_prctl(ARCH_SET_FS, 0x7f22eac55b80) = 0
mprotect(0x7f22ea52a000, 16384, PROT_READ) = 0
mprotect(0x7f22ea17b000, 4096, PROT_READ) = 0
mprotect(0x7f22ea736000, 4096, PROT_READ) = 0
mprotect(0x7f22eaa5c000, 86016, PROT_READ) = 0
mprotect(0x55996e52e000, 20480, PROT_READ) = 0
mprotect(0x7f22eac9f000, 4096, PROT_READ) = 0
munmap(0x7f22eac59000, 285982)          = 0
getrusage(RUSAGE_SELF, {ru_utime={tv_sec=0, tv_usec=3442}, ru_stime={tv_sec=0, tv_usec=0}, ...}) = 0
brk(NULL)                               = 0x559970512000
brk(0x559970533000)                     = 0x559970533000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1998448, ...}) = 0
mmap(NULL, 1998448, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f22e9d7e000
close(3)                                = 0
open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=56095, ...}) = 0
read(3, "# GNU libc iconv configuration.\n"..., 4096) = 4096
read(3, "1002//\tJUS_I.B1.002//\nmodule\tJUS"..., 4096) = 4096
read(3, "ISO-IR-110//\t\tISO-8859-4//\nalias"..., 4096) = 4096
read(3, "\t\tISO-8859-14//\nalias\tISO_8859-1"..., 4096) = 4096
read(3, "IC-ES//\nalias\tEBCDICES//\t\tEBCDIC"..., 4096) = 4096
read(3, "DIC-CP-ES//\t\tIBM284//\nalias\tCSIB"..., 4096) = 4096
read(3, "//\nalias\tCSIBM864//\t\tIBM864//\nal"..., 4096) = 4096
read(3, "BM939//\nmodule\tIBM939//\t\tINTERNA"..., 4096) = 4096
read(3, "EUC-CN//\nalias\tCN-GB//\t\t\tEUC-CN/"..., 4096) = 4096
read(3, "T//\nmodule\tISO-2022-CN-EXT//\tINT"..., 4096) = 4096
read(3, "//\t\tISO_5428//\nalias\tISO_5428:19"..., 4096) = 4096
read(3, "CII-8\t1\n\n#\tfrom\t\t\tto\t\t\tmodule\t\tc"..., 4096) = 4096
read(3, "\tfrom\t\t\tto\t\t\tmodule\t\tcost\nalias\t"..., 4096) = 4096
brk(0x559970554000)                     = 0x559970554000
read(3, "712//\t\tINTERNAL\t\tIBM12712\t\t1\nmod"..., 4096) = 2847
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2997, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2997
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/ld.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=4*1024}) = 0
stat("bin/usbdisk.bin", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
openat(AT_FDCWD, "bin/usbdisk.bin", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
brk(0x559970578000)                     = 0x559970578000
openat(AT_FDCWD, "bin/usbdisk.o", O_RDONLY) = 4
fcntl(4, F_GETFD)                       = 0
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=1049692, ...}) = 0
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\3\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
lseek(4, 0, SEEK_SET)                   = 0
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\1\0\3\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 4096, SEEK_SET)                = 4096
lseek(4, 1048576, SEEK_SET)             = 1048576
read(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 1116
lseek(4, 1049692, SEEK_SET)             = 1049692
lseek(4, 1049692, SEEK_SET)             = 1049692
lseek(4, 1049692, SEEK_SET)             = 1049692
lseek(4, 1049692, SEEK_SET)             = 1049692
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x2c} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20171002/97c7fb28/attachment.sig>


More information about the ipxe-devel mailing list