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 A023D53A8ED; Fri, 21 Jul 2023 11:25:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A023D53A8ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1689927929; bh=wRL5koZJq6OslznmRYZFBsGmg9ocMpbFS0Owsn4iEPk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=x1fjc8iwKvoZ6eC1Be/eVadWwu+1TVsq4FRvsVRXd30pdqLqTFwe7plgqw9xDJU33 4y7PsrPOBiqNWN4fQmFHjgQ5ET8+ykj/G5qAibyarzisHk9bTd0n33m6yQy+rahElF vjiDyyZPw0Wzx8IVsz5TWw7TVXDeQL0gm+EXFD/o= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [95.163.41.74]) (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 50D5953A8F4 for ; Fri, 21 Jul 2023 11:23:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 50D5953A8F4 Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1qMlQ8-007UVO-BY; Fri, 21 Jul 2023 11:23:28 +0300 To: Sergey Kaplun , Sergey Bronnikov Date: Fri, 21 Jul 2023 08:12:07 +0000 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9227D43F3CB451B41616FC75AC98AB10873760FAF3730B0E5182A05F538085040664BE9D989CCDB4B94AB53840CB9534195D6259D21D7E1E3BC87646F6F246008 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B264C8851FD8E810EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374CC1EE7F84E0F1BE8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84475B329F1FE7F9D7F93119F0775CAEA117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3733B5EC72352B9FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520902A1BE408319B29E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B4DC33E588678F033D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3223C850C94764309C0837EA9F3D19764C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637F765F39FA4E70FFE43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5AD53D99BC716B3C2F1FBBE4910BDE6B54E0E02FE61727FF0F87CCE6106E1FC07E67D4AC08A07B9B0B4B51A2BAB7FBE05C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF5734377FD0FC4ED391318BE633D392A4E46458DB1A451196E375A79CE4DBAA0D60B027A3EDF90BC17A512D943FCE53BF866DFC909240070404A72A4447AC59B3A74DFFEFA5DC0E7F02C26D483E81D6BEECAEF3E2CCC1ED8C383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojhjdY/2lpWUJEfbkpZz/7jg== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D5312354B6DF3EEE8F1451C7B69BFAFDCB6E52715C3B530C6BDB2326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v2 4/5] build: introduce LUAJIT_USE_ASAN option 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" There was neither a special option nor a variable to configure the sanitizers support via the build system since the commit 052c1a32a5e74b337686eee229d089d576775931 ("Add preliminary ASAN support") where ASan support had been introduced. We finally decided to use this feature in LuaJIT CI, so for convenient build configuration LUAJIT_USE_ASAN option is added to the root CMakeLists.txt. Resolves tarantool/tarantool#5878 Co-authored-by: Sergey Kaplun Signed-off-by: Igor Munkin --- CMakeLists.txt | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ef24bba..c4664cf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,15 +269,30 @@ if(LUA_USE_ASSERT) AppendFlags(TARGET_C_FLAGS -DLUA_USE_ASSERT) endif() -# TODO: Implement a configuration option to enable ASAN. -# There are two entries of LUAJIT_USE_ASAN define: -# $ grep -rnF 'LUAJIT_USE_ASAN' . -# ./src/lj_str.c:15:#if LUAJIT_USE_ASAN -# ./src/host/buildvm.c:36:#if LUAJIT_USE_ASAN -# At the same time this flag is not provided by LuaJIT original -# build system (i.e. src/Makefile.original) so there are no -# related compiler and linker flags passed. This should be done -# the right way later. +# Turn on AddressSanitizer support. As a result, all artefacts +# (i.e. buildvm, LuaJIT, testing infrastructure) are built with +# ASan enabled. +option(LUAJIT_USE_ASAN "Build LuaJIT with AddressSanitizer" OFF) +if(LUAJIT_USE_ASAN) + if(NOT LUAJIT_USE_SYSMALLOC) + message(WARNING + "Unfortunately, internal LuaJIT memory allocator is not instrumented yet," + " so to find any memory errors it's better to build LuaJIT with system" + " provided memory allocator (i.e. run CMake configuration phase with" + " -DLUAJIT_USE_SYSMALLOC=ON)." + ) + endif() + # Use all recomendations described in AddressSanitize docs: + # https://clang.llvm.org/docs/AddressSanitizer.html. + AppendFlags(CMAKE_C_FLAGS + # Enable hints for AddressSanitizer (see src/lj_str.c). + -DLUAJIT_USE_ASAN + # XXX: To get nicer stack traces in error messages. + -fno-omit-frame-pointer + # Enable AddressSanitizer support. + -fsanitize=address + ) +endif() # --- Main source tree --------------------------------------------------------- -- 2.30.2