libsepol: Get rid of the old and duplicated symbols
PATCH 1/4 libsepol: Get rid of the old and duplicated symbols
Versioned duplicate symbols cause problems for LTO. These symbols were introduced during the CIL integration several releases ago and were only consumed by other SELinux userspace components.
--- libsepol/cil/src/cil.c | 84 ------------------------------------ libsepol/src/libsepol.map.in | 5 --- 2 files changed, 89 deletions(-)
libsepol/cil/src/cil.c +0 -84
@@ -51,27 +51,6 @@#include "cil_policy.h" #include "cil_strpool.h" -#if !defined(SHARED ) || defined(ANDROID ) || defined(__APPLE__) -#define DISABLE_SYMVER 1 -#endif - -#ifndef DISABLE_SYMVER -asm(".symver cil_build_policydb_pdb, cil_build_policydb@LIBSEPOL_1.0" ); -asm(".symver cil_build_policydb_create_pdb, cil_build_policydb@@LIBSEPOL_1.1" ); - -asm(".symver cil_compile_pdb, cil_compile@LIBSEPOL_1.0" ); -asm(".symver cil_compile_nopdb, cil_compile@@LIBSEPOL_1.1" ); - -asm(".symver cil_userprefixes_to_string_pdb, cil_userprefixes_to_string@LIBSEPOL_1.0" ); -asm(".symver cil_userprefixes_to_string_nopdb, cil_userprefixes_to_string@@LIBSEPOL_1.1" ); - -asm(".symver cil_selinuxusers_to_string_pdb, cil_selinuxusers_to_string@LIBSEPOL_1.0" ); -asm(".symver cil_selinuxusers_to_string_nopdb, cil_selinuxusers_to_string@@LIBSEPOL_1.1" ); - -asm(".symver cil_filecons_to_string_pdb, cil_filecons_to_string@LIBSEPOL_1.0" ); -asm(".symver cil_filecons_to_string_nopdb, cil_filecons_to_string@@LIBSEPOL_1.1" ); -#endif -int cil_sym_sizes[CIL_SYM_ARRAY_NUM ][CIL_SYM_NUM ] = { {64 ,64 ,64 ,1 <<13 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 }, {64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 ,64 },
@@ -549,11 +528,7 @@ exit:return rc; } -#ifdef DISABLE_SYMVER int cil_compile (struct cil_db *db) -#else -int cil_compile_nopdb(struct cil_db *db) -#endif {int rc =SEPOL_ERR ;
@@ -597,33 +572,7 @@ exit:return rc; } -#ifndef DISABLE_SYMVER -int cil_compile_pdb (struct cil_db *db, __attribute__((unused))sepol_policydb_t *sepol_db) -{ -return cil_compile_nopdb (db); -} - -int cil_build_policydb_pdb (cil_db_t *db,sepol_policydb_t *sepol_db) -{ -int rc; - -cil_log (CIL_INFO ,"Building policy binary\n" ); - rc =cil_binary_create_allocated_pdb (db, sepol_db); -if (rc !=SEPOL_OK ) { -cil_log (CIL_ERR ,"Failed to generate binary\n" ); - goto exit; - } - -exit: -return rc; -} -#endif - -#ifdef DISABLE_SYMVER int cil_build_policydb (cil_db_t *db,sepol_policydb_t **sepol_db) -#else -int cil_build_policydb_create_pdb(cil_db_t *db, sepol_policydb_t **sepol_db) -#endif {int rc;
@@ -1371,11 +1320,7 @@ const char * cil_node_to_string(struct cil_tree_node *node)return "<unknown>" ; } -#ifdef DISABLE_SYMVER int cil_userprefixes_to_string (struct cil_db *db,char **out,size_t *size) -#else -int cil_userprefixes_to_string_nopdb(struct cil_db *db, char **out, size_t *size) -#endif {int rc =SEPOL_ERR ;size_t str_len =0 ;
@@ -1420,13 +1365,6 @@ exit: } -#ifndef DISABLE_SYMVER -int cil_userprefixes_to_string_pdb (struct cil_db *db, __attribute__((unused))sepol_policydb_t *sepol_db,char **out,size_t *size) -{ -return cil_userprefixes_to_string_nopdb (db, out, size); -} -#endif -static int cil_cats_to_ebitmap (struct cil_cats *cats,struct ebitmap * cats_ebitmap) {int rc =SEPOL_ERR ;
@@ -1614,11 +1552,7 @@ static int __cil_level_to_string(struct cil_level *lvl, char *out)return str_tmp - out; } -#ifdef DISABLE_SYMVER int cil_selinuxusers_to_string (struct cil_db *db,char **out,size_t *size) -#else -int cil_selinuxusers_to_string_nopdb(struct cil_db *db, char **out, size_t *size) -#endif {size_t str_len =0 ;int buf_pos =0 ;
@@ -1675,18 +1609,7 @@ int cil_selinuxusers_to_string_nopdb(struct cil_db *db, char **out, size_t *sizereturn SEPOL_OK ; } -#ifndef DISABLE_SYMVER -int cil_selinuxusers_to_string_pdb (struct cil_db *db, __attribute__((unused))sepol_policydb_t *sepol_db,char **out,size_t *size) -{ -return cil_selinuxusers_to_string_nopdb (db, out, size); -} -#endif - -#ifdef DISABLE_SYMVER int cil_filecons_to_string (struct cil_db *db,char **out,size_t *size) -#else -int cil_filecons_to_string_nopdb(struct cil_db *db, char **out, size_t *size) -#endif {uint32_t i =0 ;int buf_pos =0 ;
@@ -1804,13 +1727,6 @@ int cil_filecons_to_string_nopdb(struct cil_db *db, char **out, size_t *size)return SEPOL_OK ; } -#ifndef DISABLE_SYMVER -int cil_filecons_to_string_pdb (struct cil_db *db, __attribute__((unused))sepol_policydb_t *sepol_db,char **out,size_t *size) -{ -return cil_filecons_to_string_nopdb (db, out, size); -} -#endif -void cil_set_disable_dontaudit (struct cil_db *db,int disable_dontaudit) { db->disable_dontaudit = disable_dontaudit;
libsepol/src/libsepol.map.in +0 -5
@@ -1,19 +1,14 @@ LIBSEPOL_1.0 { global: cil_add_file; - cil_build_policydb; - cil_compile; cil_db_destroy; cil_db_init; - cil_filecons_to_string; - cil_selinuxusers_to_string; cil_set_disable_dontaudit; cil_set_disable_neverallow; cil_set_handle_unknown; cil_set_log_handler; cil_set_log_level; cil_set_preserve_tunables; - cil_userprefixes_to_string; expand_module_avrules; sepol_bool_clone; sepol_bool_compare;
Signature · 1 line
2.28.0
PATCH 2/4 libsepol: Bump libsepol.so version
It's due to the previous ABI incompatible change.
--- libselinux/src/load_policy.c | 2 +- libsepol/src/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libselinux/src/load_policy.c +1 -1
@@ -76,7 +76,7 @@ int selinux_mkload_policy(int preservebools __attribute__((unused)))#ifdef SHARED char *errormsg =NULL ;void *libsepolh =NULL ; - libsepolh =dlopen ("libsepol.so.1" ,RTLD_NOW ); + libsepolh =dlopen ("libsepol.so.2" ,RTLD_NOW );if (libsepolh) { usesepol =1 ;dlerror ();
libsepol/src/Makefile +1 -1
@@ -7,7 +7,7 @@ RANLIB ?= ranlib CILDIR ?= ../cil VERSION = $(shell cat ../VERSION) -LIBVERSION = 1 +LIBVERSION = 2 LEX = flex CIL_GENERATED = $(CILDIR)/src/cil_lexer.c
Signature · 1 line
2.28.0
PATCH 3/4 libsemanage: Remove legacy and duplicate symbols
In reply to Petr LautrbachVersioned duplicate symbols cause problems for LTO. These symbols were introduced during the CIL integration several releases ago and were only consumed by other SELinux userspace components.
--- libsemanage/include/semanage/modules.h | 2 +- libsemanage/src/libsemanage.map | 5 -- libsemanage/src/modules.c | 100 +------------------------ libsemanage/src/modules.h | 9 +-- libsemanage/src/semanageswig_python.i | 2 - 5 files changed, 4 insertions(+), 114 deletions(-)
libsemanage/include/semanage/modules.h +1 -1
@@ -33,7 +33,7 @@ typedef struct semanage_module_key semanage_module_key_t;*/ extern int semanage_module_install (semanage_handle_t *, -char *module_data,size_t data_len,char *name,char *ext_lang); +char *module_data,size_t data_len,const char *name,const char *ext_lang);extern int semanage_module_install_file (semanage_handle_t *,const char *module_name);extern int semanage_module_remove (semanage_handle_t *,char *module_name);
libsemanage/src/libsemanage.map +0 -5
@@ -167,18 +167,13 @@ LIBSEMANAGE_1.0 { semanage_mls_enabled; semanage_module_disable; semanage_module_enable; - semanage_module_get_enabled; semanage_module_get_name; semanage_module_get_version; semanage_module_info_datum_destroy; - semanage_module_install; - semanage_module_install_base; - semanage_module_install_base_file; semanage_module_install_file; semanage_module_list; semanage_module_list_nth; semanage_module_remove; - semanage_module_upgrade; semanage_module_upgrade_file; semanage_msg_get_channel; semanage_msg_get_fname;
libsemanage/src/modules.c +2 -98
130 lines not on this page · raw message
libsemanage/src/modules.h +1 -8
@@ -26,16 +26,9 @@#include "semanage/modules.h" -int semanage_module_install_pp (semanage_handle_t * sh, -char *module_data,size_t data_len); -int semanage_module_install_hll (semanage_handle_t * sh, -char *module_data,size_t data_len,const char *name,const char *ext_lang); -int semanage_module_upgrade (semanage_handle_t * sh, -char *module_data,size_t data_len); +int semanage_module_upgrade_file (semanage_handle_t * sh,const char *module_name); -int semanage_module_install_base (semanage_handle_t * sh, -char *module_data,size_t data_len);int semanage_module_install_base_file (semanage_handle_t * sh,const char *module_name);
libsemanage/src/semanageswig_python.i +0 -2
@@ -30,8 +30,6 @@ %} %include "stdint.i" -%ignore semanage_module_install_pp; -%ignore semanage_module_install_hll; %wrapper %{
Signature · 1 line
2.28.0
PATCH 4/4 libsemanage: Bump libsemanage.so version
In reply to Petr LautrbachIt's due to the previous ABI incompatible change
--- libsemanage/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/Makefile +1 -1
@@ -32,7 +32,7 @@ YACC = bison YFLAGS = -d VERSION = $(shell cat ../VERSION) -LIBVERSION = 1 +LIBVERSION = 2 LIBA=libsemanage.a TARGET=libsemanage.so
Signature · 1 line
2.28.0
Stephen Smalley
maintainerRe: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>
My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64
# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64
I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/
E.g. for libsemanage, I've added
+%set_build_flags
+CFLAGS="$CFLAGS -fno-semantic-interposition"
+sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build
+cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
Petr
Stephen Smalley
maintainerRe: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 47 lines · Petr Lautrbach
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/E.g. for libsemanage, I've added
+%set_build_flags
(quoted diff) +4
-0+CFLAGS="$CFLAGS -fno-semantic-interposition" +sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build +cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1
Quoted 2 lines
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
The parted dependency looks suspect; seems to be an incorrect linking with libsepol despite not directly calling any sepol functions. Aside from that, if we have to bump the so version and deal with compat packages anyway, should we go ahead and purge all of the other deprecated functions in libsepol and libsemanage (grep -ri deprecated libsepol libsemanage)?
Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Petr Lautrbach
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/E.g. for libsemanage, I've added
+%set_build_flags
(quoted diff) +4
-0+CFLAGS="$CFLAGS -fno-semantic-interposition" +sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build +cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1
Quoted 10 lines
Quoted 2 lines
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
The parted dependency looks suspect; seems to be an incorrect linking with libsepol despite not directly calling any sepol functions. Aside from that, if we have to bump the so version and deal with compat packages anyway, should we go ahead and purge all of the other deprecated functions in libsepol and libsemanage (grep -ri deprecated libsepol libsemanage)?
I'd like to ship compat only for short time until all dependent components are rebuilt.
Purging deprecated functions could have much bigger impact than this patchset as it affects API. With this change, it's generally enough to rebuild a component. If we drop functions
and change API, different software could stop work. There are only few packages
using libsepol and libsemanage directly, but there might be much bigger group of python or ruby scripts using deprecated symbols like matchpathcon*()
Petr
Stephen Smalley
maintainerRe: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 61 lines · Petr Lautrbach
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Petr Lautrbach
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/E.g. for libsemanage, I've added
+%set_build_flags
(quoted diff) +4
-0+CFLAGS="$CFLAGS -fno-semantic-interposition" +sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build +cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1Quoted 10 lines
Quoted 2 lines
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
The parted dependency looks suspect; seems to be an incorrect linking with libsepol despite not directly calling any sepol functions. Aside from that, if we have to bump the so version and deal with compat packages anyway, should we go ahead and purge all of the other deprecated functions in libsepol and libsemanage (grep -ri deprecated libsepol libsemanage)?
Quoted 8 lines
I'd like to ship compat only for short time until all dependent components are rebuilt.
Purging deprecated functions could have much bigger impact than this patchset as it affects API. With this change, it's generally enough to rebuild a component. If we drop functions
and change API, different software could stop work. There are only few packages
using libsepol and libsemanage directly, but there might be much bigger group of python or ruby scripts using deprecated symbols like matchpathcon*()
Yes, I just meant libsepol and libsemanage deprecated functions not libselinux (so not matchpathcon) since you are already bumping the so version. But it's fine if you don't want to do it at the same time.
Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 71 lines · Stephen Smalley
Quoted 61 lines · Petr Lautrbach
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Petr Lautrbach
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/E.g. for libsemanage, I've added
+%set_build_flags
(quoted diff) +4
-0+CFLAGS="$CFLAGS -fno-semantic-interposition" +sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build +cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1Quoted 10 lines
Quoted 2 lines
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
The parted dependency looks suspect; seems to be an incorrect linking with libsepol despite not directly calling any sepol functions. Aside from that, if we have to bump the so version and deal with compat packages anyway, should we go ahead and purge all of the other deprecated functions in libsepol and libsemanage (grep -ri deprecated libsepol libsemanage)?
Quoted 8 lines
I'd like to ship compat only for short time until all dependent components are rebuilt.
Purging deprecated functions could have much bigger impact than this patchset as it affects API. With this change, it's generally enough to rebuild a component. If we drop functions
and change API, different software could stop work. There are only few packages
using libsepol and libsemanage directly, but there might be much bigger group of python or ruby scripts using deprecated symbols like matchpathcon*()
Quoted 4 lines
Yes, I just meant libsepol and libsemanage deprecated functions not libselinux (so not matchpathcon) since you are already bumping the so version. But it's fine if you don't want to do it at the same time.
I see, I missed that point, sorry. It seems to be reasonable, but I'll check it again tomorrow.
Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 73 lines · Petr Lautrbach
Quoted 71 lines · Stephen Smalley
Quoted 69 lines · Petr Lautrbach
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Petr Lautrbach
Quoted 11 lines · Stephen Smalley
Quoted 4 lines · Petr Lautrbach
It's due to the previous ABI incompatible change
Signed-off-by Petr Lautrbach <[email protected]>My only real question is what are the implications for distros for this change? Would Fedora end up having to carry both so versions for a time? Or can you cleanly switch from the old to the new without disruption?
Fedora and other distribution will need to temporary ship something like libsepol-compat and libsemanage-compat with libsepol.so.1 resp libsemanage.so.1 in order not to break buildroots. Also all packages which require so.1, see bellow, will have to be rebuilt against so.2
# dnf repoquery --whatrequires libsepol.'so.1()(64bit)' libselinux-utils-0:3.1-3.fc34.x86_64 libsemanage-0:3.1-2.fc33.x86_64 libsepol-devel-0:3.1-3.fc33.x86_64 parted-0:3.3-6.fc34.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-setools-0:4.3.0-5.fc33.x86_64 secilc-0:3.1-2.fc33.x86_64# dnf -C repoquery --whatrequires 'libsemanage.so.1()(64bit)' libsemanage-devel-0:3.1-2.fc33.x86_64 policycoreutils-0:3.1-4.fc33.x86_64 python3-libsemanage-0:3.1-2.fc33.x86_64 shadow-utils-2:4.8.1-4.fc33.x86_64 sssd-common-0:2.3.1-4.fc33.x86_64 sssd-ipa-0:2.3.1-4.fc33.x86_64I've experienced with this, builds are available in
https://copr.fedorainfracloud.org/coprs/plautrba/selinux-fedora/E.g. for libsemanage, I've added
+%set_build_flags
(quoted diff) +4
-0+CFLAGS="$CFLAGS -fno-semantic-interposition" +sed -i 's/LIBVERSION = 2/LIBVERSION = 1/' src/Makefile +%make_build +cp src/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so.1Quoted 10 lines
Quoted 2 lines
to the spec file in order to get libsemanage.so.1 which is shipped by libsemanage.so.1
The parted dependency looks suspect; seems to be an incorrect linking with libsepol despite not directly calling any sepol functions. Aside from that, if we have to bump the so version and deal with compat packages anyway, should we go ahead and purge all of the other deprecated functions in libsepol and libsemanage (grep -ri deprecated libsepol libsemanage)?
I'd like to ship compat only for short time until all dependent components are rebuilt.
Purging deprecated functions could have much bigger impact than this patchset as it affects API. With this change, it's generally enough to rebuild a component. If we drop functions
and change API, different software could stop work. There are only few packages
using libsepol and libsemanage directly, but there might be much bigger group of python or ruby scripts using deprecated symbols like matchpathcon*()
Quoted 7 lines
Quoted 4 lines
Yes, I just meant libsepol and libsemanage deprecated functions not libselinux (so not matchpathcon) since you are already bumping the so version. But it's fine if you don't want to do it at the same time.
I see, I missed that point, sorry. It seems to be reasonable, but I'll check it again tomorrow.
Hello,
I have another question: why is bumping the .so version needed? As we are not changing the ABI of a "linked symbol" (thanks to using versioned symbols, with .map files), if we do not bump the .so version, programs that were built with libsepol.so from years ago will just stop working due to missing symbols, with an error message which will be quite clear (and this only if they were using deprecated symbols). In my humble opinion, bumping the .so version is most required when the calling convention of a non-versioned symbol changes, but this leads to unexpected execution paths.
Nevertheless I did not spend time to search for a document that would explain why bumping the .so version would be recommended when removing symbols. If you know one, could you please add a reference to it in the commit description ("Following guidelines from https://...) and/or to some documentation?
Quoted 1 line
From a "distro maintainer point of view" (for Arch Linux), having just
spent a considerable amount of time due to breaking changes in the last release of PAM, I am not eager to spend time dealing with finding clever ways to smoothly upgrade the system if there is no easy&straightforward way to do this. Introducing a transition package for each library which is bumped is acceptable to me, but if the release after the next one bumps the version again, introducing another set of transition packages will begin to be quite painful. In
short: I agree to remove the deprecated functions in order to "bump the .so version only once", as suggested.
Cheers,
Nicolas
Stephen Smalley
maintainerRe: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 19 lines · Nicolas Iooss
Hello,
I have another question: why is bumping the .so version needed? As we are not changing the ABI of a "linked symbol" (thanks to using versioned symbols, with .map files), if we do not bump the .so version, programs that were built with libsepol.so from years ago will just stop working due to missing symbols, with an error message which will be quite clear (and this only if they were using deprecated symbols). In my humble opinion, bumping the .so version is most required when the calling convention of a non-versioned symbol changes, but this leads to unexpected execution paths.Nevertheless I did not spend time to search for a document that would explain why bumping the .so version would be recommended when removing symbols. If you know one, could you please add a reference to it in the commit description ("Following guidelines from https://...) and/or to some documentation?
Quoted 1 line
From a "distro maintainer point of view" (for Arch Linux), having just
Quoted 9 lines
spent a considerable amount of time due to breaking changes in the last release of PAM, I am not eager to spend time dealing with finding clever ways to smoothly upgrade the system if there is no easy&straightforward way to do this. Introducing a transition package for each library which is bumped is acceptable to me, but if the release after the next one bumps the version again, introducing another set of transition packages will begin to be quite painful. In
short: I agree to remove the deprecated functions in order to "bump the .so version only once", as suggested.
My original understanding of library ABI compat requirements came from Ulrich Drepper's paper,
https://www.akkadia.org/drepper/dsohowto.pdf
Looks like Debian's policy is here:
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#run-time-shared-libraries
IIUC, if we follow the rules laid out by both, removing an old symbol version entirely is incompatible and requires a SONAME change. That said, commit c3f9492d7ff05bdc8581817655ad05bc1e1174b8 ("selinux:
Remove legacy local boolean and user code") was technically an incompatible change; it left the symbols in place but made them always fail or ignore no-longer-used parameters, which isn't truly compatible, and we didn't change the SONAMEs then.
I'd personally be ok with not changing the SONAME as long as these interfaces were only ever used by the selinux userspace code itself or only by really ancient code that is no longer in use by any supported distribution but I don't think that flies with e.g. the Debian policy.
Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version
Quoted 46 lines · Stephen Smalley
Quoted 19 lines · Nicolas Iooss
Hello,
I have another question: why is bumping the .so version needed? As we are not changing the ABI of a "linked symbol" (thanks to using versioned symbols, with .map files), if we do not bump the .so version, programs that were built with libsepol.so from years ago will just stop working due to missing symbols, with an error message which will be quite clear (and this only if they were using deprecated symbols). In my humble opinion, bumping the .so version is most required when the calling convention of a non-versioned symbol changes, but this leads to unexpected execution paths.Nevertheless I did not spend time to search for a document that would explain why bumping the .so version would be recommended when removing symbols. If you know one, could you please add a reference to it in the commit description ("Following guidelines from https://...) and/or to some documentation?
Quoted 1 line
From a "distro maintainer point of view" (for Arch Linux), having just
Quoted 9 lines
spent a considerable amount of time due to breaking changes in the last release of PAM, I am not eager to spend time dealing with finding clever ways to smoothly upgrade the system if there is no easy&straightforward way to do this. Introducing a transition package for each library which is bumped is acceptable to me, but if the release after the next one bumps the version again, introducing another set of transition packages will begin to be quite painful. In
short: I agree to remove the deprecated functions in order to "bump the .so version only once", as suggested.My original understanding of library ABI compat requirements came from Ulrich Drepper's paper,
https://www.akkadia.org/drepper/dsohowto.pdfLooks like Debian's policy is here:
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#run-time-shared-librariesIIUC, if we follow the rules laid out by both, removing an old symbol version entirely is incompatible and requires a SONAME change. That said, commit
c3f9492d7ff05bdc8581817655ad05bc1e1174b8("selinux:
Remove legacy local boolean and user code") was technically an incompatible change; it left the symbols in place but made them always fail or ignore no-longer-used parameters, which isn't truly compatible, and we didn't change the SONAMEs then.
Quoted 4 lines
I'd personally be ok with not changing the SONAME as long as these interfaces were only ever used by the selinux userspace code itself or only by really ancient code that is no longer in use by any supported distribution but I don't think that flies with e.g. the Debian policy.
Thanks for the details. Debian policy makes sense and I agree with bumping the version in the SONAME.
Nicolas