Skip to content

Commit 1a4bf56

Browse files
committed
always exclude ELF dynamic linker/loader
1 parent 507619b commit 1a4bf56

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

auditwheel/elfutils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def elf_find_versioned_symbols(elf: ELFFile) -> Iterator[Tuple[str, str]]:
4545

4646
if section is not None:
4747
for verneed, verneed_iter in section.iter_versions():
48-
if verneed.name.startswith('ld-linux'):
48+
if verneed.name.startswith('ld-linux') or \
49+
verneed.name in ['ld64.so.2', 'ld64.so.1']:
4950
continue
5051
for vernaux in verneed_iter:
5152
yield (verneed.name,

auditwheel/policy/external_references.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ def lddtree_external_references(lddtree: Dict, wheel_path: str):
1616

1717
def filter_libs(libs, whitelist):
1818
for lib in libs:
19-
if 'ld-linux' in lib:
20-
# always exclude ld-linux.so
19+
if 'ld-linux' in lib or lib in ['ld64.so.2', 'ld64.so.1']:
20+
# always exclude ELF dynamic linker/loader
21+
# 'ld64.so.2' on s390x
22+
# 'ld64.so.1' on ppc64le
23+
# 'ld-linux*' on other platforms
2124
continue
2225
if LIBPYTHON_RE.match(lib):
2326
# always exclude libpythonXY

tests/integration/testdependencies/testdependencies.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#endif
88
#include <Python.h>
99

10+
static __thread int tres = 0;
11+
1012
static PyObject *
1113
run(PyObject *self, PyObject *args)
1214
{
@@ -24,14 +26,24 @@ run(PyObject *self, PyObject *args)
2426
#else
2527
res = 0;
2628
#endif
27-
return PyLong_FromLong(res);
29+
return PyLong_FromLong(res + tres);
30+
}
31+
32+
static PyObject *
33+
set_tres(PyObject *self, PyObject *args)
34+
{
35+
(void)self;
36+
(void)args;
37+
tres = 1;
38+
return PyLong_FromLong(tres);
2839
}
2940

3041
/* Module initialization */
3142
PyMODINIT_FUNC PyInit_testdependencies(void)
3243
{
3344
static PyMethodDef module_methods[] = {
3445
{"run", (PyCFunction)run, METH_NOARGS, "run."},
46+
{"set_tres", (PyCFunction)set_tres, METH_NOARGS, "set_tres."},
3547
{NULL} /* Sentinel */
3648
};
3749
static struct PyModuleDef moduledef = {

tests/unit/test_elfutils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,16 @@ def test_find_symbols(self):
9595
# THEN
9696
assert symbols == [("foo-lib", "foo-lib")]
9797

98-
def test_only_ld_linux(self):
98+
@pytest.mark.parametrize('ld_name', ['ld-linux', 'ld64.so.2', 'ld64.so.1'])
99+
def test_only_ld_linux(self, ld_name):
99100
# GIVEN
100101
elf = Mock()
101102
verneed = Mock()
102-
verneed.configure_mock(name="ld-linux")
103+
verneed.configure_mock(name=ld_name)
104+
veraux = Mock()
105+
veraux.configure_mock(name="foo-lib")
103106
elf.get_section_by_name.return_value.iter_versions.return_value = (
104-
(verneed, []),
107+
(verneed, [veraux]),
105108
)
106109

107110
# WHEN

0 commit comments

Comments
 (0)