[MacPorts] #60702: darwintrace's tid_key/sock_key creation is not safe in the presence of other initializers

MacPorts noreply at macports.org
Wed Jun 24 10:04:21 UTC 2020


#60702: darwintrace's tid_key/sock_key creation is not safe in the presence of
other initializers
------------------------+-----------------------
  Reporter:  saagarjha  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  base       |    Version:
Resolution:             |   Keywords:  tracemode
      Port:             |
------------------------+-----------------------

Comment (by saagarjha):

 Ok, so the issue with my changes not being picked up was actually a
 problem with my OS and not MacPorts, so that's resolved.

 However, I ran into another problem: there's actually another static
 constructor in darwintrace, `store_env`. This one is an issue because it
 uses the `COPYENV` macro, which calls `malloc`. But the problem is that
 we're in the middle of one of libsystem_malloc.dylib's static initializers
 (which calls a function we interpose), and we can't call `malloc` at this
 point because it hasn't initialized it's arenas. That's exactly what it
 was trying to do when we interposed it and tried to do our own setup in
 the middle! So I'm unsure what the best way forwards from here would be.
 Should I allocate a fixed size buffer as a global and call `abort` if we
 overflow that? Use `alloca`?

-- 
Ticket URL: <https://trac.macports.org/ticket/60702#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list