[DGD] Bug

Blain blain20 at gmail.com
Thu Feb 16 16:49:09 CET 2017


I managed to replicate the m_free error on a bare copy.

$ ./start bare
Starting bare...
Feb 16 09:41:13 ** DGD 1.5.5
Feb 16 09:41:13 ** Initializing...
Feb 16 09:41:13 ** include: /usr/System/lib/lib; /include/std.h;
/include/AUTO
Fatal error: bad pointer in m_free
./start: line 16:  3164 Aborted                 (core dumped)
./bin/${DRIVER} ${MUD}.dgd


I'm using kernel library cloud server v0.7.
DGD 1.5.5 with slashslash but not networking.  My main lib uses networking,
so I don't think this difference matters.


--- /include/std.h
#include "AUTO"


--- /include/AUTO
<empty>


---/usr/System/lib/lib.c
<empty>


---/usr/System/initd.c
#include <kernel/kernel.h>

void create()
{
  DRIVER->set_object_manager(this_object());
  compile_object("~/lib/lib");
}

mixed include_file(string compiled, string from, string path)
{
  DRIVER->message("include: "+compiled+"; "+from+"; "+path+"\n");
  if(from == "/include/std.h" && path == "/include/AUTO")
    return ({ "/foo", "/bar", "/baz" });
  return path;
}


I could play around adding/removing the leading slashes and get it to just
bug normally, so the leading slashes seem to be central to the bug.

For example:

- ({ "foo", "bar" })
- ({ "foo", "/bar" })
- ({ "foo", "bar", "/baz" })

Feb 16 09:46:23 ** DGD 1.5.5
Feb 16 09:46:23 ** Initializing...
Feb 16 09:46:23 ** include: /usr/System/lib/lib; /include/std.h;
/include/AUTO
/include/AUTO, 1: syntax error
Feb 16 09:46:23 ** Failed to compile "/usr/System/lib/lib.c"
 376 initialize        /kernel/sys/driver
 365 _initialize       /kernel/sys/driver
   7 create            /usr/System/initd
 226 compile_object    /kernel/lib/auto (/usr/System/initd)
Feb 16 09:46:23 ** Initialization failed.


- ({ "/foo", "bar" })
- ({ "foo", "/bar", "/baz" })

Feb 16 09:48:23 ** DGD 1.5.5
Feb 16 09:48:23 ** Initializing...
Feb 16 09:48:23 ** include: /usr/System/lib/lib; /include/std.h;
/include/AUTO
Fatal error: bad pointer in m_free
./start: line 16:  4256 Aborted                 (core dumped)
./bin/${DRIVER} ${MUD}.dgd


On Thu, Feb 16, 2017 at 9:21 AM, Blain <blain20 at gmail.com> wrote:

> Feb 16 09:15:28 ** [Core] ** Log Manager started.
> Feb 16 09:15:28 ** [Core] ** Error manager started.
> Feb 16 09:15:28 ** [Core] ** Object manager starting...
> Feb 16 09:15:28 ** [Core] Preload: /usr/System/dat/core/preload.txt
> Feb 16 09:15:28 ** [Core] /usr/System/lib/xfun/charset
> Feb 16 09:15:28 ** ({1|"/usr/System/def/auto.h", "inherit
> "/usr/System/lib/auto";\n" })
> Feb 16 09:15:28 ** */usr/System/pub/def/AUTO1 [1]: Syntax error
> Fatal error: bad pointer in m_free
> Aborted (core dumped)
>
>
> public nomask
> mixed include_file(string compiled, string from, string path)
> {
>   int len;
>   string file, text;
>
>   if(!KERNEL() && !SYSTEM())
>     return null;
>   if(sscanf(compiled, "/kernel/%*s") != 0)
>     return path;
>   debug(({"include",DEBUG_VERBOSE}), "Include: "+compiled+"; from:
> "+from+"; path: "+path+"\n");
>   if(sscanf(path, "/def/system/%s", file) == 1)
>     path = "/usr/System/pub/def/"+file;
>     /* fallthrough */
>   else if(from == "/def/std.h" && path == "/def/AUTO")
>     return "/usr/System/pub/def/auto.h";
>   else if(from == "/usr/System/pub/def/auto.h"
>    && path == "/usr/System/pub/def/AUTO1")
>   {
>     string *ret, domain, rest;
>
>     if(sscanf(compiled, "/usr/%s/%s", domain, rest) == 2)
>     {
>       ret = ({});
>       /* Add local auto.h */
>       if(file_exists(file = "/usr/"+domain+"/def/auto.h"))
>         ret += ({ file });
>       if(domain != "System")
>         ret += ({ "#include \"/usr/System/pub/def/system.h\"\n" });
>
>       /* Add System pub/auto or local auto */
>       if(rest == "lib/auto")
>       {
>         if(domain != "System")
>           ret += ({ "inherit \"/usr/System/pub/lib/auto\";\n" });
>       }
>       else if(file_exists((file = "/usr/"+domain+"/lib/auto")+".c"))
>         ret += ({ "inherit \""+file+"\";\n" });
>       else
>       {
>         if(domain != "System")
>           ret += ({ "inherit \"/usr/System/pub/lib/auto\";" });
>       }
> debug_message(sprint(ret)+"\n");
>       return ret;
>     }
>     return path;
>   }
>
>   len = strlen(path);
>   if(sscanf(path, "%*s.c/") != 0 || sscanf(path, "%*s.h/") != 0
>     || len < 2 || (path[len - 2 ..] != ".h" && path[len - 2 ..] != ".c"))
>     error("Invalid include file: "+path);
>
>   return path;
> }
>
>
>
>
>
> On Thu, Feb 16, 2017 at 2:23 AM, Felix A. Croes <felix at dworkin.nl> wrote:
>
>> bart at wotf.org wrote:
>>
>> > From my reading, it was the unintended recursive calls to create()
>> running
>> > without rlimits causing the crashes.
>>
>> I didn't quote that part in my email, but the crash is due to a bad
>> pointer in m_free().  So this is not an infinite recursion issue.
>>
>> Regards,
>> Felix Croes
>> ____________________________________________
>> https://mail.dworkin.nl/mailman/listinfo/dgd
>>
>
>



More information about the DGD mailing list