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]

Re: Small security patches


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?

In this case we could write a macro to initialize the cygsid structure
without having a constructor. I will look into it.

Pierre


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