From nobody Tue Sep 05 14:07:39 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rg6lp1Fc7z4skjY; Tue, 5 Sep 2023 14:07:50 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mail02.stack.nl (scw01.stack.nl [51.15.111.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "ecc.stack.nl", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rg6ln65sSz3dvy; Tue, 5 Sep 2023 14:07:49 +0000 (UTC) (envelope-from jilles@stack.nl) Authentication-Results: mx1.freebsd.org; none Received: from localhost (localhost.localdomain [127.0.0.1]) by mail02.stack.nl (Postfix) with ESMTP id E61AC1E014B; Tue, 5 Sep 2023 14:07:41 +0000 (UTC) Received: from mail02.stack.nl ([127.0.0.1]) by localhost (mail02.stack.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1pY0ph7snvZD; Tue, 5 Sep 2023 14:07:39 +0000 (UTC) Received: from blade.stack.nl (blade.stack.nl [192.168.121.130]) by mail02.stack.nl (Postfix) with ESMTP id 356FE1E0149; Tue, 5 Sep 2023 14:07:39 +0000 (UTC) Received: by blade.stack.nl (Postfix, from userid 1677) id 1A7C2237C4D; Tue, 5 Sep 2023 16:07:39 +0200 (CEST) Date: Tue, 5 Sep 2023 16:07:39 +0200 From: Jilles Tjoelker To: Mark Millard Cc: Current FreeBSD , FreeBSD Mailing List , Bryan Drewery Subject: Re: FYI: ^T use during poudriere bulk vs. /bin/sh operation: I got a "Unsafe ckmalloc() call" Abort trap that left a mess Message-ID: <20230905140739.GA7298@stack.nl> References: <6B7D2081-B152-400F-A294-11F039077A9F.ref@yahoo.com> <6B7D2081-B152-400F-A294-11F039077A9F@yahoo.com> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6B7D2081-B152-400F-A294-11F039077A9F@yahoo.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:51.15.0.0/17, country:FR] X-Rspamd-Queue-Id: 4Rg6ln65sSz3dvy On Mon, Sep 04, 2023 at 05:16:56PM -0700, Mark Millard wrote: > During a (zfs based) poudriere bulk -a run a ^T got a: > Unsafe ckmalloc() call > Abort trap (core dumped) > My attribution to ^T handling is unverified: I did not find the > sh.core file. It is just what the timing looked like. The error message means that ckmalloc() is being called without INTOFF in effect, i.e. at the time a SIGINT may cause an EXINT exception (longjmp()). Although malloc(3)'s data structures could be protected by surrounding the malloc() call with INTOFF and INTON, this would lead to a memory leak if a SIGINT happened at that time, since the pointer to the allocated memory would be lost. This check was added in git commit 9f9c9549fd4f7ce362e95e3a8a50f00ffd00175c. My first guess would be that there is a bug with a rare edge case of traps and/or errors, such as not applying INTOFF again after an exception has turned it off or doing INTON when interrupts are already enabled. A less likely possibility could be a violation related to volatile and synchronization between a signal handler and the main flow. Many common code paths are all exercised by the tests and normal use, so it must be something special in some way. -- Jilles Tjoelker