-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add policycoreutils for building squashfs with SELinux
Only install setfiles, add libselinux as a dependency Also unify the version for all SELinux userspace components Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
- Loading branch information
Showing
11 changed files
with
144 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
diff --git a/src/Makefile b/src/Makefile | ||
index 41cfbdca..f82ec529 100644 | ||
--- a/src/Makefile | ||
+++ b/src/Makefile | ||
@@ -188,12 +188,12 @@ install: all | ||
install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR) | ||
test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig | ||
install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig | ||
- ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) | ||
+ ln -sf $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) | ||
|
||
install-pywrap: pywrap | ||
CFLAGS="$(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) . | ||
install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py | ||
- ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) | ||
+ ln -sf $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) | ||
|
||
install-rubywrap: rubywrap | ||
test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Patch from https://bugs.gentoo.org/905711#c10 to build with musl | ||
|
||
diff --git a/src/selinux_restorecon.c b/src/selinux_restorecon.c | ||
index bc6ed935..3bc0d8dd 100644 | ||
--- a/src/selinux_restorecon.c | ||
+++ b/src/selinux_restorecon.c | ||
@@ -438,7 +438,7 @@ static int filespec_add(ino_t ino, const char *con, const char *file, | ||
file_spec_t *prevfl, *fl; | ||
uint32_t h; | ||
int ret; | ||
- struct stat64 sb; | ||
+ struct stat sb; | ||
|
||
__pthread_mutex_lock(&fl_mutex); | ||
|
||
@@ -452,7 +452,7 @@ static int filespec_add(ino_t ino, const char *con, const char *file, | ||
for (prevfl = &fl_head[h], fl = fl_head[h].next; fl; | ||
prevfl = fl, fl = fl->next) { | ||
if (ino == fl->ino) { | ||
- ret = lstat64(fl->file, &sb); | ||
+ ret = lstat(fl->file, &sb); | ||
if (ret < 0 || sb.st_ino != ino) { | ||
freecon(fl->con); | ||
free(fl->file); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/utils/selabel_digest.c b/utils/selabel_digest.c | ||
index 47aad21f..c574d3fd 100644 | ||
--- a/utils/selabel_digest.c | ||
+++ b/utils/selabel_digest.c | ||
@@ -65,7 +65,7 @@ int main(int argc, char **argv) | ||
size_t digest_len, i, num_specfiles; | ||
|
||
char cmd_buf[4096]; | ||
- char *cmd_ptr; | ||
+ char *cmd_ptr = NULL; | ||
char *sha1_buf = NULL; | ||
|
||
struct selabel_handle *hnd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: libselinux | ||
dependencies: | ||
- stage: base | ||
- stage: patch | ||
- stage: musl-fts | ||
- stage: libsepol | ||
- stage: pcre | ||
- stage: pkg-config | ||
steps: | ||
- sources: | ||
- url: https://github.com/SELinuxProject/selinux/releases/download/{{ .selinux_version }}/libselinux-{{ .selinux_version }}.tar.gz | ||
destination: libselinux.tar.gz | ||
sha256: "{{ .libselinux_sha256 }}" | ||
sha512: "{{ .libselinux_sha512 }}" | ||
prepare: | ||
- | | ||
tar -xzf libselinux.tar.gz --strip-components=1 | ||
patch -p1 < /pkg/patches/musl-lstat.patch | ||
patch -p1 < /pkg/patches/selabel-digest-uninit.patch | ||
patch -p1 < /pkg/patches/busybox-ln.patch | ||
build: | ||
- | | ||
make -j $(nproc) FTS_LDLIBS="-l:libfts.a" | ||
install: | ||
- | | ||
make install DESTDIR=/rootfs PREFIX=/toolchain | ||
finalize: | ||
- from: /rootfs | ||
to: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/setfiles/Makefile b/setfiles/Makefile | ||
index 84ffb08b..31bc07db 100644 | ||
--- a/setfiles/Makefile | ||
+++ b/setfiles/Makefile | ||
@@ -5,8 +5,11 @@ SBINDIR ?= /sbin | ||
MANDIR = $(PREFIX)/share/man | ||
AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) | ||
|
||
-CFLAGS ?= -g -Werror -Wall -W | ||
-override LDLIBS += -lselinux -lsepol -lpthread | ||
+# override with -lfts when building on Musl libc to use fts-standalone | ||
+FTS_LDLIBS ?= | ||
+ | ||
+CFLAGS ?= -g -Werror -Wall -W $(FTS_LDLIBS) | ||
+override LDLIBS += -lselinux -lsepol -lpthread $(FTS_LDLIBS) | ||
|
||
ifeq ($(AUDITH), y) | ||
override CFLAGS += -DUSE_AUDIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: policycoreutils | ||
dependencies: | ||
- stage: base | ||
- stage: patch | ||
- stage: musl-fts | ||
- stage: pcre | ||
- stage: libsepol | ||
- stage: libselinux | ||
steps: | ||
- sources: | ||
- url: https://github.com/SELinuxProject/selinux/releases/download/{{ .selinux_version }}/policycoreutils-{{ .selinux_version }}.tar.gz | ||
destination: policycoreutils.tar.gz | ||
sha256: "{{ .policycoreutils_sha256 }}" | ||
sha512: "{{ .policycoreutils_sha512 }}" | ||
prepare: | ||
- | | ||
tar -xzf policycoreutils.tar.gz --strip-components=1 | ||
patch -p1 < /pkg/patches/musl-fts.patch | ||
build: | ||
- | | ||
make -j $(nproc) SUBDIRS=setfiles FTS_LDLIBS="-l:libfts.a -lpcre2-8" | ||
install: | ||
- | | ||
make install DESTDIR=/rootfs/toolchain SUBDIRS=setfiles | ||
finalize: | ||
- from: /rootfs | ||
to: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters