From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81EBC3858CDB; Mon, 6 Nov 2023 12:08:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81EBC3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1699272532; bh=6jiqSYSFHz1VIDtS4F/7jXNie2pImxAWBAfr3W3kIkQ=; h=From:To:Subject:Date:From; b=xtiml7ON3tXVygnkpq3TSeoMQCm+SKvW5rJH9L//8Uv9wXibbndlHtgw2ag7+Clzs irmEaWNJc/FqTMA6vGvx8rsLBgjtFx9t6pGnY5/GKCC2+IufwnZwizTFz03HE7azv5 dxClTl9/1o2+20oGGLasmcK8ZJytWiidBNn16GxM= From: "matthew.malcomson at arm dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/31035] New: Library search path terminates on relative non-directory name Date: Mon, 06 Nov 2023 12:08:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.40 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matthew.malcomson at arm dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31035 Bug ID: 31035 Summary: Library search path terminates on relative non-directory name Product: glibc Version: 2.40 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: matthew.malcomson at arm dot com CC: drepper.fsp at gmail dot com Target Milestone: --- Created attachment 15212 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D15212&action=3Ded= it Shell session demonstrating issue. The function `open_path` in dl-load.c attempts to open a shared library in = each of the directories in a search path. It skips any directories which have been found to not exist (updating those with `unknown` to either `existing` or `nonexisting` as it continues). If this function fails to open a file with an `errno` of ENOENT or EACCES it continues, if it fails to open a file in an existing directory with any oth= er errno it bails. Entries on a search path which point at a file (instead of a directory) tri= gger an `open` fail with errno =3D ENOTDIR. With absolute pathnames this is not a problem because the code block updati= ng whether directories exist checks whether the path is a directory. With relative pathnames, `fillin_rpath` initialises the status to `existing= ` in order to ensure such relative names are always inspected (because the curre= nt directory does not change). Hence a relative pathname pointing to a file instead of a directory triggers `open_path` to ignore all successive entries in a search path. Shell session demonstrating the issue is attached. I guess one approach would be to add a check against ENOTDIR in the `open_p= ath` condition that checks against ENOENT and EACCES. --=20 You are receiving this mail because: You are on the CC list for the bug.=