-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(patches): fix luajit segment release check in internal memory a…
…llocator ### Summary See: LuaJIT/LuaJIT@9b5e837 Signed-off-by: Aapo Talvensaari <[email protected]>
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
build/openresty/patches/LuaJIT-2.1-20231117_03_fix-segment-release.patch
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,23 @@ | ||
From 9b5e837ac2dfdc0638830c048a47ca9378c504d3 Mon Sep 17 00:00:00 2001 | ||
From: Mike Pall <mike> | ||
Date: Fri, 19 Apr 2024 01:44:19 +0200 | ||
Subject: [PATCH] Fix segment release check in internal memory allocator. | ||
|
||
Thanks to Jinji Zeng. #1179 #1157 | ||
--- | ||
src/lj_alloc.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c b/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c | ||
index 9adaa0e5bd..0c0c0c4f4c 100644 | ||
--- a/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c | ||
+++ b/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c | ||
@@ -1057,7 +1057,7 @@ static size_t release_unused_segments(mstate m) | ||
mchunkptr p = align_as_chunk(base); | ||
size_t psize = chunksize(p); | ||
/* Can unmap if first chunk holds entire segment and not pinned */ | ||
- if (!cinuse(p) && (char *)p + psize >= base + size - TOP_FOOT_SIZE) { | ||
+ if (!cinuse(p) && (char *)p + psize == (char *)mem2chunk(sp)) { | ||
tchunkptr tp = (tchunkptr)p; | ||
if (p == m->dv) { | ||
m->dv = 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