Skip to content

Commit d13c71d

Browse files
soulbirdsoulbird
andauthored
fix: Linux/ARM64 memory reallocation failure in 1.19.9 (#48)
Co-authored-by: soulbird <[email protected]>
1 parent 64e166d commit d13c71d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git src/lj_alloc.c src/lj_alloc.c
2+
index 21fb7af5..165203fa 100644
3+
--- src/lj_alloc.c
4+
+++ src/lj_alloc.c
5+
@@ -365,7 +365,7 @@ static void *CALL_MREMAP_(void *ptr, size_t osz, size_t nsz, int flags)
6+
#define CALL_MREMAP(addr, osz, nsz, mv) CALL_MREMAP_((addr), (osz), (nsz), (mv))
7+
#define CALL_MREMAP_NOMOVE 0
8+
#define CALL_MREMAP_MAYMOVE 1
9+
-#if LJ_64 && !LJ_GC64
10+
+#if LJ_64 && (!LJ_GC64 || LJ_TARGET_ARM64)
11+
#define CALL_MREMAP_MV CALL_MREMAP_NOMOVE
12+
#else
13+
#define CALL_MREMAP_MV CALL_MREMAP_MAYMOVE

patch/patch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ elif [[ "$root" == *openresty-1.19.9.* ]]; then
4747
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.22"
4848
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.20"
4949
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.10"
50+
apply_patch "$patch_dir" "$root" "LuaJIT-2.1" "20210510"
5051
else
5152
err "can't detect OpenResty version"
5253
exit 1

0 commit comments

Comments
 (0)