Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148580; b=HkSlxxMRyT79HaV/JwFWYY3jK20fJBQp8m8x/pE8Er2Jwe95eEhK9MEPqA5cpNSpeVU/ 78/MXg7z36Fthn1GVsXtsaOmqhMdiOlk3rzO/yMcioq5vFRiMrY5Cq/+yn3fcu70e+ISJ fDRsgLSOZYW4CGSzjb7H6REHk70j+j5JBZ3sbTXaUZHNW6u/r4jYxdkmenY90MNAu+W0q BbCKuUwkLQfNEfawEexpvwBPI+UZA+d8Y2pfBTvMKwfyf2Vw1AWFpq8CBHcPg5K+FQRFd hDdeIPNYTrUbaaHbLIBx3H4sYJDLEDpY2hq6IIhXIKdG1gqC04Mvz45bCXn+JZd6lqw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796148580; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=gTP9IUAQ13dwuOupz0HogIF6hioFY+mCvd84WPWFdfc=; b=BCKX7Y4S6saMr4Y1L/6q1vbke4uPmIFQt3mN7raV2vl6MPf7gLGqRO7z/aoXtQlwcvfU I5RNSLe+x/jwu3+ZEgvxjZWNv40ocSWJ1S/3l25vZq6dlxeOI4tnMRs1ffnpHstxOBSit SuX23A+aYTIXmsv4MsMzcRn/lQA6RXNdtb47zzwxN0q22S8NLSd3sqKfE2uOpZAItt5TT BLsbFlM1VmEjyoSvtvmgpS5yrqFLwGedxJNMWOfV/aLHsOBUG2exO9b3jLRlX238E0FwW uIMoUuiX6rdee+SFz8xIlflazru8zeRmFusZdPuQ6Qb+UpkdNjaFiKrkI84PdADQnSg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MZaTAtT4; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E943606A31A for ; Tue, 1 Dec 2026 18:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MZaTAtT4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E354E1F000C1; Tue, 1 Dec 2026 18:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796148579; bh=gTP9IUAQ13dwuOupz0HogIF6hioFY+mCvd84WPWFdfc=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=MZaTAtT4sRT3zU4MLLly+yDJB5b1pq/TYglPrONcvN63d00IVsCXpSXMQKKp7ZULF SeeNxjCY2iP4Fdn1nFmPXZtyfuVj0OQSfnUNqXjPuXeKa8bZ4pBGEhGUPpbQCEB+ea 8ek+0ICYi3pCK9v64sfr+rqtbBvJcOXm8RJNTxewErvzfUBw0IKZfb6QepHKhZrORw yEz4+iBeykFIDLeZv2VXne1xh9kTWmxbCh34XdOeDFIh9Segp9KXeknUGedRqGWdsQ qpaPjziqgw6L7r5l+Ceain8hwrehK+8KU3H0gKO6fWCu60UelZVJhTgLmmEsMswuAB tGbCmqZ/1G4hQ== Message-ID: <73d87a69-b075-4b68-8f20-28c6234ea147@kernel.org> Date: Tue, 1 Dec 2026 18:09:37 +0000 X-Mailing-List: dwarves@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH dwarves] dwarf_loader: Don't crash when a worker thread can't be created To: Trond Myklebust , dwarves@vger.kernel.org Cc: Arnaldo Carvalho de Melo , Ihor Solodrai References: <20261130163619.3004516-1-trondmy@kernel.org> Content-Language: en-GB From: Alan Maguire In-Reply-To: <20261130163619.3004516-1-trondmy@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/30/26 4:36 PM, Trond Myklebust wrote: > From: Trond Myklebust > > dwarf_cus__process_cus() stores the return value of pthread_create() in > dcus->error, which the workers that are already running read. If the > creation of a worker fails with EAGAIN, dwarf_cus__nextcu() returns 11 > to a running worker, dwarf_loader__decode_next_cu() only treats negative > values as errors, and the worker dereferences a NULL dcu. If the first > pthread_create() fails, pahole exits with status 0 without encoding > anything. > > Kernel builds hit this intermittently, since pahole gets the make job > count as -j and many pahole processes run at once during module BTF > generation: > > ./scripts/gen-btf.sh: line 70: ... Segmentation fault (core dumped) ${PAHOLE} -J ... > > The job queue doesn't depend on the number of workers, so carry on with > the workers that did start, and do the work in the calling thread if none > did. Also stop storing a positive ENOMEM in dcus->error, and treat any > value other than 0 and 1 from dwarf_cus__nextcu() as an error. > > Fixes: 4c916259c3e7 ("dwarf_loader: Multithreading with a job/worker model") > Assisted-by: Claude:claude-opus-5-5 > Signed-off-by: Trond Myklebust Thanks for the fix! Applied. I've put together a test to cover this scenario to avoid regressions, will send it shortly. Alan