"C. Bergstr??m" writes:
> Hi Tom/David,
> > I've got the core file.  I'll try to take a look at it sometime today.
> >
> > First, I'd like to back off a little bit to make sure that I understand
> > what we're doing here.
> >
> > As I understand things, you've made some changes to SMF code.  Now when you
> > try to build you're running into problems in the usr/src/cmd/svc/seed
> > directory, because svccfg is dumping core.  Is this pretty much correct?
> >
> > If it is correct, it would be helpful if you could give us a webrev showing
> > the code changes that you have made.  Right now, we're sort of searching in
> > the dark.
> >   
> 
> I'm attaching an hg.diff.. I think this is what you mean by webrev.. The 
> changes are pretty minor..
> 
> 1) two duplicate lines of asm in libc (you can safely ignore this)
> 2) I've removed native from the build (will make sense/explain below)
> 3) There's a one line change in (I'm not sure these changes are correct)
>     b/usr/src/cmd/svc/svccfg/svccfg_libscf.c
>     b/usr/src/cmd/svc/startd/libscf.c
>     b/usr/src/cmd/svc/configd/rc_node.c
> 4) In addition to the normal bldenv -d ./opensolaris.sh you'll need to
>     export LDLIBS32="-m64"
>     export CFLAGS="-m64 -g"
> 
> Here's where I think I may lose help.. I'm trying to compile this all as 
> x86_64.  You'll notice there's no amd64/ directory for libsqlite or svc 
> and thuse the reason for needing those two extra exports and removing 
> native from the Makefiles
> 
> I have an exact reproducible script against a fresh onnv-gate checkout, 
> but it doesn't involve using bldenv to set things up.  The execution 
> flow of code shouldn't change between 32/64 bit, but if 64bit is running 
> out of memory there's something strange going on I think. (Either a leak 
> or change I've made)
> 
> Warmest thanks,
> 
> ./C
> diff -r 3b46d92554cb usr/src/cmd/svc/configd/rc_node.c
> --- a/usr/src/cmd/svc/configd/rc_node.c       Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/cmd/svc/configd/rc_node.c       Tue Dec 02 16:58:22 2008 +0000
> @@ -6249,7 +6249,7 @@
>   */
>  int
>  rc_node_setup_iter(rc_node_ptr_t *npp, rc_node_iter_t **iterp,
> -    uint32_t type, uint32_t flags, const char *pattern)
> +    uint32_t type, size_t flags, const char *pattern)
>  {
>       rc_node_t *np;
>       rc_iter_filter_func *f = NULL;
> diff -r 3b46d92554cb usr/src/cmd/svc/seed/Makefile
> --- a/usr/src/cmd/svc/seed/Makefile   Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/cmd/svc/seed/Makefile   Tue Dec 02 16:58:22 2008 +0000
> @@ -111,18 +111,18 @@
>  SEEDFILEMODE = 0444          # seeds are not intended for editing, but may
>                               # be copied
>  
> -CONFIGD = ../configd/svc.configd-native
> -SVCCFG = ../svccfg/svccfg-native
> +CONFIGD = ../configd/svc.configd
> +SVCCFG = ../svccfg/svccfg
>  
>  .KEEP_STATE:
>  
>  all: global.db nonglobal.db miniroot.db
>  
>  $(CONFIGD): FRC
> -     @cd ../configd; pwd; $(MAKE) $(MFLAGS) native
> +     @cd ../configd; pwd; $(MAKE) $(MFLAGS) 
>  
>  $(SVCCFG): FRC
> -     @cd ../svccfg; pwd; $(MAKE) $(MFLAGS) native
> +     @cd ../svccfg; pwd; $(MAKE) $(MFLAGS) 
>  
>  ../milestone/console-login.xml:
>       @cd ../milestone; pwd; $(MAKE) $(MFLAGS) console-login.xml
> @@ -134,7 +134,7 @@
>               SVCCFG_DTD=../dtd/service_bundle.dtd.1 \
>               SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/common.db \
>               SVCCFG_CONFIGD_PATH=$(CONFIGD) \
> -             $(SVCCFG) import $$m; \
> +             $(SVCCFG) -v import $$m; \
>       done
>  
>  global.db: common.db $(GLOBAL_ZONE_DESCRIPTIONS) $(CONFIGD) $(SVCCFG)
> diff -r 3b46d92554cb usr/src/cmd/svc/startd/libscf.c
> --- a/usr/src/cmd/svc/startd/libscf.c Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/cmd/svc/startd/libscf.c Tue Dec 02 16:58:22 2008 +0000
> @@ -3182,7 +3182,7 @@
>   */
>  int
>  libscf_unset_action(scf_handle_t *h, scf_propertygroup_t *pg,
> -    admin_action_t a, hrtime_t ts)
> +    admin_action_t a, int64_t ts)
>  {
>       scf_transaction_t *t;
>       scf_transaction_entry_t *e;
> diff -r 3b46d92554cb usr/src/cmd/svc/svccfg/Makefile
> --- a/usr/src/cmd/svc/svccfg/Makefile Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/cmd/svc/svccfg/Makefile Tue Dec 02 16:58:22 2008 +0000
> @@ -114,7 +114,9 @@
>  
>  all debug: $(PROG)
>  
> -native: FRC
> +native:
> +
> +native_old: FRC
>       @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
>       @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install
>       @NATIVE_BUILD= $(MAKE) $(MFLAGS) all
> diff -r 3b46d92554cb usr/src/cmd/svc/svccfg/svccfg_libscf.c
> --- a/usr/src/cmd/svc/svccfg/svccfg_libscf.c  Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/cmd/svc/svccfg/svccfg_libscf.c  Tue Dec 02 16:58:22 2008 +0000
> @@ -1882,6 +1882,7 @@
>  
>       default:
>               bad_error("scf_transaction_commit", r);
> +             /* { ( void ) fprintf ( ( & __iob [ 2 ] ) , "%s:%d: %s() failed 
> with unexpected " "error %d.  Aborting.\n" , "svccfg_libscf.c" , 1884 , ( 
> "scf_transaction_commit" ) , ( r ) ) ;  }; */
>       }
>  
>       scf_transaction_destroy_children(imp_tx);
> diff -r 3b46d92554cb usr/src/common/atomic/amd64/atomic.s
> --- a/usr/src/common/atomic/amd64/atomic.s    Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/common/atomic/amd64/atomic.s    Tue Dec 02 16:58:22 2008 +0000
> @@ -432,8 +432,6 @@
>       jne     1b
>       movzbl  %cl, %eax       / return new value
>       ret
> -     SET_SIZE(atomic_and_uchar_nv)
> -     SET_SIZE(atomic_and_8_nv)
>  
>       ENTRY(atomic_or_16_nv)
>       ALTENTRY(atomic_or_ushort_nv)
> diff -r 3b46d92554cb usr/src/lib/libscf/Makefile
> --- a/usr/src/lib/libscf/Makefile     Thu Nov 06 08:38:48 2008 -0800
> +++ b/usr/src/lib/libscf/Makefile     Tue Dec 02 16:58:22 2008 +0000
> @@ -53,7 +53,7 @@
>  
>  .KEEP_STATE:
>  
> -all clean clobber install: native $(SUBDIRS)
> +all clean clobber install: $(SUBDIRS)
>  
>  lint: $(SUBDIRS)
>  
> @@ -65,7 +65,7 @@
>  
>  _msg:                $(MSGDOMAINPOFILE)
>  
> -$(SUBDIRS) native: FRC
> +$(SUBDIRS) : FRC
>       @cd $@; pwd; $(MAKE) $(TARGET)
>  
>  FRC:

I haven't had a chance to look at your diffs yet, but here is what I found
by looking at your core file.

In svccfg.h, bad_error() is defined:

#define bad_error(func, err)    {                                       \
        (void) fprintf(stderr, "%s:%d: %s() failed with unexpected "    \
            "error %d.  Aborting.\n", __FILE__, __LINE__, (func), (err)); \
        abort();                                                        \
}

Now lets look at your core file with mdb.

$ mdb core
Loading modules: [ libumem.so.1 libc.so.1 libuutil.so.1 ld.so.1 ]
> ::status
debugging core file of svccfg (64-bit) from 
file: /usr/sbin/svccfg
initial argv: ../svccfg/svccfg -v import ../milestone/global.xml
threading model: native threads
status: process terminated by SIGABRT (Abort), pid=7362 uid=0 code=-1

The stack trace is:

> $c
libc.so.1`_lwp_kill+0xa()
libc.so.1`raise+0x19()
libc.so.1`abort+0xca()
entity_pgroup_import+0xa59()
libuutil.so.1`uu_list_walk+0xa4()
lscf_service_import+0x55b()
libuutil.so.1`uu_list_walk+0xa4()
lscf_bundle_import+0x11e4()
engine_import+0x4e2()
yyparse+0x70c()
engine_exec+0x65()
main+0x268()

Let's disassemble the code in entity_proup_import() around the abort call:

> entity_pgroup_import+0xa59::dis
entity_pgroup_import+0xa20:     movl   -0x78(%rbp),%r9d
entity_pgroup_import+0xa24:     movq   $0x45bfe8,%r8
entity_pgroup_import+0xa2b:     movl   $0x75c,%ecx
entity_pgroup_import+0xa30:     movq   $0x45b338,%rdx
entity_pgroup_import+0xa37:     movq   $0x45b348,%rsi
entity_pgroup_import+0xa3e:     movq   $0x478f20,%rdi   <svccfg`_iob+0x100>
entity_pgroup_import+0xa45:     movl   $0x0,%eax
entity_pgroup_import+0xa4a:     call   -0xcf57  <PLT=libc.so.1`fprintf>
entity_pgroup_import+0xa4f:     movl   $0x0,%eax
entity_pgroup_import+0xa54:     call   -0xce11  <PLT=libc.so.1`abort>
entity_pgroup_import+0xa59:     jmp    +0x2c    <entity_pgroup_import+0xa87>
entity_pgroup_import+0xa5b:     nop    
entity_pgroup_import+0xa5c:     movl   -0x78(%rbp),%eax
entity_pgroup_import+0xa5f:     addl   $0x1,%eax
entity_pgroup_import+0xa62:     cmpl   $0x2,%eax
entity_pgroup_import+0xa65:     ja     -0x47    <entity_pgroup_import+0xa20>
entity_pgroup_import+0xa67:     shll   $0x2,%eax
entity_pgroup_import+0xa6a:     movl   %eax,%eax
entity_pgroup_import+0xa6c:     cltq   
entity_pgroup_import+0xa6e:     movq   %rax,%r8
entity_pgroup_import+0xa71:     movl   0x41c670(%r8),%eax

At a4a there is a call to fprintf.  Let's look at the parameters to the
fprintf call:

> 0x45b348/s
0x45b348:       %s:%d: %s() failed with unexpected error %d.  Aborting.

Looks like the format string in bad_error().

> 0x45b338/s
0x45b338:       svccfg_libscf.c

That's the file name, and the line number is:

> 0x75c=d
                1884    

So bad_error() is being invoked at line 1884 in svccfg.c.  The function
that failed is:

> 0x45bfe8/s
0x45bfe8:       scf_transaction_commit

tom

Reply via email to