2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
time: detect copies of Timer and Ticker
The public Timer and Ticker types are only the beginning of the larger
runtime.timeTimer types. User allocations of the public types will not
initialize the runtime-only portion of the type. The existing init bool
fields allow the methods to detect user allocations and panic.
Copies have a similar problem. If a user copies a valid Timer or Ticker,
only the beginning of the actual type is copied and it will not be
usable [1]. The init bool is not sufficient to detect this, as a copy
will copy the bool field. Instead, change the init bool to a self
pointer. If the object is copied, the pointer will no longer match.
Alternatively, we could use a pointer field to a separate runtime type.
This would make the type safe to copy. This was the initial approach in
patch set 1 of CL 568339, but it was changed to avoid the extra
allocation.
[1] Even if the entire structure was defined in time, copying would
still not be safe, as runtime.timeTimer is not safe to copy. e.g., it
contains mutex values. This is what CL 568339 was addressing.
Fixes #73886.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |