From patchwork Sat Nov 15 12:55:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Spencer X-Patchwork-Id: 5311721 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5B526C11AC for ; Sat, 15 Nov 2014 12:57:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43A082013D for ; Sat, 15 Nov 2014 12:57:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8AFFA20138 for ; Sat, 15 Nov 2014 12:57:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2F8352605C4; Sat, 15 Nov 2014 13:57:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id BFCF42605B2; Sat, 15 Nov 2014 13:57:21 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0293B2605B6; Sat, 15 Nov 2014 13:57:19 +0100 (CET) Received: from hindenburg.barfooze.de (hindenburg.barfooze.de [195.154.9.123]) by alsa0.perex.cz (Postfix) with ESMTP id E3E562605B1 for ; Sat, 15 Nov 2014 13:57:11 +0100 (CET) Received: from [127.0.0.1] (115.Red-2-139-73.dynamicIP.rima-tde.net [2.139.73.115]) (authenticated bits=0) by hindenburg.barfooze.de (8.14.7/8.14.7) with ESMTP id sAFCv8Y5041588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 15 Nov 2014 13:57:10 +0100 (CET) (envelope-from maillist-alsa@barfooze.de) Message-ID: <54674D5A.3010500@barfooze.de> Date: Sat, 15 Nov 2014 13:55:54 +0100 From: John Spencer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: alsa-devel Cc: sabotage@lists.openwall.com Subject: [alsa-devel] [PATCH] snd_dlsym: only do versioning checks if built --with-versioning X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From 291553a0132936611d48f41e924601dff8941537 Mon Sep 17 00:00:00 2001 From: John Spencer 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 --- src/dlmisc.c | 2 ++ 1 file changed, 2 insertions(+) From 291553a0132936611d48f41e924601dff8941537 Mon Sep 17 00:00:00 2001 From: John Spencer 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 --- 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;