From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71EAEC001DE for ; Tue, 25 Jul 2023 08:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbjGYI4U (ORCPT ); Tue, 25 Jul 2023 04:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbjGYIz7 (ORCPT ); Tue, 25 Jul 2023 04:55:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4378B270E; Tue, 25 Jul 2023 01:55:30 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7FBF615BF; Tue, 25 Jul 2023 01:55:51 -0700 (PDT) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB1D83F6C4; Tue, 25 Jul 2023 01:55:06 -0700 (PDT) Message-ID: <6c99392f-6189-1835-3090-d5c7f95edaf9@arm.com> Date: Tue, 25 Jul 2023 09:54:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] scripts/kallsyms: Fix build failure by setting errno before calling getline() Content-Language: en-US To: Miguel Ojeda Cc: linux-kbuild@vger.kernel.org, masahiroy@kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Greg Kroah-Hartman , Zhen Lei , Miguel Ojeda , Boqun Feng , Arnd Bergmann , Nicolas Schier References: <20230724131741.954624-1-james.clark@arm.com> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/07/2023 01:41, Miguel Ojeda wrote: > On Mon, Jul 24, 2023 at 3:18 PM James Clark wrote: >> >> This fixes the following build failure if scripts/kallsyms launches with >> a non-zero errno value: > > The code change sounds good to me, but could you please describe the > situation where you found the build failure? > > Cheers, > Miguel I assumed it was something to do with one of the wrappers I'm using but didn't get to the bottom of it because I'm using quite a few. But I just checked now and it's just bear [1] that causes the issue. Maybe it sets errno before forking and that persists in the child processes? Not 100% sure how it works. I did debug scripts/kallsyms and errno was already set on the first line of main(), so it's not some other library call in kallsyms that is setting it but not being checked. The minimal reproducer for me looks like this: bear -- make ARCH=arm64 LLVM=1 O=../build/ [1]: https://manpages.ubuntu.com/manpages/focal/en/man1/bear.1.html