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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150826184323.GE28760@sirena.org.uk>
Date:	Wed, 26 Aug 2015 19:43:23 +0100
From:	Mark Brown <broonie@...nel.org>
To:	Qais Yousef <qais.yousef@...tec.com>
Cc:	alsa-devel@...a-project.org, Liam Girdwood <lgirdwood@...il.com>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/10] ALSA: axd: add buffers manipulation files

On Mon, Aug 24, 2015 at 01:39:14PM +0100, Qais Yousef wrote:

> +	/*
> +	 * must ensure we have one access at a time to the queue and rd_idx
> +	 * to be preemption and SMP safe
> +	 * Sempahores will ensure that we will only read after a complete write
> +	 * has finished, so we will never read and write from the same location.
> +	 */

In what way will sempahores ensure that we will only read after a
complete write?

> +	buf = bufferq->queue[bufferq->rd_idx];

So buffers are always retired in the same order that they are acquired?

> +int axd_bufferq_put(struct axd_bufferq *bufferq, char *buf, int buf_size)
> +{
> +	int ret;
> +
> +	if (!bufferq->queue)
> +		return 0;
> +
> +	if (buf_size < 0)
> +		buf_size = bufferq->stride;

We've got strides as well?  What is that?

> +void axd_bufferq_abort_take(struct axd_bufferq *bufferq)
> +{
> +	if (axd_bufferq_is_empty(bufferq)) {
> +		bufferq->abort_take = 1;
> +		up(&bufferq->rd_sem);
> +	}
> +}
> +
> +void axd_bufferq_abort_put(struct axd_bufferq *bufferq)
> +{
> +	if (axd_bufferq_is_full(bufferq)) {
> +		bufferq->abort_put = 1;
> +		up(&bufferq->wr_sem);
> +	}
> +}

These look *incredibly* racy.  Why are they here and why are they safe?

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ