www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24207] New: std.parallelism: AbstractTask private data is

https://issues.dlang.org/show_bug.cgi?id=24207

          Issue ID: 24207
           Summary: std.parallelism: AbstractTask private data is
                    inadvertently available
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schveiguy gmail.com

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.

--
Oct 29 2023