Bug 24207 – std.parallelism: AbstractTask private data is inadvertently available

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-10-29T14:49:28Z
Last change time
2023-10-29T19:55:01Z
Keywords
pull
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2023-10-29T14:49:28Z
In std.parallelism, `Task` has a "base" type `AbstractTask`, which is alias this'd to the type. However, the base is accessible because it's public (yet undocumented). It looks like it was made public to workaround an issue in the compiler, see https://github.com/dlang/phobos/commit/9d151ac1f9e45d4d57a0b74508b41b303a6a293d This should be reversed, and tested, because this allows access to the internal workings of the task system, in a completely mutable and unsafe way, including the `runTask`, the `prev` and `next` pointers, etc. Given that the original field was private, and the type itself is private and undocumented, it's clear that this was never intended to be a public interface. If this cannot be reversed, it should be redesigned so as to prevent unfettered thread-unsafe access to these fields.
Comment #1 by dlang-bot — 2023-10-29T15:07:30Z
@schveiguy created dlang/phobos pull request #8834 "make std.parallelism.AbstractTask inaccessible" fixing this issue: - Fix issue 24207 - make AbstractTask private so it's not inadvertently accessible to users of Task. https://github.com/dlang/phobos/pull/8834
Comment #2 by dlang-bot — 2023-10-29T19:55:01Z
dlang/phobos pull request #8834 "make std.parallelism.AbstractTask inaccessible" was merged into master: - 0ec4f471307251eca0b4ffe6b1969e05366a2b9b by Steven Schveighoffer: Fix issue 24207 - make AbstractTask private so it's not inadvertently accessible to users of Task. https://github.com/dlang/phobos/pull/8834