Skip to content

gfapi: drop the phantom symbols from gfapi.map and the public header, fix the glfs_mknodat label - #4813

Draft
ThalesBarretto wants to merge 3 commits into
gluster:develfrom
ThalesBarretto:build-audit-gfapi
Draft

ThalesBarretto wants to merge 3 commits into
gluster:develfrom
ThalesBarretto:build-audit-gfapi

Conversation

@ThalesBarretto

Copy link
Copy Markdown
Contributor

gfapi: drop the phantom symbols from gfapi.map and the public header, fix the glfs_mknodat label

gfapi.map and gfapi.aliases name three symbols that libgfapi has never defined: glfs_caller_specific_init
(declared in the public header since 2013, never implemented) and glfs_xreaddirplus_r_get_stat /
glfs_xreaddirplus_r_get_object (the design names of two accessors that were implemented and exported as
glfs_xreaddirplus_get_stat / glfs_xreaddirplus_get_object). GNU ld and gold drop such entries silently; lld, where
--no-undefined-version is the default since LLD 16, refuses the libgfapi link on all three. Details in #4811.

The change (three commits)

  1. gfapi: drop the never-implemented glfs_caller_specific_init(): remove the declaration from glfs-handles.h, the
    gfapi.map entry and the Darwin alias.
  2. gfapi: name the xreaddirplus accessors correctly in gfapi.map and gfapi.aliases: rename the two entries to the shipped
    names, so the GFAPI_3.11.0 node lists exactly what libgfapi exports.
  3. gfapi: fix the GFAPI_PUBLIC label of glfs_mknodat(): GFAPI_PUBLIC(glfs_mknod, 11.0) -> GFAPI_PUBLIC(glfs_mknodat, 11.0). A no-op on Linux (the macro is empty there); on Darwin the old label produced a second, wrong alias for
    glfs_mknod.

Test

  • Relink of api/src with LDFLAGS=-fuse-ld=lld (LLD 22): fails at devel with the three version script assignment ... symbol not defined errors, succeeds with this series.
  • Exported symbol set (readelf --dyn-syms, defined FUNC GLOBAL entries): identical before and after, with both bfd and
    lld; the GFAPI_3.5.0, GFAPI_3.11.0 and GFAPI_11.0 version nodes are still present.
  • A consumer calling glfs_caller_specific_init() used to compile and fail at link time; it now fails at compile time.
  • tests/basic/gfapi/ unaffected: no code path changes.

Fixes: #4811

glfs_caller_specific_init() has been declared in the public header
glfs-handles.h since 4a28b4c ("gfapi: object handle based API
extensions", 2013), listed in gfapi.map under GFAPI_3.5.0 since
f709dad and in gfapi.aliases since d4359ea, but it has never had
a definition anywhere in the tree. No libgfapi.so has ever exported it.

The effect is a compile-time trap for consumers (the header offers a
function that cannot be linked) and a version-script entry naming a
symbol the linker never sees. GNU ld and gold drop such an entry
silently; lld, where --no-undefined-version has been the default since
LLD 16, rejects the libgfapi link with "version script assignment of
'GFAPI_3.5.0' to symbol 'glfs_caller_specific_init' failed: symbol not
defined".

Remove the declaration, the map entry and the Darwin alias. Nothing can
depend on a symbol that never existed in any build.

Updates: gluster#4811
Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
…pi.aliases

06fada2 ("gfapi/handleops: Introducing glfs_xreaddirplus_r() fop for
handleops") implemented the two accessors as glfs_xreaddirplus_get_stat()
and glfs_xreaddirplus_get_object(), but recorded them in gfapi.map and
gfapi.aliases under the earlier design names glfs_xreaddirplus_r_get_stat
and glfs_xreaddirplus_r_get_object. The implemented pair is exported
through its .symver directive regardless (a .symver takes precedence over
the version script), so the mismatch never affected consumers; nfs-ganesha
uses both. The map and the aliases simply name two symbols that do not
exist while omitting the two that do.

GNU ld and gold ignore the dangling entries; lld (>= 16) fails the link
on them. Rename the entries to the shipped names so that the GFAPI_3.11.0
node lists exactly what libgfapi exports. The exported symbol set does
not change.

Updates: gluster#4811
Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
glfs_mknodat() is declared with GFAPI_PUBLIC(glfs_mknod, 11.0), a
copy-paste of the preceding glfs_mknod() declaration. On Linux the
macro expands to nothing, so the export (glfs_mknodat@@GFAPI_11.0, from
the .symver in glfs-fops.c) has always been correct. On Darwin the macro
is live and emits an __asm alias, so the typo produces a second, wrong
alias for glfs_mknod. Label the declaration with its own name.

Fixes: gluster#4811
Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gfapi: gfapi.map names three symbols libgfapi never defines (glfs_caller_specific_init, glfs_xreaddirplus_r_get_stat/_object); lld refuses the link

1 participant