Skip to content

Commit

Permalink
gpkg/glibc: ldd fix for x86_64 and improvement mprotect.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Dec 17, 2023
1 parent 9506b01 commit 096e3b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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.38
TERMUX_PKG_REVISION=10
TERMUX_PKG_REVISION=11
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"
Expand All @@ -21,6 +21,7 @@ termux_step_pre_configure() {
done

rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/*/clone3.S
rm ${TERMUX_PKG_SRCDIR}/sysdeps/unix/sysv/linux/x86_64/configure*

for i in android_passwd_group.h android_passwd_group.c android_system_user_ids.h; do
cp ${TERMUX_PKG_BUILDER_DIR}/${i} ${TERMUX_PKG_SRCDIR}/nss/
Expand Down
5 changes: 5 additions & 0 deletions gpkg/glibc/mprotect.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ int __mprotect(void *addr, size_t len, int prot) {
if (res == -1 && errno == EACCES && prot & PROT_EXEC && __is_mmaped(addr) == 1) {
size_t saddr = strlen(addr)+1;
void *caddr;
//int mmap_flags = MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED;
//if (prot & PROT_GROWSDOWN)
// mmap_flags |= MAP_GROWSDOWN;
if (saddr > 1) {
caddr = malloc(saddr);
memcpy(caddr, addr, saddr);
Expand All @@ -97,6 +100,8 @@ int __mprotect(void *addr, size_t len, int prot) {
memcpy(addr, caddr, saddr);
free(caddr);
}
if (prot & PROT_GROWSDOWN)
prot &= ~PROT_GROWSDOWN;
return INLINE_SYSCALL_CALL(mprotect, addr, len, prot);
}
#endif
Expand Down

0 comments on commit 096e3b9

Please sign in to comment.