Skip to content

Commit 4baef1b

Browse files
Abhishek Dubeygiulianobelinassi
Abhishek Dubey
authored andcommitted
Make mmap livepatchable using glibc's syscall
This patch addresses the mmap livepatching issue[1] by invoking mmap system call through glibc's syscall interface. Hence, enabling livepatching on mmap library function. This change shifts the existing limitation from mmap to syscall of glibc. Excluding syscall from livepatchable set is acceptable due to its minimal design. [1] #239 Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
1 parent 8466a9e commit 4baef1b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: lib/arch/powerpc64le/patch.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <unistd.h>
2626
#include <pthread.h>
2727
#include <sys/mman.h>
28+
#include <sys/syscall.h>
2829

2930
#include <stddef.h>
3031
#include <string.h>
@@ -271,7 +272,7 @@ void *ulp_stack_helper(void)
271272
void *old = (void *)ulp_stack[ULP_STACK_PTR];
272273

273274
/* Allocate buffer for our stack. */
274-
void *new = mmap(NULL, ulp_stack[ULP_STACK_REAL_SIZE],
275+
void *new = (void*) syscall(SYS_mmap, NULL, ulp_stack[ULP_STACK_REAL_SIZE],
275276
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
276277

277278
if (new == (void *) -1) {

0 commit comments

Comments
 (0)