Skip to content

Commit

Permalink
glibc fixes
Browse files Browse the repository at this point in the history
- adding `__shmctl64`
- disabling the `epoll_pwait2` system call
  • Loading branch information
Maxython authored Apr 10, 2024
1 parent f4acfed commit f7734d1
Show file tree
Hide file tree
Showing 15 changed files with 418 additions and 660 deletions.
27 changes: 17 additions & 10 deletions gpkg/glibc/aarch64-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.39/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h 2024-01-31 03:34:58.000000000 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h.patch 2024-02-26 11:19:01.235488233 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h.patch 2024-04-10 00:15:19.800138807 +0300
@@ -1,5 +1,4 @@
/* AUTOGENERATED by update-syscall-lists.py. */
-#define __NR_accept 202
Expand All @@ -16,55 +16,62 @@
#define __NR_connect 203
#define __NR_copy_file_range 285
#define __NR_delete_module 106
@@ -36,7 +33,6 @@
@@ -29,14 +26,12 @@
#define __NR_epoll_create1 20
#define __NR_epoll_ctl 21
#define __NR_epoll_pwait 22
-#define __NR_epoll_pwait2 441
#define __NR_eventfd2 19
#define __NR_execve 221
#define __NR_execveat 281
#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
@@ -44,7 +40,6 @@
@@ -44,7 +39,6 @@
#define __NR_fchdir 50
#define __NR_fchmod 52
#define __NR_fchmodat 53
-#define __NR_fchmodat2 452
#define __NR_fchown 55
#define __NR_fchownat 54
#define __NR_fcntl 25
@@ -66,7 +61,6 @@
@@ -66,7 +60,6 @@
#define __NR_futex 98
#define __NR_futex_requeue 456
#define __NR_futex_wait 455
-#define __NR_futex_waitv 449
#define __NR_futex_wake 454
#define __NR_get_mempolicy 236
#define __NR_get_robust_list 100
@@ -117,7 +111,6 @@
@@ -117,7 +110,6 @@
#define __NR_keyctl 219
#define __NR_kill 129
#define __NR_landlock_add_rule 445
-#define __NR_landlock_create_ruleset 444
#define __NR_landlock_restrict_self 446
#define __NR_lgetxattr 9
#define __NR_linkat 37
@@ -174,7 +167,6 @@
@@ -174,7 +166,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
@@ -211,7 +203,6 @@
@@ -211,7 +202,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
@@ -243,12 +234,8 @@
@@ -243,12 +233,8 @@
#define __NR_sendto 206
#define __NR_set_mempolicy 237
#define __NR_set_mempolicy_home_node 450
Expand All @@ -77,7 +84,7 @@
#define __NR_setgroups 159
#define __NR_sethostname 161
#define __NR_setitimer 103
@@ -256,14 +243,12 @@
@@ -256,14 +242,12 @@
#define __NR_setpgid 154
#define __NR_setpriority 140
#define __NR_setregid 143
Expand All @@ -92,7 +99,7 @@
#define __NR_setxattr 5
#define __NR_shmat 196
#define __NR_shmctl 195
@@ -276,7 +261,6 @@
@@ -276,7 +260,6 @@
#define __NR_socketpair 199
#define __NR_splice 76
#define __NR_statfs 43
Expand Down
34 changes: 21 additions & 13 deletions gpkg/glibc/arm-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.39/sysdeps/unix/sysv/linux/arm/arch-syscall.h 2024-01-31 03:34:58.000000000 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/arm/arch-syscall.h.patch 2024-02-26 11:20:30.485488199 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/arm/arch-syscall.h.patch 2024-04-10 00:15:27.480138805 +0300
@@ -2,7 +2,6 @@
#define __NR__llseek 140
#define __NR__newselect 142
Expand Down Expand Up @@ -33,7 +33,15 @@
#define __NR_connect 283
#define __NR_copy_file_range 391
#define __NR_creat 8
@@ -57,14 +50,12 @@
@@ -48,7 +41,6 @@
#define __NR_epoll_create1 357
#define __NR_epoll_ctl 251
#define __NR_epoll_pwait 346
-#define __NR_epoll_pwait2 441
#define __NR_epoll_wait 252
#define __NR_eventfd 351
#define __NR_eventfd2 356
@@ -57,14 +49,12 @@
#define __NR_exit 1
#define __NR_exit_group 248
#define __NR_faccessat 334
Expand All @@ -48,47 +56,47 @@
#define __NR_fchown 95
#define __NR_fchown32 207
#define __NR_fchownat 325
@@ -94,7 +85,6 @@
@@ -94,7 +84,6 @@
#define __NR_futex_requeue 456
#define __NR_futex_time64 422
#define __NR_futex_wait 455
-#define __NR_futex_waitv 449
#define __NR_futex_wake 454
#define __NR_futimesat 326
#define __NR_get_mempolicy 320
@@ -114,7 +104,6 @@
@@ -114,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
@@ -156,7 +145,6 @@
@@ -156,7 +144,6 @@
#define __NR_keyctl 311
#define __NR_kill 37
#define __NR_landlock_add_rule 445
-#define __NR_landlock_create_ruleset 444
#define __NR_landlock_restrict_self 446
#define __NR_lchown 16
#define __NR_lchown32 198
@@ -226,7 +214,6 @@
@@ -226,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
@@ -259,7 +246,6 @@
@@ -259,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
@@ -271,8 +257,6 @@
@@ -271,8 +256,6 @@
#define __NR_renameat2 382
#define __NR_request_key 310
#define __NR_restart_syscall 0
Expand All @@ -97,15 +105,15 @@
#define __NR_rt_sigaction 174
#define __NR_rt_sigpending 176
#define __NR_rt_sigprocmask 175
@@ -301,7 +285,6 @@
@@ -301,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
@@ -309,16 +292,9 @@
@@ -309,16 +291,9 @@
#define __NR_sendto 290
#define __NR_set_mempolicy 321
#define __NR_set_mempolicy_home_node 450
Expand All @@ -122,7 +130,7 @@
#define __NR_setgroups 81
#define __NR_setgroups32 206
#define __NR_sethostname 74
@@ -328,8 +304,6 @@
@@ -328,8 +303,6 @@
#define __NR_setpriority 97
#define __NR_setregid 71
#define __NR_setregid32 204
Expand All @@ -131,7 +139,7 @@
#define __NR_setresuid 164
#define __NR_setresuid32 208
#define __NR_setreuid 70
@@ -338,8 +312,6 @@
@@ -338,8 +311,6 @@
#define __NR_setsid 66
#define __NR_setsockopt 294
#define __NR_settimeofday 79
Expand All @@ -140,7 +148,7 @@
#define __NR_setxattr 226
#define __NR_shmat 305
#define __NR_shmctl 308
@@ -361,10 +333,8 @@
@@ -361,10 +332,8 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 266
Expand Down
4 changes: 2 additions & 2 deletions gpkg/glibc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="GNU C Library"
TERMUX_PKG_LICENSE="GPL-3.0, LGPL-3.0"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=2.39
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/libc/glibc-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=f77bd47cf8170c57365ae7bf86696c118adb3b120d3259c64c502d3dc1e2d926
TERMUX_PKG_DEPENDS="linux-api-headers-glibc"
Expand All @@ -16,7 +16,7 @@ termux_step_pre_configure() {
termux_error_exit "Compilation is only possible based on glibc"
fi

for i in shmem-android.h mprotect.c ignore-syscall.h; do
for i in shmem-android.h shmat.c shmctl.c shmdt.c shmget.c mprotect.c ignore-syscall.h; do
install -Dm644 "${TERMUX_PKG_BUILDER_DIR}/${i}" "${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/${i}"
done

Expand Down
32 changes: 32 additions & 0 deletions gpkg/glibc/epoll_pwait2.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- glibc-2.39/sysdeps/unix/sysv/linux/epoll_pwait2.c 2024-01-31 03:34:58.000000000 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/epoll_pwait2.c.patch 2024-04-10 22:25:45.538639010 +0300
@@ -16,15 +16,26 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */

+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
#include <sys/epoll.h>
-#include <sysdep.h>
+#include <sysdep-cancel.h>
+
+#define MSEC_PER_SEC 1000L
+#define NSEC_PER_MSEC 1000000L

int
__epoll_pwait2_time64 (int fd, struct epoll_event *ev, int maxev,
const struct __timespec64 *tmo, const sigset_t *s)
{
- /* The syscall only supports 64-bit time_t. */
- return SYSCALL_CANCEL (epoll_pwait2, fd, ev, maxev, tmo, s, __NSIG_BYTES);
+ long timeout = tmo->tv_sec * MSEC_PER_SEC;
+ if (tmo->tv_nsec > 0) {
+ timeout += tmo->tv_nsec / NSEC_PER_MSEC;
+ if (tmo->tv_nsec % NSEC_PER_MSEC > 0)
+ timeout += 1;
+ }
+ return epoll_pwait (fd, ev, maxev, timeout, s);
}
#if __TIMESIZE != 64
libc_hidden_def (__epoll_pwait2_time64)
32 changes: 20 additions & 12 deletions gpkg/glibc/i386-arch-syscall.h.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- glibc-2.39/sysdeps/unix/sysv/linux/i386/arch-syscall.h 2024-01-31 03:34:58.000000000 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/i386/arch-syscall.h.patch 2024-02-26 11:20:38.725488196 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/i386/arch-syscall.h.patch 2024-04-10 00:15:37.600138801 +0300
@@ -19,24 +19,18 @@
#define __NR_capget 184
#define __NR_capset 185
Expand All @@ -25,55 +25,63 @@
#define __NR_connect 362
#define __NR_copy_file_range 377
#define __NR_creat 8
@@ -58,7 +52,6 @@
@@ -49,7 +43,6 @@
#define __NR_epoll_create1 329
#define __NR_epoll_ctl 255
#define __NR_epoll_pwait 319
-#define __NR_epoll_pwait2 441
#define __NR_epoll_wait 256
#define __NR_eventfd 323
#define __NR_eventfd2 328
@@ -58,7 +51,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
@@ -67,7 +60,6 @@
@@ -67,7 +59,6 @@
#define __NR_fchdir 133
#define __NR_fchmod 94
#define __NR_fchmodat 306
-#define __NR_fchmodat2 452
#define __NR_fchown 95
#define __NR_fchown32 207
#define __NR_fchownat 298
@@ -98,7 +90,6 @@
@@ -98,7 +89,6 @@
#define __NR_futex_requeue 456
#define __NR_futex_time64 422
#define __NR_futex_wait 455
-#define __NR_futex_waitv 449
#define __NR_futex_wake 454
#define __NR_futimesat 299
#define __NR_get_kernel_syms 130
@@ -120,7 +111,6 @@
@@ -120,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
@@ -168,7 +158,6 @@
@@ -168,7 +157,6 @@
#define __NR_keyctl 288
#define __NR_kill 37
#define __NR_landlock_add_rule 445
-#define __NR_landlock_create_ruleset 444
#define __NR_landlock_restrict_self 446
#define __NR_lchown 16
#define __NR_lchown32 198
@@ -245,7 +234,6 @@
@@ -245,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
@@ -294,8 +282,6 @@
@@ -294,8 +281,6 @@
#define __NR_renameat2 353
#define __NR_request_key 287
#define __NR_restart_syscall 0
Expand All @@ -82,7 +90,7 @@
#define __NR_rt_sigaction 174
#define __NR_rt_sigpending 176
#define __NR_rt_sigprocmask 175
@@ -330,16 +316,9 @@
@@ -330,16 +315,9 @@
#define __NR_sendto 369
#define __NR_set_mempolicy 276
#define __NR_set_mempolicy_home_node 450
Expand All @@ -99,7 +107,7 @@
#define __NR_setgroups 81
#define __NR_setgroups32 206
#define __NR_sethostname 74
@@ -349,8 +328,6 @@
@@ -349,8 +327,6 @@
#define __NR_setpriority 97
#define __NR_setregid 71
#define __NR_setregid32 204
Expand All @@ -108,7 +116,7 @@
#define __NR_setresuid 164
#define __NR_setresuid32 208
#define __NR_setreuid 70
@@ -359,8 +336,6 @@
@@ -359,8 +335,6 @@
#define __NR_setsid 66
#define __NR_setsockopt 366
#define __NR_settimeofday 79
Expand All @@ -117,7 +125,7 @@
#define __NR_setxattr 226
#define __NR_sgetmask 68
#define __NR_shmat 397
@@ -386,12 +361,10 @@
@@ -386,12 +360,10 @@
#define __NR_stat64 195
#define __NR_statfs 99
#define __NR_statfs64 268
Expand Down
2 changes: 1 addition & 1 deletion gpkg/glibc/locale-gen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!@TERMUX_PREFIX_CLASSICAL@/bin/sh
#!@TERMUX_PREFIX@/bin/sh

set -e

Expand Down
Loading

0 comments on commit f7734d1

Please sign in to comment.