https://bugs.kde.org/show_bug.cgi?id=405227

            Bug ID: 405227
           Summary: kinit: kdeinit crashes with EXC_GUARD on Mac
           Product: frameworks-kinit
           Version: unspecified
          Platform: Compiled Sources
                OS: OS X
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

SUMMARY
After #26620aef kdeinit5 crashes on startup under Mac OS with an EXC_GUARD
exception.

STEPS TO REPRODUCE
1. install a kinit version build from code newer than #26620aef
2. start kdeinit5
3. 

OBSERVED RESULT
Under lldb:
(lldb) r
Process 39953 launched: '/opt/local/bin/kdeinit5' (x86_64)
Process 39953 stopped
* thread #1: tid = 0xdcc90, 0x00007fff85a560c2 libsystem_kernel.dylib`close +
10, queue = 'com.apple.main-thread', stop reason = EXC_GUARD
(code=4611686022722355203, subcode=0x7fff89db7c48)
    frame #0: 0x00007fff85a560c2 libsystem_kernel.dylib`close + 10
libsystem_kernel.dylib`close + 10:
-> 0x7fff85a560c2:  jae    0x7fff85a560cc            ; close + 20
   0x7fff85a560c4:  movq   %rax, %rdi
   0x7fff85a560c7:  jmp    0x7fff85a5219a            ; cerror
   0x7fff85a560cc:  retq   
(lldb) up
frame #1: 0x0000000100005c77 kdeinit5`main + 663 at kinit.cpp:175
   172  #if KDEINIT_OOM_PROTECT
   173          if (fd != oom_pipe)
   174  #endif
-> 175              close(fd);
   176      }
   177  }
   178  
(lldb) p fd
(int) $0 = 3


EXPECTED RESULT
No crash.

SOFTWARE/OS VERSIONS
Mac OS X 10.9.5

ADDITIONAL INFORMATION
A debug trace added to cleanup_fds() shows:

void cleanup_fds() rl.cur/max= 256 / 9223372036854775807 FD_SETSIZE= 1024

According to the debugger the crash happens at the very first close() (i.e.
close(3)), and reverting the recent change does fix the issue.

About the EXC_GUARD exception: googling shows that this is raised when you try
to close a guarded resource, e.g. a file descriptor open in another application
or that you shouldn't be closing otherwise.

I have NOT found any indication that one can test for this in a non-fatal
manner. For now it seems that just excluding fd=3 solves the issue, but
ultimately it might be necessary to skip the entire step.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to