Small security patches
Wed Dec 11 13:34:00 GMT 2002
On Wed, Dec 11, 2002 at 04:17:10PM -0500, Pierre A. Humblet wrote:
>Christopher Faylor wrote:
>> On Wed, Dec 11, 2002 at 03:56:17PM -0500, Pierre A. Humblet wrote:
>> >Christopher Faylor wrote:
>> >> Shouldn't the global symbols be marked as "NO_COPY"?
>> >I am not sure why things are as they are.
>> >These symbols are initialized in do_global_ctors and never change.
>> >Are the constructors running again after a fork? If so, NO_COPY is fine.
>> >It would seem more efficient to copy than to rerun the constructors,
>> >but I probably overlook some factors.
>> Constructors are always run. If you use a global constructor without a
>> NO_COPY then you just end up writing over the contents when the fork
>> completes. So, if the constructor is setting things up correctly the
>> global should be NO_COPY. Actually, if you can get away without using a
>> constructor that would be best. Constructors are a noticeable part of
>> cygwin's startup cost.
>Thanks for the information. While we are at it, I was looking at the
>code and noticed that there were hooks to avoid running the constructors
>(things such as "force" and "user_data->run_ctors_p").
>Are they ever used or are they history?
Both are used. You can see them in dcrt0.cc. The same function is
called from the "dll context" (dll_crt0_1) and the "program context"
(__main) since there are separate sets of constructors for each case.
More information about the Cygwin-patches