Skip to content

Commit

Permalink
gpkg/glibc: disable syscall __NR_pidfd_send_signal and `__NR_close_…
Browse files Browse the repository at this point in the history
…range` (#119)

build.yml: switching from image package-builder ro package-builder-cgct
  • Loading branch information
Maxython authored Oct 7, 2023
1 parent 3297273 commit ce8fd4c
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 46 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
# Useful for pull requests submitting changes for both build environment and packages.
if grep -qP '^scripts/(Dockerfile|properties\.sh|setup-android-sdk\.sh|setup-cgct\.sh|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then
echo "Detected changes for environment setup scripts. Building custom Docker image now."
docker build -t ghcr.io/termux/package-builder:latest .
docker build -t ghcr.io/termux/package-builder-cgct:latest .
fi
for repo_path in $(jq --raw-output 'del(.pkg_format) | keys | .[]' repo.json); do
Expand Down Expand Up @@ -150,16 +150,16 @@ jobs:
fi
done
- name: Free additional disk space (if necessary)
run: |
if grep -q '^clvk$\|^dart$\|^rust$\|^rustc-nightly$' ./built_termux-main_packages.txt || \
grep -q '^firefox$' ./built_termux-x11_packages.txt; then
echo "Free additional disk space on host"
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php|aspnetcore)') \
mono-runtime-common monodoc-manual ruby
sudo apt autoremove -yq
sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
fi
#- name: Free additional disk space (if necessary)
# run: |
# if grep -q '^clvk$\|^dart$\|^rust$\|^rustc-nightly$' ./built_gpkg_packages.txt || \
# grep -q '^firefox$' ./built_termux-x11_packages.txt; then
# echo "Free additional disk space on host"
# sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(cabal-|dotnet-|ghc-|libmono|php|aspnetcore)') \
# mono-runtime-common monodoc-manual ruby
# sudo apt autoremove -yq
# sudo rm -rf /opt/hostedtoolcache /usr/local /usr/share/dotnet /usr/share/swift
# fi

- name: Lint packages
run: |
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
done
if [ ! -z "$packages" ]; then
./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} --format pacman --library glibc $packages
TERMUX_BUILDER_IMAGE_NAME="ghcr.io/termux/package-builder-cgct" ./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} --format pacman --library glibc $packages
fi
- name: Generate build artifacts
Expand Down
24 changes: 17 additions & 7 deletions gpkg/glibc/aarch64-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h.patch 2023-09-09 00:41:22.799180926 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h.patch 2023-10-07 00:00:59.225088205 +0300
@@ -1,5 +1,4 @@
/* AUTOGENERATED by update-syscall-lists.py. */
-#define __NR_accept 202
#define __NR_accept4 242
#define __NR_acct 89
#define __NR_add_key 217
@@ -17,7 +16,6 @@
@@ -17,9 +16,7 @@
#define __NR_clock_nanosleep 115
#define __NR_clock_settime 112
#define __NR_clone 220
-#define __NR_clone3 435
#define __NR_close 57
#define __NR_close_range 436
-#define __NR_close_range 436
#define __NR_connect 203
@@ -35,7 +33,6 @@
#define __NR_copy_file_range 285
#define __NR_delete_module 106
@@ -35,7 +32,6 @@
#define __NR_exit 93
#define __NR_exit_group 94
#define __NR_faccessat 48
-#define __NR_faccessat2 439
#define __NR_fadvise64 223
#define __NR_fallocate 47
#define __NR_fanotify_init 262
@@ -205,7 +202,6 @@
@@ -168,7 +164,6 @@
#define __NR_personality 92
#define __NR_pidfd_getfd 438
#define __NR_pidfd_open 434
-#define __NR_pidfd_send_signal 424
#define __NR_pipe2 59
#define __NR_pivot_root 41
#define __NR_pkey_alloc 289
@@ -205,7 +200,6 @@
#define __NR_renameat2 276
#define __NR_request_key 218
#define __NR_restart_syscall 128
-#define __NR_rseq 293
#define __NR_rt_sigaction 134
#define __NR_rt_sigpending 136
#define __NR_rt_sigprocmask 135
@@ -237,11 +233,8 @@
@@ -237,11 +231,8 @@
#define __NR_sendto 206
#define __NR_set_mempolicy 237
#define __NR_set_mempolicy_home_node 450
Expand All @@ -42,7 +52,7 @@
#define __NR_setgid 144
#define __NR_setgroups 159
#define __NR_sethostname 161
@@ -270,7 +263,6 @@
@@ -270,7 +261,6 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs 43
Expand Down
30 changes: 20 additions & 10 deletions gpkg/glibc/arm-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/arm/arch-syscall.h 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/arm/arch-syscall.h.patch 2023-09-09 00:41:03.659180934 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/arm/arch-syscall.h.patch 2023-10-07 00:01:12.685088200 +0300
@@ -2,7 +2,6 @@
#define __NR__llseek 140
#define __NR__newselect 142
Expand All @@ -16,7 +16,7 @@
#define __NR_chown 182
#define __NR_chown32 212
#define __NR_chroot 61
@@ -27,13 +25,11 @@
@@ -27,15 +25,12 @@
#define __NR_clock_getres 264
#define __NR_clock_getres_time64 406
#define __NR_clock_gettime 263
Expand All @@ -28,33 +28,43 @@
#define __NR_clone 120
-#define __NR_clone3 435
#define __NR_close 6
#define __NR_close_range 436
-#define __NR_close_range 436
#define __NR_connect 283
@@ -56,7 +52,6 @@
#define __NR_copy_file_range 391
#define __NR_creat 8
@@ -56,7 +51,6 @@
#define __NR_exit 1
#define __NR_exit_group 248
#define __NR_faccessat 334
-#define __NR_faccessat2 439
#define __NR_fallocate 352
#define __NR_fanotify_init 367
#define __NR_fanotify_mark 368
@@ -109,7 +104,6 @@
@@ -109,7 +103,6 @@
#define __NR_getitimer 105
#define __NR_getpeername 287
#define __NR_getpgid 132
-#define __NR_getpgrp 65
#define __NR_getpid 20
#define __NR_getppid 64
#define __NR_getpriority 96
@@ -253,7 +247,6 @@
@@ -220,7 +213,6 @@
#define __NR_personality 136
#define __NR_pidfd_getfd 438
#define __NR_pidfd_open 434
-#define __NR_pidfd_send_signal 424
#define __NR_pipe 42
#define __NR_pipe2 359
#define __NR_pivot_root 218
@@ -253,7 +245,6 @@
#define __NR_readlinkat 332
#define __NR_readv 145
#define __NR_reboot 88
-#define __NR_recv 291
#define __NR_recvfrom 292
#define __NR_recvmmsg 365
#define __NR_recvmmsg_time64 417
@@ -265,8 +258,6 @@
@@ -265,8 +256,6 @@
#define __NR_renameat2 382
#define __NR_request_key 310
#define __NR_restart_syscall 0
Expand All @@ -63,15 +73,15 @@
#define __NR_rt_sigaction 174
#define __NR_rt_sigpending 176
#define __NR_rt_sigprocmask 175
@@ -295,7 +286,6 @@
@@ -295,7 +284,6 @@
#define __NR_semop 298
#define __NR_semtimedop 312
#define __NR_semtimedop_time64 420
-#define __NR_send 289
#define __NR_sendfile 187
#define __NR_sendfile64 239
#define __NR_sendmmsg 374
@@ -303,14 +293,9 @@
@@ -303,14 +291,9 @@
#define __NR_sendto 290
#define __NR_set_mempolicy 321
#define __NR_set_mempolicy_home_node 450
Expand All @@ -86,7 +96,7 @@
#define __NR_setgid 46
#define __NR_setgid32 214
#define __NR_setgroups 81
@@ -355,7 +340,6 @@
@@ -355,7 +338,6 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 266
Expand Down
3 changes: 2 additions & 1 deletion gpkg/glibc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ TERMUX_PKG_DESCRIPTION="GNU C Library"
TERMUX_PKG_LICENSE="GPL-3.0, LGPL-3.0"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=2.38
TERMUX_PKG_REVISION=3
TERMUX_PKG_REVISION=4
TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/libc/glibc-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=fb82998998b2b29965467bc1b69d152e9c307d2cf301c9eafb4555b770ef3fd2
TERMUX_PKG_DEPENDS="linux-api-headers-glibc"
TERMUX_PKG_RECOMMENDS="glibc-runner"
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_CONFFILES="glibc/etc/gai.conf, glibc/etc/locale.gen"

termux_step_pre_configure() {
if [ "$TERMUX_PACKAGE_LIBRARY" != "glibc" ]; then
Expand Down
26 changes: 18 additions & 8 deletions gpkg/glibc/i386-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/i386/arch-syscall.h 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/i386/arch-syscall.h.patch 2023-09-09 00:41:39.579180920 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/i386/arch-syscall.h.patch 2023-10-07 00:01:30.315088193 +0300
@@ -18,7 +18,6 @@
#define __NR_capget 184
#define __NR_capset 185
Expand All @@ -8,7 +8,7 @@
#define __NR_chown 182
#define __NR_chown32 212
#define __NR_chroot 61
@@ -27,13 +26,11 @@
@@ -27,15 +26,12 @@
#define __NR_clock_getres 266
#define __NR_clock_getres_time64 406
#define __NR_clock_gettime 265
Expand All @@ -20,25 +20,35 @@
#define __NR_clone 120
-#define __NR_clone3 435
#define __NR_close 6
#define __NR_close_range 436
-#define __NR_close_range 436
#define __NR_connect 362
@@ -57,7 +54,6 @@
#define __NR_copy_file_range 377
#define __NR_creat 8
@@ -57,7 +53,6 @@
#define __NR_exit 1
#define __NR_exit_group 252
#define __NR_faccessat 307
-#define __NR_faccessat2 439
#define __NR_fadvise64 250
#define __NR_fadvise64_64 272
#define __NR_fallocate 324
@@ -115,7 +111,6 @@
@@ -115,7 +110,6 @@
#define __NR_getitimer 105
#define __NR_getpeername 368
#define __NR_getpgid 132
-#define __NR_getpgrp 65
#define __NR_getpid 20
#define __NR_getpmsg 188
#define __NR_getppid 64
@@ -288,8 +283,6 @@
@@ -239,7 +233,6 @@
#define __NR_personality 136
#define __NR_pidfd_getfd 438
#define __NR_pidfd_open 434
-#define __NR_pidfd_send_signal 424
#define __NR_pipe 42
#define __NR_pipe2 331
#define __NR_pivot_root 217
@@ -288,8 +281,6 @@
#define __NR_renameat2 353
#define __NR_request_key 287
#define __NR_restart_syscall 0
Expand All @@ -47,7 +57,7 @@
#define __NR_rt_sigaction 174
#define __NR_rt_sigpending 176
#define __NR_rt_sigprocmask 175
@@ -324,14 +317,9 @@
@@ -324,14 +315,9 @@
#define __NR_sendto 369
#define __NR_set_mempolicy 276
#define __NR_set_mempolicy_home_node 450
Expand All @@ -62,7 +72,7 @@
#define __NR_setgid 46
#define __NR_setgid32 214
#define __NR_setgroups 81
@@ -380,7 +368,6 @@
@@ -380,7 +366,6 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 268
Expand Down
15 changes: 15 additions & 0 deletions gpkg/glibc/pidfd.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- src/sysdeps/unix/sysv/linux/sys/pidfd.h 2023-07-31 20:54:16.000000000 +0300
+++ src/sysdeps/unix/sysv/linux/sys/pidfd.h.patch 2023-10-06 17:40:14.819331237 +0300
@@ -38,12 +38,4 @@
extern int pidfd_getfd (int __pidfd, int __targetfd,
unsigned int __flags) __THROW;

-/* Sends the signal SIG to the target process referred by the PIDFD. If
- INFO points to a siginfo_t buffer, it will be populated.
-
- The FLAGS argument is reserved for future use, it must be specified
- as 0. */
-extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info,
- unsigned int __flags) __THROW;
-
#endif /* _PIDFD_H */
11 changes: 11 additions & 0 deletions gpkg/glibc/spawni.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/spawni.c 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/spawni.c.patch 2023-10-07 00:31:27.595087508 +0300
@@ -264,7 +264,7 @@
case spawn_do_closefrom:
{
int lowfd = action->action.closefrom_action.from;
- int r = INLINE_SYSCALL_CALL (close_range, lowfd, ~0U, 0);
+ int r = close_range (lowfd, ~0U, 0);
if (r != 0 && !__closefrom_fallback (lowfd, false))
goto fail;
} break;
26 changes: 18 additions & 8 deletions gpkg/glibc/x86_64-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h.patch 2023-09-09 00:42:10.549180908 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h.patch 2023-10-07 00:01:45.715088187 +0300
@@ -1,6 +1,5 @@
/* AUTOGENERATED by update-syscall-lists.py. */
#define __NR__sysctl 156
Expand All @@ -15,31 +15,41 @@
#define __NR_chown 92
#define __NR_chroot 161
#define __NR_clock_adjtime 305
@@ -24,7 +22,6 @@
@@ -24,9 +22,7 @@
#define __NR_clock_nanosleep 230
#define __NR_clock_settime 227
#define __NR_clone 56
-#define __NR_clone3 435
#define __NR_close 3
#define __NR_close_range 436
-#define __NR_close_range 436
#define __NR_connect 42
@@ -50,7 +47,6 @@
#define __NR_copy_file_range 326
#define __NR_creat 85
@@ -50,7 +46,6 @@
#define __NR_exit 60
#define __NR_exit_group 231
#define __NR_faccessat 269
-#define __NR_faccessat2 439
#define __NR_fadvise64 221
#define __NR_fallocate 285
#define __NR_fanotify_init 300
@@ -95,7 +91,6 @@
@@ -95,7 +90,6 @@
#define __NR_getitimer 36
#define __NR_getpeername 52
#define __NR_getpgid 121
-#define __NR_getpgrp 111
#define __NR_getpid 39
#define __NR_getpmsg 181
#define __NR_getppid 110
@@ -244,8 +239,6 @@
@@ -201,7 +195,6 @@
#define __NR_personality 135
#define __NR_pidfd_getfd 438
#define __NR_pidfd_open 434
-#define __NR_pidfd_send_signal 424
#define __NR_pipe 22
#define __NR_pipe2 293
#define __NR_pivot_root 155
@@ -244,8 +237,6 @@
#define __NR_renameat2 316
#define __NR_request_key 249
#define __NR_restart_syscall 219
Expand All @@ -48,7 +58,7 @@
#define __NR_rt_sigaction 13
#define __NR_rt_sigpending 127
#define __NR_rt_sigprocmask 14
@@ -279,12 +272,9 @@
@@ -279,12 +270,9 @@
#define __NR_sendto 44
#define __NR_set_mempolicy 238
#define __NR_set_mempolicy_home_node 450
Expand All @@ -61,7 +71,7 @@
#define __NR_setgid 106
#define __NR_setgroups 116
#define __NR_sethostname 170
@@ -315,7 +305,6 @@
@@ -315,7 +303,6 @@
#define __NR_splice 275
#define __NR_stat 4
#define __NR_statfs 137
Expand Down

0 comments on commit ce8fd4c

Please sign in to comment.