From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id E66261B5BB7C; Wed, 4 Mar 2026 18:21:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E66261B5BB7C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1772637706; bh=FYqdsOLZ1ZPqLcIpCMxjbIggDJZpaHgXislYHK3uD6U=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=l+a46kK0CMPkXnCiUcYeVDMn7ym+/N0n4Z3VvUMjuNf/SqG99iBMD28IC5SVBjiPp n9m5eKGjKAlBp2OiPdsTqPXpHVyOX2mi8XfB6okoxetZrNV+2evu5tDTuftQBrHfHg ULB+ReNOPhlRSmIhUedoqlDH9iOy29gIYA8fdY5Y= Received: from send80.i.mail.ru (send80.i.mail.ru [89.221.237.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C17FC1B5BB78 for ; Wed, 4 Mar 2026 18:21:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C17FC1B5BB78 Received: by exim-smtp-558f87dcd7-fq4lx with esmtpa (envelope-from ) id 1vxo2h-00000000Plb-3Qnd; Wed, 04 Mar 2026 18:21:44 +0300 Content-Type: multipart/alternative; boundary="------------UunqHvE87pLXimPRfAKNz5X0" Message-ID: <9639490a-1295-44e6-8764-eb4140791595@tarantool.org> Date: Wed, 4 Mar 2026 18:21:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <07878e492b55e0fb788ff7b037c0a7bc1073934a.1772438261.git.skaplun@tarantool.org> In-Reply-To: <07878e492b55e0fb788ff7b037c0a7bc1073934a.1772438261.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9406AA218EDC7AA274B04BFBEEBC1D63DB3DBD519BD8751C3182A05F5380850406210B16FD0317ABF3DE06ABAFEAF6705DA6C3348C47475E9D849A4024020CB0EB949C4EC051D72BC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE771540F9ECFC94C4BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566CF7C7957E4725328DA46ECF7E26E8714BAAADD41139FC17F5F61E95D65BBF8D9389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0D9442B0B5983000E8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249D9EEDE0C260548BB76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B13AA280BE71E98733AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735BA6625F88748EAEFC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A50B3EF7F7279258DA5002B1117B3ED696200DBD53B62A0E340E58516B1639A14B823CB91A9FED034534781492E4B8EEAD003C2D46C52F18F2BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659D810E6E83A678260B58BDB9F5938B66F9D1DDA0A6B87181B6D44AA38EC30D68125C85FA98CC48125B8341EE9D5BE9A0A8B9354EC8B3DC596EA8DCBED17FCCCFB9D2A68C047CB955E8CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVbwN8XFWZxQUnb9pejgcykI= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F25884585516E07F9883A70EE693A2F4CD4B10009065E16FCD9A72BF1D3E76F0DA5C366B645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] Fix pointer check for non-GC64 mode. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------UunqHvE87pLXimPRfAKNz5X0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! LGTM Sergey On 3/2/26 11:05, Sergey Kaplun wrote: > From: Mike Pall > > Thanks to Stefan Hett. > > (cherry picked from commit 471f8936cbd6aa80a937e375fe53ecadab93696a) > > This commit fixes the check for the pointer returned by the internal > LuaJIT allocator. For non-GC64 mode, the accessible address range should > fit in 31 bits due to VM (and JIT) restrictions. This commit fixes the > check. > > Since it is just an assertion check, there are no tests added for the > change. But this commit simplifies the reproducer for the next patch > (although not required). > > Sergey Kaplun: > * added the description for the problem > > Part of tarantool/tarantool#12134 > --- > src/lj_def.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/lj_def.h b/src/lj_def.h > index a5bca6b0..b06462fe 100644 > --- a/src/lj_def.h > +++ b/src/lj_def.h > @@ -105,9 +105,10 @@ typedef unsigned int uintptr_t; > #define checku16(x) ((x) == (int32_t)(uint16_t)(x)) > #define checki32(x) ((x) == (int32_t)(x)) > #define checku32(x) ((x) == (uint32_t)(x)) > +#define checkptr31(x) (((uint64_t)(uintptr_t)(x) >> 31) == 0) > #define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x)) > #define checkptr47(x) (((uint64_t)(uintptr_t)(x) >> 47) == 0) > -#define checkptrGC(x) (LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr32((x)) :1) > +#define checkptrGC(x) (LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr31((x)) :1) > > /* Every half-decent C compiler transforms this into a rotate instruction. */ > #define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1)))) --------------UunqHvE87pLXimPRfAKNz5X0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! LGTM

Sergey

On 3/2/26 11:05, Sergey Kaplun wrote:
From: Mike Pall <mike>

Thanks to Stefan Hett.

(cherry picked from commit 471f8936cbd6aa80a937e375fe53ecadab93696a)

This commit fixes the check for the pointer returned by the internal
LuaJIT allocator. For non-GC64 mode, the accessible address range should
fit in 31 bits due to VM (and JIT) restrictions. This commit fixes the
check.

Since it is just an assertion check, there are no tests added for the
change. But this commit simplifies the reproducer for the next patch
(although not required).

Sergey Kaplun:
* added the description for the problem

Part of tarantool/tarantool#12134
---
 src/lj_def.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lj_def.h b/src/lj_def.h
index a5bca6b0..b06462fe 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -105,9 +105,10 @@ typedef unsigned int uintptr_t;
 #define checku16(x)	((x) == (int32_t)(uint16_t)(x))
 #define checki32(x)	((x) == (int32_t)(x))
 #define checku32(x)	((x) == (uint32_t)(x))
+#define checkptr31(x)	(((uint64_t)(uintptr_t)(x) >> 31) == 0)
 #define checkptr32(x)	((uintptr_t)(x) == (uint32_t)(uintptr_t)(x))
 #define checkptr47(x)	(((uint64_t)(uintptr_t)(x) >> 47) == 0)
-#define checkptrGC(x)	(LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr32((x)) :1)
+#define checkptrGC(x)	(LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr31((x)) :1)
 
 /* Every half-decent C compiler transforms this into a rotate instruction. */
 #define lj_rol(x, n)	(((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1))))
--------------UunqHvE87pLXimPRfAKNz5X0--