All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385)
@ 2026-05-29 12:50 Cathy Hu
  2026-05-29 13:36 ` Petr Lautrbach
  0 siblings, 1 reply; 2+ messages in thread
From: Cathy Hu @ 2026-05-29 12:50 UTC (permalink / raw)
  To: selinux; +Cc: Cathy Hu, selinux, fvogt

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(-)

diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index f870dc68..782e4045 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -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)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385)
  2026-05-29 12:50 [PATCH] libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385) Cathy Hu
@ 2026-05-29 13:36 ` Petr Lautrbach
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Lautrbach @ 2026-05-29 13:36 UTC (permalink / raw)
  To: Cathy Hu, selinux

Cathy Hu <cahu@suse.de> writes:

> 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.


Please add Signed-off-by: tag

https://github.com/SELinuxProject/selinux/blob/main/CONTRIBUTING.md#contributing-code

> ---
>  libsemanage/src/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
> index f870dc68..782e4045 100644
> --- a/libsemanage/src/Makefile
> +++ b/libsemanage/src/Makefile
> @@ -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)
> -- 
> 2.54.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-29 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 12:50 [PATCH] libsemanage: Require LIBSO before SWIGSO and SWIGRUBYSO (bsc#1266385) Cathy Hu
2026-05-29 13:36 ` Petr Lautrbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.