Bug 24994 - $LIB (DL_DST_LIB) is incorrect on multiarch systems
Summary: $LIB (DL_DST_LIB) is incorrect on multiarch systems
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: dynamic-link (show other bugs)
Version: 2.30
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-12 08:17 UTC by Valentin David
Modified: 2022-10-28 18:54 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-09-12 00:00:00
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin David 2019-09-12 08:17:14 UTC
$LIB` is the directory name of the shared library directory. It is usually used as a relative directory from a prefix. That is, typically "/usr/$DIR" should point to the library directory. However in multiarch directory the relative path from prefix contains two components, e.g. lib/x86_64-linux-gnu. The way DL_DST_LIB is calculated strips the previous components of the path and only keeps x86_64-linux-gnu.

$(notdir $(slibdir)) should be replaced by something like $$(realpath $(slibdir) --relative-to=$(prefix)) or $(patsubst $(prefix)/%,%,$(slibdir))
Comment 1 Carlos O'Donell 2019-09-12 14:21:43 UTC
(In reply to Valentin David from comment #0)
> $LIB` is the directory name of the shared library directory. It is usually
> used as a relative directory from a prefix. That is, typically "/usr/$DIR"
> should point to the library directory. However in multiarch directory the
> relative path from prefix contains two components, e.g.
> lib/x86_64-linux-gnu. The way DL_DST_LIB is calculated strips the previous
> components of the path and only keeps x86_64-linux-gnu.

Agreed.

> $(notdir $(slibdir)) should be replaced by something like $$(realpath
> $(slibdir) --relative-to=$(prefix)) or $(patsubst $(prefix)/%,%,$(slibdir))

Valentin, Could you please prototype a patch for this and send it to libc-alpha? TO: me for review.
Comment 2 Seppo Yli-Olli 2022-10-28 18:54:36 UTC
Since apparently there has not been continuation, I'd note that we're currently carrying this patch https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/master/patches/glibc/fix-dl-dst-lib.patch which seems to fix the issue.