libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385)
PATCH 1/1 libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385)
We encountered race conditions where the built order was:
1. libsemanage.a
2. python-3.13_semanage.so
3. libsemanage.so.*
That happened when make was called with -j2.
In this case, python-3.13_semanage.so tries to use libsemanage.a and
- on s390x: succeeds and builds an incorrect python-3.13_semanage.so (that one was found during product testing)
- on x86: fails (manually reproduced, never encountered IRL) Reproducer:
``` cd selinux/libsemanage/src make clean make pywrap find . -wholename "*libsemanage.so*" -delete find . -wholename "*python*.so" -delete make python-3.13_semanage.so -> fails ```
Therefor hard-require LIBSO to be present before SWIGSO and probably also SWIGRUBYSO.
--- libsemanage/src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libsemanage/src/Makefile +2 -2
@@ -82,10 +82,10 @@ $(SWIGLOBJ): $(SWIGCOUT) $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< -$(SWIGSO): $(SWIGLOBJ) +$(SWIGSO): $(SWIGLOBJ) $(LIBSO) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -fPIC -shared -o $@ $< -lsemanage $(PYLIBS) -$(SWIGRUBYSO): $(SWIGRUBYLOBJ) +$(SWIGRUBYSO): $(SWIGRUBYLOBJ) $(LIBSO) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -fPIC -shared -o $@ $^ -lsemanage $(RUBYLIBS) $(LIBA): $(OBJS)
Signature · 1 line
2.54.0
Quoted 22 lines · Cathy Hu
We encountered race conditions where the built order was:
1. libsemanage.a
2. python-3.13_semanage.so
3. libsemanage.so.*That happened when make was called with
-j2.In this case, python-3.13_semanage.so tries to use libsemanage.a and
- on s390x: succeeds and builds an incorrect python-3.13_semanage.so (that one was found during product testing)
- on x86: fails (manually reproduced, never encountered IRL) Reproducer:``` cd selinux/libsemanage/src make clean make pywrap find . -wholename "*libsemanage.so*" -delete find . -wholename "*python*.so" -delete make python-3.13_semanage.so -> fails ```
Quoted 2 lines
Therefor hard-require LIBSO to be present before SWIGSO and probably also SWIGRUBYSO.
Please add Signed-off-by: tag
https://github.com/SELinuxProject/selinux/blob/main/CONTRIBUTING.md#contributing-code
Quoted 23 lines
--- libsemanage/src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libsemanage/src/Makefile +2
-2@@ -82,10 +82,10 @@ $(SWIGLOBJ): $(SWIGCOUT) $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< -$(SWIGSO): $(SWIGLOBJ) +$(SWIGSO): $(SWIGLOBJ) $(LIBSO) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -fPIC -shared -o $@ $< -lsemanage $(PYLIBS) -$(SWIGRUBYSO): $(SWIGRUBYLOBJ) +$(SWIGRUBYSO): $(SWIGRUBYLOBJ) $(LIBSO) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -fPIC -shared -o $@ $^ -lsemanage $(RUBYLIBS) $(LIBA): $(OBJS)Signature · 1 line
2.54.0