All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.co.uk>
To: "Kevin F.Quinn" <co@kevquinn.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Re: alsa-lib patches
Date: Sun, 15 May 2005 18:30:40 +0100	[thread overview]
Message-ID: <42878740.30103@superbug.co.uk> (raw)
In-Reply-To: <4VSQHX111E5W3.1736062366PHUYD5@kevquinn.com>

Kevin F.Quinn wrote:
> Clemens Ladisch wrote:
> 
>>Martin Stransky wrote:
>>
>>>About mixer patch - some user had a problem with ICH6 and this patch helped.
>>>
>>>+static snd_mixer_t *qsort_mixer;
>>
>> 
>>This will break with multithreading.
>> 
>>
>>>+static int compar(const void *a, const void *b) {
>>>+       return qsort_mixer->compare(*(const snd_mixer_elem_t * const *) a,
>>>+                                   *(const snd_mixer_elem_t * const *) b);
>>>+}
>>
>> 
>>So the actual problem is that qsort() calls us with a pointer to a
>>pointer to the mixer_elem_t, but the compare function takes a single
>>pointer.
>> 
>> 
>>If we don"t want to change the mixer API, we have to use some
>>pthread_mutex to protext qsort_mixer.
> 
> 
> Some of us have been watching this at Gentoo, as we agree the patch applied to remove the nested function in src/mixer/mixer.c is broken.
> 
> See https://bugs.gentoo.org/show_bug.cgi?id=82242 (skip straight to the end, comment #13) where the PaX team have supplied a patch that ought to work, along the lines of a change made to src/control/hcontrol.c over a year ago which fixed the same issue there.  Patch at https://bugs.gentoo.org/attachment.cgi?id=58918
> 
> Cheers,
> Kev.
> 

What is wrong with the current CVS code?:

typedef int (*qsort_func)(const void *, const void *);
static int snd_mixer_sort(snd_mixer_t *mixer)
{
        unsigned int k;
        assert(mixer);
        assert(mixer->compare);
        INIT_LIST_HEAD(&mixer->elems);
        qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t*),
(qsort_func)mixer->compare);
        for (k = 0; k < mixer->count; k++)
                list_add_tail(&mixer->pelems[k]->list, &mixer->elems);
        return 0;
}

We are not executing any code on the stack. This should not effect the
NX bit so what I the problem here?

James


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click

  reply	other threads:[~2005-05-15 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-15 14:57 alsa-lib patches Kevin F.Quinn
2005-05-15 17:30 ` James Courtier-Dutton [this message]
2005-05-15 17:21   ` Sergey Vlasov
2005-05-15 19:04     ` James Courtier-Dutton
2005-05-15 20:24     ` Kevin F.Quinn
2005-05-15 20:34       ` Lee Revell
2005-05-15 22:15         ` Kevin F.Quinn
2005-05-15 22:33           ` Lee Revell
2005-05-16  8:53       ` Sergey Vlasov
2005-05-17  9:35       ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42878740.30103@superbug.co.uk \
    --to=james@superbug.co.uk \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=co@kevquinn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.