• Bug#1105129: Please backport ntsync driver from Linux-6.14 to trixie (3

    From Piotr Morgwai Kotarbinski@1:229/2 to All on Sun May 11 22:50:01 2025
    [continued from previous message]

    + specifies an "alert" event object which, if signaled, will
    + terminate the wait. If nonzero, the identifier must point to a
    + valid event.
    + * - ``flags``
    + - Zero or more flags. Currently the only flag is
    + ``NTSYNC_WAIT_REALTIME``, which causes the timeout to be
    + measured against the REALTIME clock instead of MONOTONIC.
    + * - ``pad``
    + - Unused, must be set to zero.
    +
    + This function attempts to acquire one of the given objects. If unable
    + to do so, it sleeps until an object becomes signaled, subsequently
    + acquiring it, or the timeout expires. In the latter case the ioctl
    + fails with ``ETIMEDOUT``. The function only acquires one object, even
    + if multiple objects are signaled.
    +
    + A semaphore is considered to be signaled if its count is nonzero, and
    + is acquired by decrementing its count by one. A mutex is considered
    + to be signaled if it is unowned or if its owner matches the ``owner``
    + argument, and is acquired by incrementing its recursion count by one
    + and setting its owner to the ``owner`` argument. An auto-reset event
    + is acquired by designaling it; a manual-reset event is not affected
    + by acquisition.
    +
    + Acquisition is atomic and totally ordered with respect to other
    + operations on the same object. If two wait operations (with different
    + ``owner`` identifiers) are queued on the same mutex, only one is
    + signaled. If two wait operations are queued on the same semaphore,
    + and a value of one is posted to it, only one is signaled.
    +
    + If an abandoned mutex is acquired, the ioctl fails with
    + ``EOWNERDEAD``. Although this is a failure return, the function may
    + otherwise be considered successful. The mutex is marked as owned by
    + the given owner (with a recursion count of 1) and as no longer
    + abandoned, and ``index`` is still set to the index of the mutex.
    +
    + The ``alert`` argument is an "extra" event which can terminate the
    + wait, independently of all other objects.
    +
    + It is valid to pass the same object more than once, including by
    + passing the same event in the ``objs`` array and in ``alert``. If a
    + wakeup occurs due to that object being signaled, ``index`` is set to
    + the lowest index corresponding to that object.
    +
    + The function may fail with ``EINTR`` if a signal is received.
    +
    +.. c:macro:: NTSYNC_IOC_WAIT_ALL
    +
    + Poll on a list of objects, atomically acquiring all of them. Takes a
    + pointer to struct :c:type:`ntsync_wait_args`, which is used
    + identically to ``NTSYNC_IOC_WAIT_ANY``, except that ``index`` is
    + always filled with zero on success if not woken via alert.
    +
    + This function attempts to simultaneously acquire all of the given
    + objects. If unable to do so, it sleeps until all objects become
    + simultaneously signaled, subsequently acquiring them, or the timeout
    + expires. In the latter case the ioctl fails with ``ETIMEDOUT`` and no
    + objects are modified.
    +
    + Objects may become signaled and subsequently designaled (through
    + acquisition by other threads) while this thread is sleeping. Only
    + once all objects are simultaneously signaled does the ioctl acquire
    + them and return. The entire acquisition is atomic and totally ordered
    + with respect to other operations on any of the given objects.
    +
    + If an abandoned mutex is acquired, the ioctl fails with
    + ``EOWNERDEAD``. Similarly to ``NTSYNC_IOC_WAIT_ANY``, all objects are
    + nevertheless marked as acquired. Note that if multiple mutex objects
    + are specified, there is no way to know which were marked as
    + abandoned.
    +
    + As with "any" waits, the ``alert`` argument is an "extra" event which
    + can terminate the wait. Critically, however, an "all" wait will
    + succeed if all members in ``objs`` are signaled, *or* if ``alert`` is
    + signaled. In the latter case ``index`` will be set to ``count``. As
    + with "any" waits, if both conditions are filled, the former takes
    + priority, and objects in ``objs`` will be acquired.
    +
    + Unlike ``NTSYNC_IOC_WAIT_ANY``, it is not valid to pass the same
    + object more than once, nor is it valid to pass the same object in
    + ``objs`` and in ``alert``. If this is attempted, the function fails
    + with ``EINVAL``.
    Index: linux-6.12.27/MAINTAINERS ===================================================================
    --- linux-6.12.27.orig/MAINTAINERS
    +++ linux-6.12.27/MAINTAINERS
    @@ -16486,6 +16486,15 @@ T: git https://github.com/Paragon-Softwa
    F: Documentation/filesystems/ntfs3.rst
    F: fs/ntfs3/

    +NTSYNC SYNCHRONIZATION PRIMITIVE DRIVER
    +M: Elizabeth Figura <zfigura@codeweavers.com>
    +L: wine-devel@winehq.org
    +S: Supported
    +F: Documentation/userspace-api/ntsync.rst
    +F: drivers/misc/ntsync.c
    +F: include/uapi/linux/ntsync.h
    +F: tools/testing/selftests/drivers/ntsync/
    +
    NUBUS SUBSYSTEM
    M: Finn Thain <fthain@linux-m68k.org>
    L: linux-m68k@lists.linux-m68k.org
    Index: linux-6.12.27/drivers/misc/Kconfig ===================================================================
    --- linux-6.12.27.orig/drivers/misc/Kconfig
    +++ linux-6.12.27/drivers/misc/Kconfig
    @@ -517,7 +517,6 @@ config OPEN_DICE

    config NTSYNC
    tristate "NT synchronization primitive emulation"
    - depends on BROKEN
    help
    This module provides kernel support for emulation of Windows NT
    synchronization primitives. It is not a hardw