This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Protect handle issue-ettes


Chris,

I've attached one patch to the protect handle mechanism: a
forgotten "hl = hl->next" after find_handle() in setclexec().
This cured a seg. fault I was getting in the cygwin_daemon branch
when running make.

I'm still not clear why the cygserver code disturbs this mechanism
so much: I wasn't getting the seg. fault on the HEAD version.
I've now added calls to ProtectHandle into the cygserver code, so
this doesn't seem to be anything to do with their (previous)
omission.

Other than that, I'm still getting quite a bit of noise, all of
which (that I've bothered to trace through) is due to handles that
are non-inheritable (i.e. held in a NO_COPY variable and created
with, e.g., sec_none_nih).  AFAICT, these need to be removed from
the protected handle list on fork, not just on fork-exec.  I've
attached a sample of the "noise" to the end of this message.

Such handles include:

exceptions.cc:
    title_mutex

sigproc.cc:
    sigcatch_nonmain
    sigcatch_main
    sigcomplete_nonmain
    sigcomplete_main

I don't see any mechanism to do this in the code at present and
I've not the time to go into this any further just now, but I hope
that helps.

Cheers,

// Conrad

A batch of message from running "make install" in the cygwin
directory while cygserver is running:

  21549 [main] sh 1756 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1756
  29497 [main] sh 1756 mark_closed:  by int
fhandler_base::close():770(get_handle()<0x118>)
   3871 [sig] sed 348 add_handle: DWORD wait_sig(void *):1106 -
multiple attempts to add handle sigcatch_nosync<0x118>
   6304 [sig] sed 348 add_handle:  previously allocated by void
memory_init():157(cygwin_mount_h<0x118>) winpid 1756
  23716 [main] sh 1756 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1756
  29777 [main] sh 1756 mark_closed:  by int
fhandler_base::close():770(get_handle()<0x118>)
  75287 [main] sh 1460 add_handle: int spawn_guts(const char *,
const char *const *, const char *const *, int):720 - multiple
attempts to add handle childhProc<0x118>
  79522 [main] sh 1460 add_handle:  previously allocated by void
memory_init():157(cygwin_mount_h<0x118>) winpid 1756
  23001 [main] sh 1456 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1456
  32911 [main] sh 1456 mark_closed:  by int
fhandler_base::close():770(get_handle()<0x118>)
   4241 [sig] sed 348 add_handle: DWORD wait_sig(void *):1107 -
multiple attempts to add handle sigcatch_nonmain<0x118>
   7192 [sig] sed 348 add_handle:  previously allocated by void
memory_init():157(cygwin_mount_h<0x118>) winpid 1456
  20367 [main] sh 1728 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1728
  23246 [main] sh 1728 mark_closed:  by int
fhandler_base::close():770(get_handle()<0x118>)
  57709 [main] sh 1720 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1728
  62777 [main] sh 1720 mark_closed:  by int NTReadEA(const char *,
const char *, char *, int):129(hFileSource<0x118>)
   6540 [sig] sed 1720 add_handle: DWORD wait_sig(void *):1108 -
multiple attempts to add handle sigcatch_main<0x118>
  11660 [sig] sed 1720 add_handle:  previously allocated by void
memory_init():157(cygwin_mount_h<0x118>) winpid 1728
  20554 [main] sh 1464 mark_closed: attempt to close protected
handle void memory_init():157(cygwin_mount_h<0x118>) winpid 1464
  22505 [main] sh 1464 mark_closed:  by int
fhandler_base::close():770(get_handle()<0x118>)
  62649 [main] sh 1756 add_handle: int spawn_guts(const char *,
const char *const *, const char *const *, int):720 - multiple
attempts to add handle childhProc<0x118>
  72487 [main] sh 1756 add_handle:  previously allocated by void
memory_init():157(cygwin_mount_h<0x118>) winpid 1464

Attachment: ChangeLog.txt
Description: Text document

Attachment: debug.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]