lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jmuevryxo2nlqriqbwz6y2ttwzxwajfsnb5vaez2oqu7etkrd3@lu3pgnfushmr>
Date:   Fri, 27 Oct 2023 12:18:00 +0200
From:   Stefano Garzarella <sgarzare@...hat.com>
To:     Takashi Iwai <tiwai@...e.de>, mst@...hat.com
Cc:     Matias Ezequiel Vara Larsen <mvaralar@...hat.com>,
        anton.yakovlev@...nsynergy.com, mst@...hat.com, perex@...ex.cz,
        tiwai@...e.com, virtualization@...ts.linux-foundation.org,
        alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        pbonzini@...hat.com, stefanha@...hat.com,
        manos.pitsidianakis@...aro.org, mripard@...hat.com
Subject: Re: [PATCH v4] ALSA: virtio: use ack callback

On Fri, Oct 27, 2023 at 11:27:40AM +0200, Takashi Iwai wrote:
>On Wed, 25 Oct 2023 11:49:19 +0200,
>Matias Ezequiel Vara Larsen wrote:
>>
>> This commit uses the ack() callback to determine when a buffer has been
>> updated, then exposes it to guest.
>>
>> The current mechanism splits a dma buffer into descriptors that are
>> exposed to the device. This dma buffer is shared with the user
>> application. When the device consumes a buffer, the driver moves the
>> request from the used ring to available ring.
>>
>> The driver exposes the buffer to the device without knowing if the
>> content has been updated from the user. The section 2.8.21.1 of the
>> virtio spec states that: "The device MAY access the descriptor chains
>> the driver created and the memory they refer to immediately". If the
>> device picks up buffers from the available ring just after it is
>> notified, it happens that the content may be old.
>>
>> When the ack() callback is invoked, the driver exposes only the buffers
>> that have already been updated, i.e., enqueued in the available ring.
>> Thus, the device always picks up a buffer that is updated.
>>
>> For capturing, the driver starts by exposing all the available buffers
>> to device. After device updates the content of a buffer, it enqueues it
>> in the used ring. It is only after the ack() for capturing is issued
>> that the driver re-enqueues the buffer in the available ring.
>>
>> Co-developed-by: Anton Yakovlev <anton.yakovlev@...nsynergy.com>
>> Signed-off-by: Anton Yakovlev <anton.yakovlev@...nsynergy.com>
>> Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@...hat.com>
>
>Applied now to for-next branch.

Cool, thanks for that!

I just wonder if we should CC stable since we are fixing a virtio
specification violation.

@Michael what do you think?

Thanks,
Stefano

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ