From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15811 invoked from network); 31 Jul 2021 20:26:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Jul 2021 20:26:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627763192; b=o9hZNuL2mpfTKxtzD1gYFN9fatLpMkBnJRf9Es0AUGuNYI9xy0pXPxQBdrhPTomnrwc0z0BWWQ rlGbJ4K+5VD5QBofvfe+duU1IZy4/rrnTeabriLK6fQ93UL/6EkeyLMlOY6DJwG0zQYr6peUmh Yhc8aZzFv5YJ3g4Uwp9hylQCCUAc1bRNIehoh4gIUktY14lRqoVek24ovsDBTBmZ3hA9cbEvy8 6W4tckIZ8r1hnF+daKfeYu0PJdsobmYb1DYJUeVOPwODCuMk65YY17L7RDeFjpmRZG4td12YDT 0S6dmsfD8dnTXLIefWpJxDlXZ7UZZ0+Jy4P69BSVSLJD3A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail.cock.li) smtp.remote-ip=37.120.193.124; dkim=pass header.d=national.shitposting.agency header.s=mail header.a=rsa-sha256; dmarc=none header.from=national.shitposting.agency; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1627763192; bh=H47zy1WF2CqvdoRwK/Yh9Bg/zUwkew9bYZ9sc6bMCV8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:DKIM-Signature:Date:DKIM-Signature; b=fCy30OUCbWMGOM4qS8WyPWLEjW8DvPAz048SAIJKaWvDrN6j2AmwN1RR4P/SpX7RdLlsAJ72aR mDnxgm/uFH5D+HVFqxrQVmae3SuOs4nEUyCV/VgYBz/62IOwQ7WwbvoLE8vGDRQDZpxMRhw8ez 4RYMV1uGZhrQRsZnNKzu8rnbbIQzIWcssb6AFtFIWRXfyBh3mRCqWH4Aik1TQtGeLUWySVUX60 2rY06RkR8WGiNbTbGVkXx1A82BBdztSd9Jc/HA/UzneaukGYoCC3WJ69abcSz1/Zuf7XnAawDJ BCUfVM81DMxCIskF3WMe9Xs8KrACrz0YyjYlitkEJ6za4A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=3xEWkQyYBlCiHahzNopaudN5FIFZ3DSrUGiLqUoxFyg=; b=jj5ZsJqErh7OKOgfjy+qh+xdOc HEv8lXsSxgWvOJcY1qRJQKvwMrfcbz+gfZ+0NlW2CgcejyhAgaHxM/xKQ19Dk3lO/CNNvKCpgwLWs IzF5U/zmJcsa8Sh5/zkWMHv8eJcbB6NKPnGLAZHzRAkGgfvmaTi9N015Aoc++n6nF8k0lPo5lPI8E hHFuqqhlgM8IuWryx/5GkbmgeXPBZWuGPJegwJuvhcp6EfoTvkDUxlvXTY1RMfmYzLL/aPuy5Y0nB jGK96C6VTJ39dZOHv+0//9HlgFpRP5i6n/liPRzW4862xcf8I1EXbVths2BX7e0IvRlB7A9TNFJ5z 0SQ5vTCw==; Received: from authenticated user by zero.zsh.org with local id 1m9vZ0-000FSO-Ne; Sat, 31 Jul 2021 20:26:30 +0000 Authentication-Results: zsh.org; iprev=pass (mail.cock.li) smtp.remote-ip=37.120.193.124; dkim=pass header.d=national.shitposting.agency header.s=mail header.a=rsa-sha256; dmarc=none header.from=national.shitposting.agency; arc=none Received: from mail.cock.li ([37.120.193.124]:59870) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1m9vYR-000F93-Ex; Sat, 31 Jul 2021 20:25:56 +0000 Date: Sat, 31 Jul 2021 22:25:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=national.shitposting.agency; s=mail; t=1627763153; bh=H47zy1WF2CqvdoRwK/Yh9Bg/zUwkew9bYZ9sc6bMCV8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t0eltINradEMvLhzZWbxJoqT4Gi13GcD3lFTVwubcHtg3Mq1CGYVc7EwlO4Ec9TMl y70KeQiR993gems8O4scDL0VbxX8/g70e9FkTQ0I+IliNPwc1eXCOUB12N235pflDO emNndXK2mRk+SylTIfZIAPx/m18TP24roqg6IOuwwUtIX6sZl3/RxowCCFSfeELoXB gEX3TQs/QO3xHM3T/jbmdBRbDBmgYaIv5w4hhKi1dDfkYY307IdCeJY9a0t5LgAUfT 9VkCubP38gdEvh+S/cbe8zAeHuKzYTIgQFbUbVBHXD6cuJbxMSFfLqJc1MA3VOwihX wi385/M9uXc5Q== From: zsugabubus To: Bart Schaefer Cc: Zsh hackers list Subject: Re: [BUG] malloc inside signal handler Message-ID: <20210731202547.yxzvwevxvy22ywm3@localhost> References: <20210724225048.ly7qpdvi55j3h5mi@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 49224 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Fri, Jul 30, 2021 at 06:33:08PM -0700, Bart Schaefer wrote: > Under what circumstances are you generating this error? I had the crash with the following command: zsh -c ". hashes.zsh; print ~dir" that was being executed inside $TERMINAL -e so that explains SIGWINCH. (hashes.zsh contains a few hash -d lines.) Unfortunately, I could not find any way to reproduce this again, even though I call it a few hundred times a day. However, looking at the stack trace it seems straightforward (for me) what's going on: shingetline() calls winch_unblock() and dont_queue_signals() so fgetc() can be interrupted at any time. $ gdb zsh -ex 'b input.c:153' -ex 'r' -ex 'b adjustwinsize' -ex 'signal SIGWINCH' -ex 'bt' Just to make sure, it confirms that SIGWINCH can be handled around fgetc(), maybe during a memory allocation inside it so if adjustwinsize() also uses malloc() that can be fatal. -- zsugabubus