From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sun, 15 Nov 2026 09:52:57 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xSVyq-00B4kq-22 for lore@lore.pengutronix.de; Sun, 15 Nov 2026 09:52:57 +0100 Received: from [127.0.0.1] (helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1xSVyq-0004bg-3i; Sun, 15 Nov 2026 09:52:56 +0100 Received: from mx1.white.stw.pengutronix.de ([2a0a:edc0:0:b01:1d::107]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1xSVya-0004bZ-Eh for ptxdist@pengutronix.de; Sun, 15 Nov 2026 09:52:40 +0100 Received: from h2.cmg2.smtp.forpsi.com (h2.cmg2.smtp.forpsi.com [81.2.195.189]) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPS id DD918205A02; Sun, 15 Nov 2026 09:52:39 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1794732760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CJkeTEMUqxLFJz2pbMcQ9mbFfUjLNBZyoqVD7WSxiLw=; b=Y38h8T2rynuFqkDnYIym4XHylu7RW5M7w1zWh2XM4dO/2hbHAJt2cXcbU9UTf/7dzzvkId egvzyi8JjB5DudU2BjH9EOni97P/6Nd/6TUNfBoeTiDq+VjpJgiX6hSe/B7x7PwcBQtU1A K7B6CTwg0oh+MOyf732g7Oqk11aREhfpnQV1rlhkkseRoMuKpsRPER6A8uii9ntjqkrsU9 GGeMZwZVLFXnSlYWajtsGmOvW7DpwiQjgW3lV7k5izAvdLf/B6ABbc/c531PDbGt9wkmT1 XYiJDgQxSfPMXCvl458aKmMrunpuS2+Dt6HLACCVaE33VRnOVMArYRNkKGWsfw== ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1794732760; a=rsa-sha256; cv=none; b=B28BXqkQ/UXRKMHTJcILx+/qQUMKr+x+IBs5n18JVPToUNoJpnc0j+6lrDDhiuVHTgf94V O4HcDFfFiva9dwmfnHvxSAdVFwoFRvWtK6EEDJQ0IjGUWwjVGRlegoErk3xTzS4gCYlbPg hoPaFjLFxt6nqI0RxmfuJNAEZTx3pLrwsv2zR3dBP3qhOrsWyt8Zyvp5PF3TGOt+3+Heu8 WZgI6pcVfBzJRiNsOesprw+AjafTpKg/q18tIExx6xV5WvPXaIKMPBTRhBPmKcGlR3+jJg MVmTtlKDfVb6fpWqku6Eo/iI5TPLPF9boaVFbCoJ41bpwHm1Z7SD3AYBQXSqvA== ARC-Authentication-Results: i=1; mx1.white.stw.pengutronix.de; dkim=pass header.d=triops.cz header.s=f2019 header.b=RRyqJzmN; spf=none (mx1.white.stw.pengutronix.de: domain of oss-lists@triops.cz has no SPF policy when checking 81.2.195.189) smtp.mailfrom=oss-lists@triops.cz; dmarc=none Received: from lenoch ([91.218.190.200]) by cmgsmtp with ESMTPSA id SVyXx95r88HlqSVyZx7k5n; Sun, 15 Nov 2026 09:52:39 +0100 Date: Sun, 15 Nov 2026 09:52:37 +0100 From: Ladislav Michl To: Michael Olbrich Message-ID: References: <20261031203823.357406-1-oss-lists@triops.cz> <20261031203823.357406-8-oss-lists@triops.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CMAE-Envelope: MS4xfEAOf9p5PqmnXJH32glg2XEauewnuPrn4jNHmdafHroH6MEFtcVC7WUCYgfUirn0a1RGNXXd3VUPa9hUoHRbcFvrNRSD3GiyYVNnHkniNd37yU9ZFegE TX+lQ9KFLfV3u8HCYjE02/sfHkx7ha36l09Rp4n8H7IGejsdFzrQoUt9rNoHUf9PQb98ApRtgYHblLeNm4z2a4yHhDK+gf2NGU+LcPJ4TodJkiyFU6wv67Ux X-Spamd-Result: default: False [-2.60 / 15.00]; BAYES_HAM(-3.00)[100.00%]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[triops.cz:s=f2019]; ONCE_RECEIVED(0.20)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[triops.cz]; R_SPF_NA(0.00)[no SPF record]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[triops.cz:+]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM(-0.00)[-1.000]; ASN(0.00)[asn:24806, ipnet:81.2.192.0/18, country:CZ]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; ARC_SIGNED(0.00)[pengutronix.de:s=20260414:i=1] X-Rspamd-Action: no action X-Rspamd-Queue-Id: DD918205A02 X-Rspamd-Server: mx1 X-Stat-Signature: qxn5y9xf8dpmyimx1h9enm7356p6skix Subject: Re: [ptxdist] [PATCH v2 07/17] libselinux: version bump 2.1.12 -> 3.11 X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On Sat, Nov 14, 2026 at 04:55:56PM +0100, Michael Olbrich wrote: > On Sat, Oct 31, 2026 at 09:38:08PM +0100, Ladislav Michl wrote: > > From: Ladislav Michl > > > > Signed-off-by: Ladislav Michl > > --- > > CHANGES: > > - v2: build with setrans and rpm support, libselinux exports their > > symbols even when disabled, leading to undefined references > > (e.g. selinux_raw_context_to_color in secon). Select LIBC_DL. > > Make python wrapper depend on PYTHON3 instead of selecting it to > > avoid Kconfig recursive dependency (PYTHON3 -> LIBUUID -> > > UTIL_LINUX -> LIBSELINUX -> PYTHON3). > > This does not work. It fails at build-time because $(CROSS_PYTHON3) is not > available. And where is the "UTIL_LINUX -> LIBSELINUX" dependency with > these patches. I have yet another batch of patches optionally enabling selinux for all packages that supports it. I'll move libselinux python wrapper into a new package, python3-selinux. > > ...PyString_FromString-with-PyUnicode_F.patch | 48 ++++++++++++ > > patches/libselinux-3.11/series | 4 + > > rules/libselinux.in | 57 +++++++++++--- > > rules/libselinux.make | 76 +++++++++++++------ > > 4 files changed, 154 insertions(+), 31 deletions(-) > > create mode 100644 patches/libselinux-3.11/0001-libselinux-Replace-PyString_FromString-with-PyUnicode_F.patch > > create mode 100644 patches/libselinux-3.11/series > > > > diff --git a/patches/libselinux-3.11/0001-libselinux-Replace-PyString_FromString-with-PyUnicode_F.patch b/patches/libselinux-3.11/0001-libselinux-Replace-PyString_FromString-with-PyUnicode_F.patch > > new file mode 100644 > > index 000000000..015ede608 > > --- /dev/null > > +++ b/patches/libselinux-3.11/0001-libselinux-Replace-PyString_FromString-with-PyUnicode_F.patch > > @@ -0,0 +1,48 @@ > > +From: Petr Lautrbach > > +Date: Thu, 6 Aug 2026 16:30:44 +0200 > > +Subject: [PATCH] libselinux: Replace PyString_FromString with > > + PyUnicode_FromString for SWIG 4.5.0 compatibility > > + > > +SWIG 4.5.0 removed Python 2 C API compatibility macros (PyInt_*, > > +PyString_*, SWIG_Python_str_*) from its runtime header pyhead.swg. > > +These macros previously mapped deprecated Python 2 C API names to their > > +Python 3 equivalents. > > + > > +Fixes: https://github.com/SELinuxProject/selinux/issues/538 > > +Authored-by: Jitka Plesníková > > +Signed-off-by: Petr Lautrbach > > +Acked-by: Stephen Smalley > > +--- > > + src/selinuxswig_python.i | 6 +++--- > > + 1 file changed, 3 insertions(+), 3 deletions(-) > > + > > +diff --git a/src/selinuxswig_python.i b/src/selinuxswig_python.i > > +--- a/src/selinuxswig_python.i > > ++++ b/src/selinuxswig_python.i > > +@@ -69,7 +69,7 @@ > > + PyObject* list = PyList_New(*$2); > > + int i; > > + for (i = 0; i < *$2; i++) { > > +- PyList_SetItem(list, i, PyString_FromString((*$1)[i])); > > ++ PyList_SetItem(list, i, PyUnicode_FromString((*$1)[i])); > > + } > > + $result = SWIG_AppendOutput($result, list); > > + } > > +@@ -102,7 +102,7 @@ > > + len++; > > + plist = PyList_New(len); > > + for (i = 0; i < len; i++) { > > +- PyList_SetItem(plist, i, PyString_FromString((*$1)[i])); > > ++ PyList_SetItem(plist, i, PyUnicode_FromString((*$1)[i])); > > + } > > + } else { > > + plist = PyList_New(0); > > +@@ -119,7 +119,7 @@ > > + if (*$1) { > > + plist = PyList_New(result); > > + for (i = 0; i < result; i++) { > > +- PyList_SetItem(plist, i, PyString_FromString((*$1)[i])); > > ++ PyList_SetItem(plist, i, PyUnicode_FromString((*$1)[i])); > > + } > > + } else { > > + plist = PyList_New(0); > > diff --git a/patches/libselinux-3.11/series b/patches/libselinux-3.11/series > > new file mode 100644 > > index 000000000..9d79f21d8 > > --- /dev/null > > +++ b/patches/libselinux-3.11/series > > @@ -0,0 +1,4 @@ > > +# generated by git-ptx-patches > > +#tag:base --start-number 1 > > +0001-libselinux-Replace-PyString_FromString-with-PyUnicode_F.patch > > +# 9229b75b9f37589afb32a0e0c582e3b8 - git-ptx-patches magic > > diff --git a/rules/libselinux.in b/rules/libselinux.in > > index 6d6b1e655..0ff1358af 100644 > > --- a/rules/libselinux.in > > +++ b/rules/libselinux.in > > @@ -1,27 +1,66 @@ > > -## SECTION=staging > > -## old section: > > -### SECTION=selinux > > +## SECTION=selinux > > > > menuconfig LIBSELINUX > > tristate > > prompt "libselinux " > > - select LIBPCRE > > + select LIBC_DL > > + select PCRE2 > > + select PCRE2_8 > > select LIBSEPOL > > - select PYTHON if LIBSELINUX_PYTHON > > select HOST_SWIG if LIBSELINUX_PYTHON > > + select HOST_PYTHON3_PIP if LIBSELINUX_PYTHON > > help > > libselinux provides an API for SELinux applications to get and set > > process and file security contexts and to obtain security policy > > decisions. Required for any applications that use the SELinux > > API. > > > > - STAGING: remove in ptxdist-2020.12.0 > > - Old version that need to be updated. Fails to build with gcc >= 9.x. > > - > > if LIBSELINUX > > > > +config LIBSELINUX_UTILS > > + bool "install utilities" > > + > > +if LIBSELINUX_UTILS > > + > > +config LIBSELINUX_GETENFORCE > > + bool "getenforce" > > + depends on !BUSYBOX_GETENFORCE || ALLYES > > + > > +comment "busybox' getenforce is selected!" > > + depends on BUSYBOX_GETENFORCE > > + > > +config LIBSELINUX_GETSEBOOL > > + bool "getsebool" > > + depends on !BUSYBOX_GETSEBOOL || ALLYES > > + > > +comment "busybox' getsebool is selected!" > > + depends on BUSYBOX_GETSEBOOL > > + > > +config LIBSELINUX_MATCHPATHCON > > + bool "matchpathcon" > > + depends on !BUSYBOX_MATCHPATHCON || ALLYES > > + > > +comment "busybox' matchpathcon is selected!" > > + depends on BUSYBOX_MATCHPATHCON > > + > > +config LIBSELINUX_SELINUXENABLED > > + bool "selinuxenabled" > > + depends on !BUSYBOX_SELINUXENABLED || ALLYES > > + > > +comment "busybox' selinuxenabled is selected!" > > + depends on BUSYBOX_SELINUXENABLED > > + > > +config LIBSELINUX_SETENFORCE > > + bool "setenforce" > > + depends on !BUSYBOX_SETENFORCE || ALLYES > > + > > +comment "busybox' setenforce is selected!" > > + depends on BUSYBOX_SETENFORCE > > + > > +endif > > + > > config LIBSELINUX_PYTHON > > bool "python wrapper" > > - depends on STAGING > > + depends on PYTHON3 > > > > endif > > diff --git a/rules/libselinux.make b/rules/libselinux.make > > index 9f6b6a62f..b7bf42854 100644 > > --- a/rules/libselinux.make > > +++ b/rules/libselinux.make > > @@ -14,62 +14,94 @@ PACKAGES-$(PTXCONF_LIBSELINUX) += libselinux > > # > > # Paths and names > > # > > -LIBSELINUX_VERSION := 2.1.12 > > -LIBSELINUX_MD5 := 73270f384a032fad34b5fe075fa05ce2 > > +LIBSELINUX_VERSION := $(SELINUX_VERSION) > > +LIBSELINUX_SHA256 := 73d419c6e20e874adaa4019372cbd097eecf4d276e13f27ec5e67d35c0bd203c > > LIBSELINUX := libselinux-$(LIBSELINUX_VERSION) > > LIBSELINUX_SUFFIX := tar.gz > > -LIBSELINUX_URL := https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20120924/$(LIBSELINUX).$(LIBSELINUX_SUFFIX) > > +LIBSELINUX_URL := $(SELINUX_URL)/$(LIBSELINUX).$(LIBSELINUX_SUFFIX) > > LIBSELINUX_SOURCE := $(SRCDIR)/$(LIBSELINUX).$(LIBSELINUX_SUFFIX) > > LIBSELINUX_DIR := $(BUILDDIR)/$(LIBSELINUX) > > LIBSELINUX_LICENSE := public_domain > > +LIBSELINUX_LICENSE_FILES := file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0 > > +LIBSELINUX_CVE_PRODUCT := selinuxproject:libselinux > > > > # ---------------------------------------------------------------------------- > > # Prepare > > # ---------------------------------------------------------------------------- > > > > -LIBSELINUX_CONF_TOOL := NO > > -# no := due to CROSS_PYTHON > > -LIBSELINUX_MAKE_ENV = \ > > - $(CROSS_ENV) \ > > - CFLAGS="-O2 -Wall -g" \ > > - PYTHON=$(CROSS_PYTHON) > > -LIBSELINUX_MAKE_OPT := \ > > - LIBDIR=$(PTXDIST_SYSROOT_TARGET)/usr/lib > > -LIBSELINUX_INSTALL_OPT := \ > > +LIBSELINUX_CONF_TOOL := NO > > +LIBSELINUX_MAKE_ENV := $(CROSS_ENV) > > +LIBSELINUX_MAKE_OPT = \ > > + PREFIX=/usr \ > > + LIBDIR=/usr/lib \ > > + SHLIBDIR=/usr/lib \ > > + INCLUDEDIR=/usr/include \ > > + SBINDIR=/usr/sbin \ > > + USE_PCRE2=y \ > > + USE_LFS=y \ > > + DISABLE_SHARED=n \ > > + DISABLE_BOOL=n \ > > + DISABLE_SETRANS=n \ > > + DISABLE_RPM=n \ > > + DISABLE_X11=y \ > > + ANDROID_HOST=n \ > > + LABEL_BACKEND_ANDROID=n \ > > + CFLAGS="-O2 -Wall -g" > > + > > +ifdef PTXCONF_LIBSELINUX_PYTHON > > +LIBSELINUX_MAKE_OPT += \ > > + PYTHON=$(CROSS_PYTHON3) \ > > + PYTHONLIBDIR=$(PYTHON3_SITEPACKAGES) > > +endif > > + > > +LIBSELINUX_INSTALL_OPT = \ > > + $(LIBSELINUX_MAKE_OPT) \ > > install > > > > ifdef PTXCONF_LIBSELINUX_PYTHON > > -LIBSELINUX_MAKE_OPT += pywrap > > LIBSELINUX_INSTALL_OPT += install-pywrap > > endif > > > > +# ---------------------------------------------------------------------------- > > +# Compile > > +# ---------------------------------------------------------------------------- > > + > > +$(STATEDIR)/libselinux.compile: > > + @$(call targetinfo) > > + @$(call world/compile, LIBSELINUX) > > +ifdef PTXCONF_LIBSELINUX_PYTHON > > + @$(call compile, LIBSELINUX, $(LIBSELINUX_MAKE_OPT) pywrap) > > Why is it necessary to build pywrap separately? Please add a comment, wo we > know in the future what is needed to remove the special case. Upstream's all doesn't include the python wrapper. In libsemanage and libselinux src/Makefiles, 'all' builds only the library, the archive and the .pc file, therefore world/compile alone never builds the bindings. It is not strictly needed, install-pywrap depends on pywrap, so make install install-pywrap would build the wrapper during the install stage. For libsemanage, there is 'pywrap: all $(SWIGSO)' - a real target in its makefile. For libselinux pywrap is a phony target whose recipe always runs '$(PYTHON) -m build --no-isolation --wheel ..' So that cost a bit of time. For consistency reasons I'd keep it here, but I have no clue, how to nicely sum that in the comment :) > > +endif > > + @$(call touch) > > + > > # ---------------------------------------------------------------------------- > > # Target-Install > > # ---------------------------------------------------------------------------- > > > > -LIBSELINUX_PROGS := \ > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_UTILS) := \ > > avcstat \ > > compute_av \ > > compute_create \ > > compute_member \ > > compute_relabel \ > > - compute_user \ > > getconlist \ > > getdefaultcon \ > > - getenforce \ > > getfilecon \ > > getpidcon \ > > - getsebool \ > > getseuser \ > > - matchpathcon \ > > policyvers \ > > + sefcontext_compile \ > > selinux_check_securetty_context \ > > - selinuxenabled \ > > selinuxexeccon \ > > - setenforce \ > > setfilecon \ > > togglesebool > > > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_GETENFORCE) += getenforce > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_GETSEBOOL) += getsebool > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_MATCHPATHCON) += matchpathcon > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_SELINUXENABLED) += selinuxenabled > > +LIBSELINUX_PROGS-$(PTXCONF_LIBSELINUX_SETENFORCE) += setenforce > > + > > $(STATEDIR)/libselinux.targetinstall: > > @$(call targetinfo) > > > > @@ -81,11 +113,11 @@ $(STATEDIR)/libselinux.targetinstall: > > > > @$(call install_lib, libselinux, 0, 0, 0644, libselinux) > > > > - @$(foreach prog, $(LIBSELINUX_PROGS), \ > > + @$(foreach prog, $(LIBSELINUX_PROGS-y), \ > > $(call install_copy, libselinux, 0, 0, 0755, -, /usr/sbin/$(prog));) > > > + @$(foreach prog, $(LIBSELINUX_PROGS-y), \ > $(call install_copy, libselinux, 0, 0, 0755, -, /usr/sbin/$(prog))$(ptx/nl)) > > That way, all errors are propagated. Fixed. > > > > ifdef PTXCONF_LIBSELINUX_PYTHON > > - @$(call install_tree, libselinux, 0, 0, -, $(PYTHON_SITEPACKAGES)) > > + @$(call install_tree, libselinux, 0, 0, -, $(PYTHON3_SITEPACKAGES)) > > Use install_glob (to just install the .pyc files) like we do with all other > Python stuff, or add a comment why that is not possible. There are no .pyc files at all, the wheel holds only the .so files, and __init__.py is copied in afterwards, so no bytecode gets compiled. However something along @$(call install_glob, libselinux, 0, 0, -, $(PYTHON3_SITEPACKAGES),, *.py) would work. Btw, there's another bug anyway, the suffix is wrong because PYCEXT reads the host's value. I'll use: PYCEXT=$(shell $(CROSS_PYTHON3) -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))') I will prepare v3 with those changes and send it after some more testing. > Michael > > > endif > > @$(call install_finish, libselinux) > > > > -- > > 2.47.3 > > > > > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |