From: "Stephen Cook" <siti_veni@lycos.com>
To: alsa-devel@lists.sourceforge.net
Subject: Patch to fix Pax/Grsecurity Problems
Date: Mon, 12 Jan 2004 12:27:23 +1100 [thread overview]
Message-ID: <BBDLNOJOGMPLEFAA@mailcity.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 987 bytes --]
As you may be currently aware alsa-lib (libasound) does not work very well when using it under a kernel that has the Pax (http://pax.grsecurity.net) or Grsecurity (http://www.grsecurity.net) Patch.
The problem is because there is a function in a function (trampoline) - So gcc generates code that conflicts with pax. Also there is a text-relocation problem.
So I helped create patch that will fix these problems so alsa will be more usable on a Pax/Grsecurity machine (no chpax work arounds and more security). Currently this patch is included in alsa-lib-1.0.1 in Gentoo so it is undergoing large scale testing. For my part I have 2 machines running with Pax and this alsa-lib patch and I have had no problems :)
The code is a work around so if you know of a better way to do it please tell me.
____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005
[-- Attachment #2: alsa-lib-1.0.1-notextrel-notrampoline.patch --]
[-- Type: text/plain, Size: 1787 bytes --]
diff -Nru alsa-lib-1.0.0rc2-original/src/control/hcontrol.c alsa-lib-1.0.0rc2/src/control/hcontrol.c
--- alsa-lib-1.0.0rc2-original/src/control/hcontrol.c Mon Oct 13 08:06:46 2003
+++ alsa-lib-1.0.0rc2/src/control/hcontrol.c Sat Dec 20 13:48:32 2003
@@ -48,6 +48,7 @@
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <pthread.h>
#ifndef DOC_HIDDEN
#define __USE_GNU
#endif
@@ -409,17 +410,26 @@
return 0;
}
+static snd_hctl_t *compare_hctl;
+static int hctl_compare(const void *a, const void *b) {
+ return compare_hctl->compare(*(const snd_hctl_elem_t * const *) a,
+ *(const snd_hctl_elem_t * const *) b);
+}
+
static void snd_hctl_sort(snd_hctl_t *hctl)
{
unsigned int k;
- int compar(const void *a, const void *b) {
- return hctl->compare(*(const snd_hctl_elem_t * const *) a,
- *(const snd_hctl_elem_t * const *) b);
- }
+ static pthread_mutex_t sync_lock = PTHREAD_MUTEX_INITIALIZER;
+
assert(hctl);
assert(hctl->compare);
INIT_LIST_HEAD(&hctl->elems);
- qsort(hctl->pelems, hctl->count, sizeof(*hctl->pelems), compar);
+
+ pthread_mutex_lock(&sync_lock);
+ compare_hctl = hctl;
+ qsort(hctl->pelems, hctl->count, sizeof(*hctl->pelems), hctl_compare);
+ pthread_mutex_unlock(&sync_lock);
+
for (k = 0; k < hctl->count; k++)
list_add_tail(&hctl->pelems[k]->list, &hctl->elems);
}
diff -Nru alsa-lib-1.0.0rc2-original/src/pcm/pcm_direct.c alsa-lib-1.0.0rc2/src/pcm/pcm_direct.c
--- alsa-lib-1.0.0rc2-original/src/pcm/pcm_direct.c Fri Oct 17 09:53:06 2003
+++ alsa-lib-1.0.0rc2/src/pcm/pcm_direct.c Sat Dec 20 13:49:22 2003
@@ -98,7 +98,6 @@
int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix)
{
- static int snd_pcm_direct_shm_discard(snd_pcm_direct_t *dmix);
struct shmid_ds buf;
int ret = 0;
next reply other threads:[~2004-01-12 1:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-12 1:27 Stephen Cook [this message]
2004-01-12 14:03 ` Patch to fix Pax/Grsecurity Problems Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2004-01-23 9:40 Stephen Cook
2004-01-23 18:25 ` Takashi Iwai
2004-01-26 13:45 ` Clemens Ladisch
2004-01-26 15:58 ` 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=BBDLNOJOGMPLEFAA@mailcity.com \
--to=siti_veni@lycos.com \
--cc=alsa-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox