-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ldd fix for x86_64 fix mprotect.c ignore system call 1008 and mbind
- Loading branch information
Showing
11 changed files
with
124 additions
and
69 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
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,14 @@ | ||
--- src/sysdeps/unix/sysv/linux/dl-execstack.c 2023-07-31 20:54:16.000000000 +0300 | ||
+++ src/sysdeps/unix/sysv/linux/dl-execstack.c.patch 2023-12-25 10:12:20.634704179 +0300 | ||
@@ -35,9 +35,10 @@ | ||
/* This gives us the highest/lowest page that needs to be changed. */ | ||
uintptr_t page = ((uintptr_t) *stack_endp | ||
& -(intptr_t) GLRO(dl_pagesize)); | ||
+ void *addr = mmap((void*)page, GLRO(dl_pagesize), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); | ||
int result = 0; | ||
|
||
- if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize), | ||
+ if (__builtin_expect (__mprotect (addr, GLRO(dl_pagesize), | ||
__stack_prot) == 0, 1)) | ||
goto return_success; | ||
result = errno; |
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 @@ | ||
--- src/elf/dl-load.c 2023-07-31 20:54:16.000000000 +0300 | ||
+++ src/elf/dl-load.c.patch 2023-12-24 17:48:46.238884735 +0300 | ||
@@ -90,9 +90,7 @@ | ||
|
||
|
||
int __stack_prot attribute_hidden attribute_relro | ||
-#if _STACK_GROWS_DOWN && defined PROT_GROWSDOWN | ||
- = PROT_GROWSDOWN; | ||
-#elif _STACK_GROWS_UP && defined PROT_GROWSUP | ||
+#if _STACK_GROWS_UP && defined PROT_GROWSUP | ||
= PROT_GROWSUP; | ||
#else | ||
= 0; |
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,21 @@ | ||
--- src/elf/dl-load.c 2023-07-31 20:54:16.000000000 +0300 | ||
+++ src/elf/dl-load.c.patch 2023-12-25 17:28:25.688056890 +0300 | ||
@@ -1330,15 +1330,15 @@ | ||
errstring = N_("cannot change memory protections"); | ||
goto lose_errno; | ||
} | ||
- __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC; | ||
+ __stack_prot |= PROT_READ|PROT_WRITE; | ||
__mprotect ((void *) p, s, PROT_READ); | ||
} | ||
else | ||
- __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC; | ||
+ __stack_prot |= PROT_READ|PROT_WRITE; | ||
} | ||
else | ||
#endif | ||
- __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC; | ||
+ __stack_prot |= PROT_READ|PROT_WRITE; | ||
|
||
#ifdef check_consistency | ||
check_consistency (); |
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,24 @@ | ||
#ifndef _IGNORE_SYSCALL | ||
#define _IGNORE_SYSCALL | ||
|
||
#include <arch-syscall.h> | ||
|
||
struct IdSyscalls { | ||
int id; | ||
}; | ||
|
||
static struct IdSyscalls ListIgnoreSyscall[] = { | ||
{ __NR_mbind }, | ||
{ 1008 }, // for some reason used in julia | ||
}; | ||
|
||
#define count_ignore_syscall (sizeof(ListIgnoreSyscall) / sizeof(ListIgnoreSyscall[0])) | ||
|
||
static int is_ignore_syscall(int id) { | ||
for (int i=0; i<count_ignore_syscall; ++i) | ||
if (ListIgnoreSyscall[i].id == id) | ||
return 1; | ||
return 0; | ||
} | ||
|
||
#endif //_IGNORE_SYSCALL |
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,17 @@ | ||
--- src/sysdeps/unix/sysv/linux/syscall.c 2023-07-31 20:54:16.000000000 +0300 | ||
+++ src/sysdeps/unix/sysv/linux/syscall.c.patch 2023-12-25 08:47:12.612090672 +0300 | ||
@@ -18,10 +18,14 @@ | ||
|
||
#include <stdarg.h> | ||
#include <sysdep.h> | ||
+#include <ignore-syscall.h> | ||
|
||
long int | ||
syscall (long int number, ...) | ||
{ | ||
+ if (is_ignore_syscall(number)) | ||
+ return 0; | ||
+ | ||
va_list args; | ||
|
||
va_start (args, number); |
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