libselinux: always provide matchpathcon_filespec_add64()
Stephen Smalley
maintainerPATCH 1/1 libselinux: always provide matchpathcon_filespec_add64()
libselinux.map lists matchpathcon_filespec_add64 unconditionally but the symbol is only defined when the public header renames matchpathcon_filespec_add() to the 64 variant.
On musl and 64-bit glibc and USE_LFS=n, the rename macro does not fire, so only the plain symbol is emitted and the version scripts references an undefined one. GNU ld permits this, but lld defaults to --no-undefined-version and fails the link.
Provide matchpathcon_filespec_add64() as a thin wrapper in every configuration that doesn't produce it via the rename, so that the symbol is always defined.
Fix: #512
Fix: #513
--- libselinux/src/matchpathcon.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
libselinux/src/matchpathcon.c +13 -1
@@ -299,7 +299,17 @@ int matchpathcon_filespec_add(unsigned long ino, int specind, const char *file) {return matchpathcon_filespec_add64 (ino, specind, file); } -#elif (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) || \ +#else + +extern int matchpathcon_filespec_add64 (uint64_t ino,int specind, +const char *file); + +int matchpathcon_filespec_add64 (uint64_t ino,int specind,const char *file) +{ +return matchpathcon_filespec_add (ino, specind, file); +} + +#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) || \ defined(__INO_T_MATCHES_INO64_T)static_assert (sizeof (uint64_t ) ==sizeof (ino_t),"inode size mismatch" );
@@ -310,6 +320,8 @@ static_assert(sizeof(uint32_t) == sizeof(ino_t), "inode size mismatch");#endif +#endif +/* * Evaluate the association hash table distribution. */
Signature · 1 line
2.54.0
Stephen Smalley
maintainerQuoted 14 lines · Stephen Smalley
libselinux.map lists
matchpathcon_filespec_add64unconditionally but the symbol is only defined when the public header renamesmatchpathcon_filespec_add()to the 64 variant.On musl and 64-bit glibc and USE_LFS=n, the rename macro does not fire, so only the plain symbol is emitted and the version scripts references an undefined one. GNU ld permits this, but lld defaults to --no-undefined-version and fails the link.
Provide
matchpathcon_filespec_add64()as a thin wrapper in every configuration that doesn't produce it via the rename, so that the symbol is always defined.
Quoted 6 lines
Fix: #512
Fix: #513Fixes 9395cc03226a0 ("Always build for LFS mode on 32-bit archs.")Reported-by Pepper Gray <[email protected]>Signed-off-by Stephen Smalley <[email protected]>
Based on further discussion on #513, I am NAK'ing my own patch and will follow up with one that fixes the linker flags.
Quoted 39 lines
--- libselinux/src/matchpathcon.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)libselinux/src/matchpathcon.c +13
-2@@ -299,7 +299,17 @@ int matchpathcon_filespec_add(unsigned long ino, int specind, const char *file) {return matchpathcon_filespec_add64 (ino, specind, file); } -#elif (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) || \ +#else + +extern int matchpathcon_filespec_add64 (uint64_t ino,int specind, +const char *file); + +int matchpathcon_filespec_add64 (uint64_t ino,int specind,const char *file) +{ +return matchpathcon_filespec_add (ino, specind, file); +} + +#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) || \ defined(__INO_T_MATCHES_INO64_T)static_assert (sizeof (uint64_t ) ==sizeof (ino_t),"inode size mismatch" );@@ -310,6 +320,8 @@ static_assert(sizeof(uint32_t) == sizeof(ino_t), "inode size mismatch");#endif +#endif +/* * Evaluate the association hash table distribution. */ --2.54.0