Subject: mtree segfaults under Solaris 10
To: None <tech-pkg@netbsd.org>
From: Malcolm Herbert <mjch@mjch.net>
List: tech-pkg
Date: 07/23/2007 15:40:46
I'm running mtree from an oldish pkgsrc under Solaris 10, but I'm seeing
annoying segfaults when trying to generate a configuration from a
directory using the -c option. Annoying in the sense that I haven't been
able to reliably reproduce this issue ...

The binary I have has the following version strings:

|dogbert[/store/mjch/patch] 13v>: ident /usr/pkg/sbin/mtree
|/usr/pkg/sbin/mtree:
|     $NetBSD: compare.c,v 1.4 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: crc.c,v 1.3 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: create.c,v 1.4 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: excludes.c,v 1.4 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: misc.c,v 1.2 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: mtree.c,v 1.3 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: spec.c,v 1.3 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: verify.c,v 1.4 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: stat_flags.c,v 1.3 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: pack_dev.c,v 1.2 2004/08/21 04:10:45 jlam Exp $
|     $NetBSD: rmd160hl.c,v 1.6 2004/08/23 03:32:12 jlam Exp $
|     $NetBSD: rmd160.c,v 1.6 2004/08/23 03:32:12 jlam Exp $

The version of solaris I'm using here is:

|dogbert[/store/mjch/patch] 14v>: cat /etc/release
|                         Solaris 10 3/05 s10_74L2a SPARC
|           Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
|                        Use is subject to license terms.
|                            Assembled 22 January 2005
|

truss output gives the following:

|dogbert[/store/mjch/patch] 140v#: truss /usr/pkg/sbin/mtree -c
|execve("/net/bosko/store/mjch/pkgsrc/root/usr/pkg/sbin/mtree", 0xFFBFF35C, 0xFFBFF368)  argc = 2
|resolvepath("/usr/lib/ld.so.1", "/lib/ld.so.1", 1023) = 12
|resolvepath("/net/bosko/store/mjch/pkgsrc/root/usr/pkg/sbin/mtree", "/net/bosko/store/mjch/pkgsrc/root/usr/pkg/sbin/mtree", 1023) = 52
|stat("/net/bosko/store/mjch/pkgsrc/root/usr/pkg/sbin/mtree", 0xFFBFF138) = 0
|open("/var/ld/ld.config", O_RDONLY)             = 3
|fstat(3, 0xFFBFEBD0)                            = 0
|mmap(0x00000000, 116, PROT_READ, MAP_SHARED, 3, 0) = 0xFF3A0000
|close(3)                                        = 0
|stat("/user/mjch/lib/libc.so.1", 0xFFBFEC58)    Err#2 ENOENT
|stat("/usr/lib/libc.so.1", 0xFFBFEC58)          = 0
|resolvepath("/usr/lib/libc.so.1", "/lib/libc.so.1", 1023) = 14
|open("/usr/lib/libc.so.1", O_RDONLY)            = 3
|mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFF390000
|mmap(0x00010000, 991232, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF280000
|mmap(0xFF280000, 881573, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF280000
|mmap(0xFF368000, 29469, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 3, 884736) = 0xFF368000
|mmap(0xFF370000, 2592, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFF370000
|munmap(0xFF358000, 65536)                       = 0
|memcntl(0xFF280000, 139692, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
|close(3)                                        = 0
|munmap(0xFF390000, 8192)                        = 0
|mmap(0x00010000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF390000
|getcontext(0xFFBFEE30)
|getrlimit(RLIMIT_STACK, 0xFFBFEE10)             = 0
|getpid()                                        = 7831 [7830]
|setustack(0xFF392088)
|getcwd("/store/mjch/patch", 1024)               = 0
|time()                                          = 1185167835
|sysinfo(SI_HOSTNAME, "dogbert", 257)            = 8
|fstat64(0, 0xFFBFEC38)                          = 0
|ioctl(0, TCGETA, 0xFFBFEBC4)                    = 0
|stat64("/dev/tty", 0xFFBFEB40)                  = 0
|stat64("/dev/console", 0xFFBFEB40)              = 0
|stat64("/dev/conslog", 0xFFBFEB40)              = 0
|stat64("/dev/syscon", 0xFFBFEB40)               = 0
|stat64("/dev/systty", 0xFFBFEB40)               = 0
|stat64("/dev/wscons", 0xFFBFEB40)               = 0
|stat64("/dev/ptmx", 0xFFBFEB40)                 = 0
|stat64("/dev/ttyp0", 0xFFBFEA38)                = 0
|stat64("/dev/ptyp0", 0xFFBFEA38)                = 0
|open("/etc/ttysrch", O_RDONLY)                  = 3
|fstat64(3, 0xFFBFEA38)                          = 0
|brk(0x0004BE68)                                 = 0
|brk(0x0004DE68)                                 = 0
|read(3, " #\n #   C o p y r i g h".., 1495)     = 1495
|close(3)                                        = 0
|stat64("/dev/pts/24", 0xFFBFEA38)               = 0
|mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF380000
|stat("/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1", 0xFFBFE5C0) = 0
|resolvepath("/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1", "/platform/sun4u/lib/libc_psr.so.1", 1023) = 33
|open("/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1", O_RDONLY) = 3
|mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFF270000
|mmap(0x00002000, 16384, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF3F8000
|mmap(0xFF3F8000, 13512, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 3, 0) = 0xFF3F8000
|close(3)                                        = 0
|munmap(0xFF270000, 8192)                        = 0
|open("/var/adm/utmpx", O_RDONLY)                = 3
|fstat64(3, 0xFFBFEB78)                          = 0
|brk(0x0004DE68)                                 = 0
|brk(0x0004FE68)                                 = 0
|fstat64(3, 0xFFBFEA20)                          = 0
|ioctl(3, TCGETA, 0xFFBFEB04)                    Err#25 ENOTTY
|read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 8192
|read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 5200
|read(3, 0x0004C5AC, 8192)                       = 0
|llseek(3, 0, SEEK_CUR)                          = 13392
|close(3)                                        = 0
|open("/usr/share/lib/zoneinfo/Australia/Victoria", O_RDONLY) = 3
|fstat64(3, 0xFFBFEF30)                          = 0
|read(3, " T Z i f\0\0\0\0\0\0\0\0".., 785)      = 785
|close(3)                                        = 0
|ioctl(1, TCGETA, 0xFFBFE304)                    = 0
|fstat64(1, 0xFFBFE220)                          = 0
|    Incurred fault #6, FLTBOUNDS  %pc = 0xFF2B0BF0
|      siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000
|    Received signal #11, SIGSEGV [default]
|      siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000

Can anyone shed any light on this?  Alternately, is there a version of mtree which
I can compile and test without needing pkgsrc around it?

-- 
Malcolm Herbert                                This brain intentionally
mjch@mjch.net                                                left blank