libsemanage: Bump libsemanage.so version
Bcc:
Subject: Re: [PATCH 4/4] libsemanage: Bump libsemanage.so version Reply-To:
In-Reply-To: <CAJfZ7=m5bwek=R_6gObMGdAKXNYSUwZU-rWv7EPAhw8SQU_vfg@mail.gmail.com>
Quoted 53 lines · Nicolas Iooss
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.
Quoted 5 lines
Thanks for the details. Debian policy makes sense and I agree with bumping the version in the SONAME.
Nicolas
Thanks, I'll prepare another patchset with improved commit messages.
In the mean time I'm looking into removing deprecated symbols from libsepol as it's supposed to be required only by selinux components. So far I've found that deprecated sepol_check_context() is used in chkcon utility. As Fedora doesn't ship this tool I incline to remove it from libsepol as well.
And there's also
/* Deprecated */
struct sepol_handle sepol_compat_handle = {
.msg_callback = sepol_msg_default_handler, .msg_callback_arg = NULL,
};
void sepol_debug(int on)
{
sepol_compat_handle.msg_callback = (on) ?
sepol_msg_default_handler : NULL;
}/* End deprecated */
which is used on few places internally.
Later I'll check whether sssd uses any on deprecated libsemanage symbol and decide what to do.
Stephen Smalley
maintainerQuoted 6 lines · Petr Lautrbach
Thanks, I'll prepare another patchset with improved commit messages.
In the mean time I'm looking into removing deprecated symbols from libsepol as it's supposed to be required only by selinux components. So far I've found that deprecated
sepol_check_context()is used in chkcon utility. As Fedora doesn't ship this tool I incline to remove it from libsepol as well.
Looks like it is also used by setfiles and sefcontext_compile at least. Might have been copied into external packages as well, e.g. busybox. So that one might need to stay. The reason it was deprecated was because it predated the introduction of the use of sepol handles and relied on global state set previously via sepol_set_policydb_from_file(), so I think the idea was to convert over to using sepol_context_check() instead (but this requires a much longer sequence of calls, ala h = sepol_handle_create(); sepol_policy_file_create(&pf); sepol_policy_file_set_fp(pf, fp); sepol_policy_file_set_handle(pf, h); sepol_policydb_create(&policydb); sepol_policydb_read(policydb, pf); sepol_context_from_string(h, string, &ctx); sepol_context_check(h, policydb, ctx);). Probably not worth the trouble now.
Quoted 14 lines
And there's also
/* Deprecated */
structsepol_handlesepol_compat_handle= {
.msg_callback =sepol_msg_default_handler, .msg_callback_arg = NULL,
};void
sepol_debug(int on)
{
sepol_compat_handle.msg_callback = (on) ?
sepol_msg_default_handler: NULL;
}
Quoted 7 lines
/* End deprecated */
which is used on few places internally.
Later I'll check whether sssd uses any on deprecated libsemanage symbol and decide what to do.
The main ones in libsepol that I was referencing were the ones in libsepol/src/deprecated_funcs.c.
Quoted 8 lines · Stephen Smalley
Quoted 6 lines · Petr Lautrbach
Thanks, I'll prepare another patchset with improved commit messages.
In the mean time I'm looking into removing deprecated symbols from libsepol as it's supposed to be required only by selinux components. So far I've found that deprecated
sepol_check_context()is used in chkcon utility. As Fedora doesn't ship this tool I incline to remove it from libsepol as well.
Quoted 13 lines
Looks like it is also used by setfiles and
sefcontext_compileat least. Might have been copied into external packages as well, e.g. busybox. So that one might need to stay. The reason it was deprecated was because it predated the introduction of the use of sepol handles and relied on global state set previously viasepol_set_policydb_from_file(), so I think the idea was to convert over to usingsepol_context_check()instead (but this requires a much longer sequence of calls, ala h =sepol_handle_create();sepol_policy_file_create(&pf);sepol_policy_file_set_fp(pf, fp);sepol_policy_file_set_handle(pf, h);sepol_policydb_create(&policydb);sepol_policydb_read(policydb, pf);sepol_context_from_string(h, string, &ctx);sepol_context_check(h, policydb, ctx);). Probably not worth the trouble now.
BTW Busybox urgently could use some modernization. It might not even work fully anymore with recent kernels. For example its a user space object manager (for the passwd class) and it does not use selinux_check_access()
Theres also just generally a lot old stuff that has been improved since
It still works on Linux 5.4 (I use it with OpenWrt) but compiling it floods the screen with "deprecation notices". Most notably for selinux_context_t
If and once OpenWrt moves to Linux 5.9 (new LTS) some functionality may no longer work
Quoted 25 lines
Quoted 15 lines
And there's also
/* Deprecated */
structsepol_handlesepol_compat_handle= {
.msg_callback =sepol_msg_default_handler, .msg_callback_arg = NULL,
};void
sepol_debug(int on)
{
sepol_compat_handle.msg_callback = (on) ?
sepol_msg_default_handler: NULL;
}Quoted 7 lines
/* End deprecated */
which is used on few places internally.
Later I'll check whether sssd uses any on deprecated libsemanage symbol and decide what to do.
The main ones in libsepol that I was referencing were the ones in
libsepol/src/deprecated_funcs.c.
Signature · 4 lines
gpg --locate-keys [email protected] Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098 https://sks-keyservers.net/pks/lookup?op=get&search=0xDA7E521F10F64098 Dominick Grift