From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 454383858C2C for ; Wed, 13 Apr 2022 13:53:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 454383858C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 0F7AC1F38D; Wed, 13 Apr 2022 13:53:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649858020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1LW57YuDzGbCyBvpUwV6PeR4LR3LtAlzpU7P0Ng+7mQ=; b=vGTPYi1CihiHxQtszA/3nAljYob/ezfhE7c6AOo1EyNjzTvc9DRuWZ0meJ5g4+jVCqzb1e ZmY9ymRCgKfslugQfrO4tad+I8XC0lKEnb0N+7+V13Z04K35Cu5eukw2RiDfzHSALZz1ay zd10fcnbfelP4qCD9kAUOtNo3mZu6VM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649858020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1LW57YuDzGbCyBvpUwV6PeR4LR3LtAlzpU7P0Ng+7mQ=; b=n4BGXyL7jO+c1VDh20jlGQH6yfFMkdKX93jL0XPoJmdbPdPtzrFex2lZaiKPSl/n1gIUwO Gr29AZGoPsTex6CA== Received: from suse.cz (unknown [10.100.200.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C8688A3BA9; Wed, 13 Apr 2022 13:53:39 +0000 (UTC) From: Martin Jambor To: Pedro Alves Cc: GCC Development Subject: Re: GSoC, Make cp-demangle non-recursive and async-signal safety In-Reply-To: <4ae22d40-8dde-ae2d-16a4-38f0f8e58f74@palves.net> References: <4ae22d40-8dde-ae2d-16a4-38f0f8e58f74@palves.net> User-Agent: Notmuch/0.35 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Wed, 13 Apr 2022 15:53:36 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2022 13:53:42 -0000 Hello, On Fri, Apr 08 2022, Pedro Alves wrote: > Hi! > > I noticed the discussions about making cp-demangle use malloc/free instead of recursion, > and I wonder about signal handlers, and I don't see that mentioned in > https://gcc.gnu.org/wiki/SummerOfCode's description of the project. > > See my question to Ian a few years back, here, and his answer: > > https://gcc.gnu.org/legacy-ml/gcc-patches/2018-12/msg00696.html thanks for the pointer, I also stumbled across these only recently. Indeed it seems it may be necessary to also have a variant that would have to rely on alloca in the main driving loop to allocate the explicit stack... which will make the code a bit ugly but hopefully not that much. But this can be handled incrementally once we can get the normal mode of operation working. Thanks again, Martin > > ~~~ > Ian says: > > Pedro says: > > Ian earlier mentioned that we've wanted to avoid malloc because some > > programs call the demangler from a signal handler, but it seems like > > we already do, these functions already aren't safe to use from > > signal handlers as is. Where does the "we can't use malloc" idea > > come from? Is there some entry point that avoids > > the malloc/realloc/free calls? > > cplus_demangle_v3_callback and cplus_demangle_print_callback. > ~~~ > > Grepping the gcc tree, I see that libsanitizer uses those entry points. > > Is async-signal safety no longer a consideration/concern? Or will those entry points > continue to work without calling malloc/free somehow?