Skip to contentSkip to conversation

libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385)

PATCH Superseded Cathy Hu 1 participant 2 messages May 29 – Jun 1 SELinux security module

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Cathy Hu

author
#0 lore raw

PATCH v2 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
index f870dc68..782e4045 100644
@@ -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
author
#1 lore raw

Please ignore v1 and v2, likely won't work with DISABLE_SHARED=y.

I sent a v3, sorry for the inconvenience

Quoted 47 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
   ```

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
index f870dc68..782e4045 100644
@@ -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)