All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Spencer <maillist-alsa@barfooze.de>
To: alsa-devel <alsa-devel@alsa-project.org>
Cc: sabotage@lists.openwall.com
Subject: [PATCH] snd_dlsym: only do versioning checks if built --with-versioning
Date: Sat, 15 Nov 2014 13:55:54 +0100	[thread overview]
Message-ID: <54674D5A.3010500@barfooze.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]

 From 291553a0132936611d48f41e924601dff8941537 Mon Sep 17 00:00:00 2001
From: John Spencer <maillist-alsa@barfooze.de>
Date: Sat, 15 Nov 2014 13:41:00 +0100
Subject: [PATCH] snd_dlsym: only do versioning checks if built 
--with-versioning

a combination of some of the following garbage collecting LD/CFLAGS
-Os -g0 -fdata-sections -ffunction-sections -s -Wl,--gc-sections
-fno-unwind-tables -fno-asynchronous-unwind-tables
causes the symbol versioning marker symbols to be removed from BSS
since they're otherwise unreferenced. this causes dlsym failing to
find them which results in runtime breakage:

$ alsamixer
ALSA lib dlmisc.c:142:(snd_dlsym_verify) unable to verify version for 
symbol snd_config_hook_load
ALSA lib conf.c:3328:(snd_config_hooks_call) symbol snd_config_hook_load 
is not defined inside (null)
ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing 
configuration
cannot open mixer: No such device or address

correct DSO:
$ objdump -T libasound.so.2.strip | grep 
_snd_config_hook_load_dlsym_config_hook_001
001196bc g    DO .bss   00000001 _snd_config_hook_load_dlsym_config_hook_001

incorrect DSO:
$ objdump -T libs/libasound.so.2 | grep 
_snd_config_hook_load_dlsym_config_hook_001
00000000 g    DO *ABS*  00000001 _snd_config_hook_load_dlsym_config_hook_001

since alsa was built with --without-versioning, doing those versioning
checks at all is unnecessary and harmful and thus now disabled in this case.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>

---
  src/dlmisc.c | 2 ++
  1 file changed, 2 insertions(+)


[-- Attachment #2: 0001-snd_dlsym-only-do-versioning-checks-if-built-with-ve.patch --]
[-- Type: text/plain, Size: 1990 bytes --]

From 291553a0132936611d48f41e924601dff8941537 Mon Sep 17 00:00:00 2001
From: John Spencer <maillist-alsa@barfooze.de>
Date: Sat, 15 Nov 2014 13:41:00 +0100
Subject: [PATCH] snd_dlsym: only do versioning checks if built --with-versioning

a combination of some of the following garbage collecting LD/CFLAGS
-Os -g0 -fdata-sections -ffunction-sections -s -Wl,--gc-sections
-fno-unwind-tables -fno-asynchronous-unwind-tables
causes the symbol versioning marker symbols to be removed from BSS
since they're otherwise unreferenced. this causes dlsym failing to
find them which results in runtime breakage:

$ alsamixer
ALSA lib dlmisc.c:142:(snd_dlsym_verify) unable to verify version for symbol snd_config_hook_load
ALSA lib conf.c:3328:(snd_config_hooks_call) symbol snd_config_hook_load is not defined inside (null)
ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration
cannot open mixer: No such device or address

correct DSO:
$ objdump -T libasound.so.2.strip | grep _snd_config_hook_load_dlsym_config_hook_001
001196bc g    DO .bss   00000001 _snd_config_hook_load_dlsym_config_hook_001

incorrect DSO:
$ objdump -T libs/libasound.so.2 | grep _snd_config_hook_load_dlsym_config_hook_001
00000000 g    DO *ABS*  00000001 _snd_config_hook_load_dlsym_config_hook_001

since alsa was built with --without-versioning, doing those versioning
checks at all is unnecessary and harmful and thus now disabled in this case.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>

---
 src/dlmisc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dlmisc.c b/src/dlmisc.c
index 4b8a02c..62f7047 100644
--- a/src/dlmisc.c
+++ b/src/dlmisc.c
@@ -177,11 +177,13 @@ void *snd_dlsym(void *handle, const char *name, const char *version)
 	}
 #endif
 #ifdef HAVE_LIBDL
+#ifdef VERSIONED_SYMBOLS
 	if (version) {
 		err = snd_dlsym_verify(handle, name, version);
 		if (err < 0)
 			return NULL;
 	}
+#endif
 	return dlsym(handle, name);
 #else
 	return NULL;
-- 
1.8.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2014-11-15 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 12:55 John Spencer [this message]
2014-11-16  8:45 ` [PATCH] snd_dlsym: only do versioning checks if built --with-versioning 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=54674D5A.3010500@barfooze.de \
    --to=maillist-alsa@barfooze.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=sabotage@lists.openwall.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.