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 00FC26EC55; Wed, 14 Jul 2021 12:29:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 00FC26EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626254982; bh=6cNH+tCr7lv9cd8WLi92TYlFcoL5oX/YCvsikosTb1E=; h=To:References:Cc:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=HLVqlwGsJPhz9O6k0WtkVrrxoVKHPMrQ+JAJcLslvX3EyIPUQ2sp9cLCqpstZ9Mvj WPmGnh8LF9V8Ixtn5XwKKYHcbImHEro66rBjRwNfUrVwjzQLbzoTraD7F++lf5Y+Hj eH94jrankNE3RQXdURBy4hs4iapEPlzgqV4RHbNI= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 2B6A26EC55 for ; Wed, 14 Jul 2021 12:29:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2B6A26EC55 Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1m3bD1-0006nt-L8; Wed, 14 Jul 2021 12:29:39 +0300 To: Cyrill Gorcunov References: Cc: tarantool-patches@dev.tarantool.org Message-ID: Date: Wed, 14 Jul 2021 12:29:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD97BB0EF39AD2B33D598226807B8A1E9DC331E3F9997896515182A05F538085040A26BB4A8A363792DE54DA76A294CFFC7C885CC21C0ED7FFC0C64BC54AA6F0106 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77E216A0E97507353EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BC4B0F5721B555078638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D87377ED8FB6C3EBE1ABE036CF411393BF117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE437C869540D2AB0F3D5BA627BF9F2FCFD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3724336BCC0EE1BA86136E347CC761E07C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637217F7D133B16D230EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5EAE343BC94F0AA693754D795CEC6E98080DC901C95CB53C1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753753CEE10E4ED4A7410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3490011A262ADAEDFE8954E8AF69EB372720C55E3C7B2DEE1436A1350FF422EDA7D1DACF0F53A05CEB1D7E09C32AA3244C2EA415ED59BC48C480EA580F557359B23C6EB905E3A8056B729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojDdSFIg49M1SS9Hmro7gkvQ== X-Mailru-Sender: EFA0F3A8419EF2166B053C73E674FFD5BF75277D5F057E441BE409B10E92B18DE2527C969975515C67F54F2D6EFFC80BC77752E0C033A69E17841C44D9B5D58765F2F89A5AFDB6F16C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 2/4] fiber: add option and PoC for Lua parent backtrace 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: Egor Elchinov via Tarantool-patches Reply-To: Egor Elchinov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 12.07.2021 15:09, Cyrill Gorcunov via Tarantool-patches wrote: > On Fri, Jul 09, 2021 at 02:03:51PM +0300, Egor Elchinov via Tarantool-patches wrote: >> >> diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c >> index 924ff3c82..dd26e2f13 100644 >> --- a/src/lib/core/fiber.c >> +++ b/src/lib/core/fiber.c >> @@ -220,6 +220,10 @@ fiber_mprotect(void *addr, size_t len, int prot) >> static __thread bool fiber_top_enabled = false; >> #endif /* ENABLE_FIBER_TOP */ >> >> +#if ENABLE_BACKTRACE >> +static __thread bool fiber_parent_bt_enabled = false; >> +#endif /* ENABLE_BACKTRACE */ >> + > > So this variable is declared as TLS in a manner of fiber_top > functionality. You know I somehow find this fishy because > it is unclear why it is done this way. I think we should > revisit this moment for @fiber_top_enabled enabled as well > but not in this series, so lets leave it as is. > > Please revisit snprintf calls in the patch and strncpy > as well because they _do_not_ append terminating \0 symbol > if destination size is not enough. I think we should add > \0 explicitly all the time. Thanks, fixed hereinafter. > > I mean > > +static int > +fiber_parent_backtrace_cb(int frameno, void *frameret, const char *func, > + size_t offset, void *cb_ctx) > +{ > ... > + char buf[512]; > + int l = snprintf(buf, sizeof(buf), "#%-2d %p in ", frameno, frameret); > + if (func) > + snprintf(buf + l, sizeof(buf) - l, "%s+%zu", func, offset); > + else > + snprintf(buf + l, sizeof(buf) - l, "?"); > > we could add > > buf[sizeof(buf)-1] = '\0'; > > Actually 512 bytes for function name should be more than enough but > better be on a safe side. > > Other than that the patch looks ok to me, great job, thanks! >