define matchpathcon_filespec_add/add64
Stephen Smalley
maintainerPATCH v2 1/1 define matchpathcon_filespec_add/add64
From: Pepper Gray <[email protected]>
matchpathcon_filespec_add and matchpathcon_filespec_add64 are exported in libselinux.map, so both need to be linker-visible symbols
fix: #512
Signed-off-by Pepper Gray <[email protected]>
--- libselinux/include/selinux/selinux.h | 6 ++---- libselinux/src/matchpathcon.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-)
libselinux/include/selinux/selinux.h +2 -4
@@ -508,11 +508,9 @@ extern int matchpathcon_index(const char *path, mode_t mode, char **con);with the same inode (e.g. due to multiple hard links). If so, then use the latter of the two specifications based on their order in the file contexts configuration. Return the used specification index. */ -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 && \ - defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T) -#define matchpathcon_filespec_add matchpathcon_filespec_add64 -#endif extern int matchpathcon_filespec_add (ino_t ino,int specind,const char *file); +extern int matchpathcon_filespec_add64 (ino_t ino,int specind, +const char *file);/* Destroy any inode associations that have been added, e.g. to restart for a new filesystem. */
libselinux/src/matchpathcon.c +6 -10
@@ -280,25 +280,21 @@ oom:return -1 ; } +int matchpathcon_filespec_add64 (unsigned long ino,int specind, +const char *file) +{ +return matchpathcon_filespec_add (ino, specind, file); +} +#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) && \ defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T) -/* alias defined in the public header but we undefine it here */ -#undef matchpathcon_filespec_add/* ABI backwards-compatible shim for non-LFS 32-bit systems */ -static_assert (sizeof (unsigned long ) ==sizeof (__ino_t),"inode size mismatch" );static_assert (sizeof (unsigned long ) ==sizeof (uint32_t ),"inode size mismatch" );static_assert (sizeof (ino_t) ==sizeof (ino64_t),"inode size mismatch" );static_assert (sizeof (ino64_t) ==sizeof (uint64_t ),"inode size mismatch" ); -extern int matchpathcon_filespec_add (unsigned long ino,int specind, -const char *file); - -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 ) || \ defined(__INO_T_MATCHES_INO64_T)
Signature · 1 line
2.54.0
Stephen Smalley
maintainerQuoted 19 lines · Stephen Smalley
From: Pepper Gray <[email protected]>
matchpathcon_filespec_addandmatchpathcon_filespec_add64are exported in libselinux.map, so both need to be linker-visible symbolsfix: #512
Signed-off-by Pepper Gray <[email protected]>--- libselinux/include/selinux/selinux.h | 6 ++---- libselinux/src/matchpathcon.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-)libselinux/include/selinux/selinux.h +0
-0
libselinux/include/selinux/selinux.h extern int matchpathcon_index(const char *path, mode_t mode, char **con); · line 513
Quoted 10 lines
libselinux/include/selinux/selinux.h +2
-4@@ -508,11 +508,9 @@ extern int matchpathcon_index(const char *path, mode_t mode, char **con);with the same inode (e.g. due to multiple hard links). If so, then use the latter of the two specifications based on their order in the file contexts configuration. Return the used specification index. */ -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 && \ - defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T) -#define matchpathcon_filespec_add matchpathcon_filespec_add64 -#endif extern int matchpathcon_filespec_add (ino_t ino,int specind,const char *file); +extern int matchpathcon_filespec_add64 (ino_t ino,int specind, +const char *file);
This still seems wrong to me, sorry. Shouldn't the _add64 interface always use ino64_t or uint64_t or similar?
Otherwise, why does it exist?
Quoted 42 lines
libselinux/include/selinux/selinux.h +0
-0/* Destroy any inode associations that have been added, e.g. to restart for a new filesystem. */ libselinux/src/matchpathcon.c +6
-11@@ -280,25 +280,21 @@ oom:return -1 ; } +int matchpathcon_filespec_add64 (unsigned long ino,int specind, +const char *file) +{ +return matchpathcon_filespec_add (ino, specind, file); +} +#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS ==64 ) && \ defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T) -/* alias defined in the public header but we undefine it here */ -#undef matchpathcon_filespec_add/* ABI backwards-compatible shim for non-LFS 32-bit systems */ -static_assert (sizeof (unsigned long ) ==sizeof (__ino_t),"inode size mismatch" );static_assert (sizeof (unsigned long ) ==sizeof (uint32_t ),"inode size mismatch" );static_assert (sizeof (ino_t) ==sizeof (ino64_t),"inode size mismatch" );static_assert (sizeof (ino64_t) ==sizeof (uint64_t ),"inode size mismatch" ); -extern int matchpathcon_filespec_add (unsigned long ino,int specind, -const char *file); - -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 ) || \ defined(__INO_T_MATCHES_INO64_T) --2.54.0