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

Bro segfaults when reporter.log is unwritable #188

Closed
0xxon opened this Issue Oct 10, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@0xxon
Copy link
Member

0xxon commented Oct 10, 2018

Bro segfaults on os-x (mojave) when reporter.log is unwritable (e.g. because owned by a different user).

Backtrace varies a bit - always in some destructor. Example:

$ lldb -- bro config.bro
(lldb) target create "bro"
r
Current executable set to 'bro' (x86_64).
(lldb) settings set -- target.run-args  "config.bro"
(lldb) r
Process 64202 launched: '/Users/johanna/bro/install-master/bin/bro' (x86_64)
warning: ./config/Input::READER_CONFIG: Init: cannot open ./config
Process 64202 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xe)
    frame #0: 0x00000001003b301f bro`plugin::Manager::HookQueueEvent(Event*) const [inlined] std::__1::__list_imp<std::__1::pair<int, plugin::Plugin*>, std::__1::allocator<std::__1::pair<int, plugin::Plugin*> > >::begin(this=0x0000000000000006) at list:598
   595 	#if _LIBCPP_DEBUG_LEVEL >= 2
   596 	        return iterator(__end_.__next_, this);
   597 	#else
-> 598 	        return iterator(__end_.__next_);
   599 	#endif
   600 	    }
   601 	    _LIBCPP_INLINE_VISIBILITY
Target 0: (bro) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xe)
  * frame #0: 0x00000001003b301f bro`plugin::Manager::HookQueueEvent(Event*) const [inlined] std::__1::__list_imp<std::__1::pair<int, plugin::Plugin*>, std::__1::allocator<std::__1::pair<int, plugin::Plugin*> > >::begin(this=0x0000000000000006) at list:598
    frame #1: 0x00000001003b301f bro`plugin::Manager::HookQueueEvent(Event*) const [inlined] std::__1::list<std::__1::pair<int, plugin::Plugin*>, std::__1::allocator<std::__1::pair<int, plugin::Plugin*> > >::begin(this=0x0000000000000006 size=0) at list:910
    frame #2: 0x00000001003b301f bro`plugin::Manager::HookQueueEvent(this=0x0000000103500110, event=0x0000000103358570) const at Manager.cc:655
    frame #3: 0x00000001000e77de bro`EventMgr::QueueEvent(this=0x0000000100ac82f0, event=0x0000000103358570) at Event.cc:113
    frame #4: 0x000000010003cf9e bro`EventMgr::QueueEvent(this=0x0000000100ac82f0, h=0x00007ffeefbfccc0, vl=0x000000010333cd20, src=0, aid=0, mgr=0x0000000000000000, obj=0x0000000000000000) at Event.h:61
    frame #5: 0x00000001001cbfc2 bro`Reporter::DoLog(this=0x0000000106d9d490, prefix="error", event=EventHandlerPtr @ 0x00007ffeefbfccc0, out=0x00007fff91f66240, conn=0x0000000000000000, addl=0x0000000000000000, location=true, time=true, postfix=0x0000000000000000, fmt="%s: %s", ap=0x00007ffeefbfcce0) at Reporter.cc:497
    frame #6: 0x00000001001ce2a7 bro`Reporter::Error(this=0x0000000106d9d490, fmt="%s: %s") at Reporter.cc:102
    frame #7: 0x00000001002c7de9 bro`threading::ReporterMessage::Process(this=0x000000010aa51f90) at MsgThread.cc:148
    frame #8: 0x00000001002c4083 bro`threading::Manager::Process(this=0x00000001035000a0) at Manager.cc:134
    frame #9: 0x00000001002c1e06 bro`threading::Manager::Terminate(this=0x00000001035000a0) at Manager.cc:30
    frame #10: 0x00000001002c1cf0 bro`threading::Manager::~Manager(this=0x00000001035000a0) at Manager.cc:20
    frame #11: 0x00000001002c25f5 bro`threading::Manager::~Manager(this=0x00000001035000a0) at Manager.cc:18
    frame #12: 0x00000001002c2619 bro`threading::Manager::~Manager(this=0x00000001035000a0) at Manager.cc:18
    frame #13: 0x0000000100825f40 bro`iosource::Manager::~Manager(this=0x00000001061a5e60) at Manager.cc:27
    frame #14: 0x00000001008263f5 bro`iosource::Manager::~Manager(this=0x00000001061a5e60) at Manager.cc:23
    frame #15: 0x000000010003ce8f bro`terminate_bro() at main.cc:384
    frame #16: 0x0000000100042509 bro`main(argc=2, argv=0x00007ffeefbff628) at main.cc:1252
    frame #17: 0x00007fff5fec8085 libdyld.dylib`start + 1
    frame #18: 0x00007fff5fec8085 libdyld.dylib`start + 1
(lldb)

config.bro is a simple Bro file written to generate an reporter output:

redef Config::config_files += { "./config" };

The file config does not exist. reporter.log is owned by root and not writeable by the process running Bro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment