Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGBUS error #36

Closed
emaste opened this issue Jan 12, 2021 · 5 comments
Closed

SIGBUS error #36

emaste opened this issue Jan 12, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@emaste
Copy link
Contributor

emaste commented Jan 12, 2021

Testing gitup at 498ceae.
I modified the default gitup.conf to check out under my home directory, and then ran ./gitup stable.
It finished with

 + /usr/home/emaste/src/gitup/stable-12/usr.sbin/zonectl/zonectl.c
 + /usr/home/emaste/src/gitup/stable-12/usr.sbin/zzz/Makefile
 + /usr/home/emaste/src/gitup/stable-12/usr.sbin/zzz/Makefile.depend
 + /usr/home/emaste/src/gitup/stable-12/usr.sbin/zzz/zzz.8
 + /usr/home/emaste/src/gitup/stable-12/usr.sbin/zzz/zzz.sh
Bus error (core dumped)

LLDB reports:

(lldb) bt
* thread #1, name = 'gitup', stop reason = signal SIGBUS
  * frame #0: 0x0000000000209ab3 gitup`main [inlined] Tree_Remote_Path_RB_NEXT(elm=0x5a5a5a5a5a5a5a5a) at gitup.c:216:1
    frame #1: 0x0000000000209a99 gitup`main(argc=1, argv=0x00007fffffb60618) at gitup.c:2358
    frame #2: 0x0000000000204e00 gitup`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7
(lldb) up
frame #1: 0x0000000000209a99 gitup`main(argc=1, argv=0x00007fffffb60618) at gitup.c:2358
   2355                 file_node_free(RB_REMOVE(Tree_Local_Path, &Local_Path, file));
   2356         }
   2357
-> 2358         RB_FOREACH(file, Tree_Remote_Path, &Remote_Path)
   2359                 file_node_free(RB_REMOVE(Tree_Remote_Path, &Remote_Path, file));
   2360
   2361         RB_FOREACH(object, Tree_Objects, &Objects)

Faults again if run with -v 2,

004cd0410f5d6ffe9c29763bf6a060a4a82435ef9da7 refs/user/nwhitehorn/powerpcle
0054e0eca25e0e782772938cae0ab3949ef4a05c9825 refs/user/nwhitehorn/ppc64-pmap-rework
0047edb39fac4299abc2a1b27159b368dfe2fe701c2a refs/user/nwhitehorn/rtsx
004669294c668a7a7accd01d491f943abb7098f5c2f8 refs/user/obrien/krb5bld
0049e06432800fd6e63cdb398939dbdf7aa6f5cde416 refs/user/obrien/libmd-ossl
0043c112419ed868b45ee10daef9eb10bd07242fff12 refs/user/peter/kinfo
004aac2fbb12ca0bf155d54133d505c3e8244e9c6f9a refs/user/peter/long_cpumask
003ed512e6845019beb6766607fcfd25a13256b5e065 refs/user/peterj
00436554cac6895da1f238579d18573fb5ef4d6cdd43 refs/user/pho/stress2
0# Want: 2e0dd1574137757c4267c38c11493aab005136e3
# Branch: refs/heads/stable/12
Bus error (core dumped)
@emaste
Copy link
Contributor Author

emaste commented Jan 12, 2021

elm=0x5a5a5a5a5a5a5a5a suggests a use-after-free

from jemalloc(3):

       opt.junk (const char *) r- [--enable-fill]
           Junk filling. If set to "alloc", each byte of uninitialized
           allocated memory will be initialized to 0xa5. If set to "free", all
           deallocated memory will be initialized to 0x5a. If set to "true",
           both allocated and deallocated memory will be initialized, and if
           set to "false", junk filling be disabled entirely. This is intended
           for debugging and will impact performance negatively. This option
           is "false" by default unless --enable-debug is specified during
           configuration, in which case it is "true" by default.

@johnmehr johnmehr self-assigned this Jan 12, 2021
@johnmehr johnmehr added the bug Something isn't working label Jan 12, 2021
@johnmehr
Copy link
Owner

I'm not having any luck reproducing the crash when I try and clone 2e0dd1574. When you have a moment, could you please send me a copy of your gitup.conf and /var/db/gitup/stable?

I just pushed out an update to dump some diagnostic data during the free loop. If you could give that a try and send me the last few lines before the crash, that would be great. Thank you!

@emaste
Copy link
Contributor Author

emaste commented Jan 15, 2021

Rebuilt at 6e7ef6b and still reproducible here; with -v 2 the tail end of my console output looks like:

###### 08019-3  0       5034    c17ed8208f18c1acd721ee49de1fe86acce91d2e        0       (null)
###### 08020-3  0       5297    72f8abb9e2005653e363175ec3de09a7396f143b        0       (null)
###### 08021-3  0       4996    e0a65a6a3f9105caf9d600094c4e0d776802ceb8        0       (null)
###### 08022-3  0       5270    be52763e2652676a6f4560bb1d9c3c126dcd4727        0       (null)
###### 08023-3  0       1914    d89d097752725b425a2902a5ffbb67e15fe13616        0       (null)
###### 08024-3  0       1944    4b5d6f6a4c8a0177325d8d6abc4e7e80ac4984f8        0       (null)
###### 08025-2  0       4483    392a9cfe1096ffacb8d9ef07a7bc15352e275e0b        0       (null)
###### 08026-2  0       1610    ba2c92f80bfcac71efa7856213a2e15300666093        0       (null)
###### 08027-2  0       4833    7e8e2476a521ce561025c5c1319530995d2cd2cb        0       (null)
###### 08028-2  0       1335    80d453e5b9649bb3da0562e6f11d4a62c9df819f        0       (null)
 * /usr/home/emaste/src/gitup/stable-12/lib/libc/string/memchr.c
 * /usr/home/emaste/src/gitup/stable-12/lib/libc/string/memmem.c
 * /usr/home/emaste/src/gitup/stable-12/lib/libc/string/strstr.c
 * /usr/home/emaste/src/gitup/stable-12/sbin/pfctl/pfctl_parser.c
 * /usr/home/emaste/src/gitup/stable-12/sys/compat/linuxkpi/common/src/linux_pci.c
 * /usr/home/emaste/src/gitup/stable-12/sys/conf/kmod.mk
 * /usr/home/emaste/src/gitup/stable-12/sys/kern/kern_proc.c
 * /usr/home/emaste/src/gitup/stable-12/sys/kern/kern_sig.c
 * /usr/home/emaste/src/gitup/stable-12/sys/kern/tty.c
 * /usr/home/emaste/src/gitup/stable-12/sys/x86/x86/identcpu.c
 * /usr/home/emaste/src/gitup/stable-12/sys/x86/x86/tsc.c
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/cmp/cmp.c
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/cmp/extern.h
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/cmp/link.c
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/cmp/misc.c
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/cmp/tests/cmp_test2.sh
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/diff/diffreg.c
 * /usr/home/emaste/src/gitup/stable-12/usr.bin/diff/tests/diff_test.sh
Bus error (core dumped)

Ah, it does work if I turn off malloc junk filling:

MALLOC_CONF=junk:false ./gitup -v 2 stable
...
###### 07932-2  0       172     9a6ffb41c199eda304688b177a55a1c2233ad445        0       (null)
###### 07933-2  0       153     cc3549f086712783a0fb07fdc0d5ab74bbeb640d        0       (null)
###### 07934-2  0       146     61592ccf6e50008ef58c08ed8da5dca79e49f10c        0       (null)
###### 07935-2  0       8265    e886460513c1258f628900137391c6bac1be1be6        0       (null)
###### 07936-2  0       1335    80d453e5b9649bb3da0562e6f11d4a62c9df819f        0       (null)
$ echo $?
0
$

I am running on FreeBSD-current which defaults to junk-filling by default; I think you should be able to reproduce by runinng with MALLOC_CONF=junk:true in the environment.

(My gitup.conf is what comes from git with two changes, "work_directory" : "/usr/home/emaste/src/gitup/" and "target" : "/usr/home/emaste/src/gitup/stable-12")

johnmehr added a commit that referenced this issue Jan 15, 2021
@johnmehr
Copy link
Owner

I believe I've tracked down then problem and fixed it. Is it working for you?

@emaste
Copy link
Contributor Author

emaste commented Jan 15, 2021

looks good

$ ./gitup stable
# Host: git.freebsd.org
# Port: 443
# Repository: /src.git
# Target: /usr/home/emaste/src/gitup/stable-12
# Have: 23b5fa56a182574fef416caeb55e6c735087e411
# Want: b791b5763f2bf3a3e8c45e00f66f5a63f2a12bf1
# Branch: refs/heads/stable/12
# Action: pull
 * /usr/home/emaste/src/gitup/stable-12/tools/tools/netmap/pkt-gen.c

@emaste emaste closed this as completed Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants