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 DCFBF6EC40; Mon, 20 Sep 2021 12:38:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DCFBF6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632130727; bh=O2z562frCa7UOyEjpL1DKdpDRdWqZIbhxF2N10DMpIo=; h=Date:In-Reply-To:To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=g/TQ7reT3r6rFNn401KEgn4AYWcAKRgJ8JMfFa0ZwesYv6Z85uvmgHM9D6DgdPMgy L8bWIAeANAlt7eMr/UzwGwQ+3yU/yxZ3wDkICAOQW9aXwmjErQH/MTIMkoViwpgKfI NtuwyGO470pzLiLUTU/h9JVHxUWxY4eyDXr5bI/M= Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A212E6EC42 for ; Mon, 20 Sep 2021 12:37:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A212E6EC42 Received: by smtp55.i.mail.ru with esmtpa (envelope-from ) id 1mSFkK-0003o0-R3; Mon, 20 Sep 2021 12:37:57 +0300 Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_128C57B7-131F-4000-A584-3767255AF0C4" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Date: Mon, 20 Sep 2021 12:37:56 +0300 In-Reply-To: To: Sergey Kaplun References: <45fce284fce8df636a18e7303114f82d5bbce2f0.1631170629.git.skaplun@tarantool.org> <31B92E03-B5C4-4719-9191-41D8581C930E@tarantool.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91AE02D33A9C88A2FAC52BB37A480E789638BB4D06A25224200894C459B0CD1B9A10A5DA76765F758536D8FFB3C824C1C29E88886021A9387616BE8D460342E8D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75263010198C72082EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379B0255B5E5688AF88638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8B9C70D5FB9D41E5B5C6A0DE44ECE1C8A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCEA77C8EAE1CE44B0A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F2CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5C2F78AA12818E19E08033987892847579E6EECBA88E40612D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75DD5744CF7ED0C6846D6546786ADF492D5A0AA20F8A0307212E763F503762DF502E10D2E0CD89AFB08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D343D1F112031EF3D62C8115CE0EDF5388E211A21F56F6F146582D855595076094B4A54F262355330321D7E09C32AA3244C42103445148D5DF0EFA58AB5FA8D02186C24832127668422FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojsFc9NKou+3jqE/h9iFhZxw== X-Mailru-Sender: 3B9A0136629DC912F4AABCEFC589C81EAC31BDF4125C9C840724546BA921A5476E4CD7FF1E0756C2AD07DD1419AC565FA614486B47F28B67C5E079CCF3B0523AED31B7EB2E253A9E112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 3/3] Avoid conflict between 64 bit lightuserdata and ITERN key. 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: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" --Apple-Mail=_128C57B7-131F-4000-A584-3767255AF0C4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi! > On 20 Sep 2021, at 11:38, Sergey Kaplun wrote: >=20 > Hi, Sergos! >=20 > Thanks for the review! >=20 > On 15.09.21, sergos wrote: [...] >>> +++ b/test/tarantool-tests/lj-727-lightuserdata-itern.test.lua >>> @@ -0,0 +1,48 @@ >>> +local tap =3D require('tap') >>> + >>> +-- Test file to demonstrate next FF incorrect behaviour on LJ_64. >>> +-- See also, https://github.com/LuaJIT/LuaJIT/issues/727. >>> + >>> +local test =3D tap.test('lj-727-lightuserdata-itern') >>> +test:plan(1) >>> + >>> +local ud =3D require('lightuserdata').craft_ptr_wp() >>> + >>> +-- We now have the tagged lightuuserdata pointer >>> +-- 0xFFFE7FFF00000002 in the up before this patch (after the patch >>> +-- the maximum available lightuserdata segment is 0xffe). >>=20 >> Shall we end the test here with just an expectation of an error? >> I believe you can make a way simpler test: pcall(craft_ptr()) should = work >> successfully 254 times and error on an 255th one, isn=E2=80=99t it? >=20 > Not exactly, I think. > The main idea of the test -- generate as much lightuserdata objects as > we can, and save them in the same table. After that we check that > iteration by them is correct. >=20 > Test you suggested doesn't show up the possible issue with ITERN, does > it? Exactly. I don=E2=80=99t see any reason to force the situation showing = that you can=E2=80=99t use the LUD segment beyond particular value. The test can = be that simple showing the max segment is 254, not 255 - exactly the = functionality that is added to the code. So, it should fail at creation of 255th = segment and it will be the positive outcome of the test. If there=E2=80=99s no = error - the test fails. It will simplify the test considerably. Also, you should not have such long explanation of ITERN/ITERC - just say "the 255th segment is = forbidden, since its encoding is overlapped with control variable used by = ISNEXT=E2=80=9D. I would recommend to wait for the 2nd reviewer here - especially if you discussed the patch before submit. Regards, Sergos --Apple-Mail=_128C57B7-131F-4000-A584-3767255AF0C4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi!

On 20 Sep 2021, at 11:38, Sergey Kaplun = <skaplun@tarantool.org> wrote:

Hi, Sergos!

Thanks for the review!

On 15.09.21, sergos wrote:

[...]

+++ = b/test/tarantool-tests/lj-727-lightuserdata-itern.test.lua
@@ -0,0 +1,48 @@
+local tap =3D = require('tap')
+
+-- Test file to = demonstrate next FF incorrect behaviour on LJ_64.
+-- See = also, https://github.com/LuaJIT/LuaJIT/issues/727.
+
+local test =3D = tap.test('lj-727-lightuserdata-itern')
+test:plan(1)
+
+local ud =3D = require('lightuserdata').craft_ptr_wp()
+
+-- = We now have the tagged lightuuserdata pointer
+-- = 0xFFFE7FFF00000002 in the up before this patch (after the patch
+-- the maximum available lightuserdata segment is 0xffe).

Shall we end the test here with = just an expectation of an error?
I believe you can make a = way simpler test: pcall(craft_ptr()) should work
successfully 254 times and error on an 255th one, isn=E2=80=99t= it?

Not exactly, I think.
The main idea of the test -- generate as much lightuserdata = objects as
we can, and = save them in the same table. After that we check that
iteration by = them is correct.

Test you suggested doesn't show up the possible issue with = ITERN, does
it?

Exactly. I don=E2=80=99t see any reason to force the = situation showing that you
can=E2=80=99t use the = LUD segment beyond particular value. The test can be that
simple showing the max segment is 254, not 255 - exactly the = functionality
that is added to the code. So, it = should fail at creation of 255th segment
and it = will be the positive outcome of the test. If there=E2=80=99s no error = -
the test fails.
It will = simplify the test considerably. Also, you should not have such
long explanation of ITERN/ITERC - just say "the 255th segment = is forbidden,
since its encoding is overlapped with = control variable used by ISNEXT=E2=80=9D.

I would recommend to wait for the 2nd = reviewer here - especially if you
discussed the = patch before submit.

Regards,
Sergos

= --Apple-Mail=_128C57B7-131F-4000-A584-3767255AF0C4--