Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4335116rwo; Tue, 25 Jul 2023 04:44:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlF61GjKMyqAqXby+GP98w8ldFZ8W7WupIrmHbuZZegjyT1Cuaovbl355pSrGNQlYKRD3Ma+ X-Received: by 2002:a17:902:c404:b0:1b8:abe7:5a80 with SMTP id k4-20020a170902c40400b001b8abe75a80mr19959983plk.40.1690285465145; Tue, 25 Jul 2023 04:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690285465; cv=none; d=google.com; s=arc-20160816; b=Kt1TFfTHpOAnIyOZi3oXoVJLYOWJOvOt1uprY0W77Qq5mIEF6iS80ocV5Bfiij6ZDr mrY5ebpXUHDhAbwW9aIlzT4equ36jEs7qd3/O9fqQstOazvy73qkUKOi2lLU+pBGqLTX Tx5F2rne9uvYktHKXqr6pfIDCe8NzYm2cK9/UZOL6wM2VGY2NdUedA3rHhIY66mG96Oq jRcLYmjYdqKMviJjAyb6KPTl4arz+qCblAWOgMUwFBzJLRdHTy2T8HXfHYixKnlBkLyX IsiN5BoXQnVBXlgFUevP9Imw0oB2daDrlNh2Lb+Leg3FInhyKo33iI2od2DGeK/fXdYf dZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=UlvpFKMDABiqyUu55kPlKulGyuo9zqSBkEYeyrVaRYA=; fh=O7RiSVu809sp+MCI0CNTqqZaV9lP7v74HKbFQncyFyQ=; b=dc70W28yngbfb9JS0qB9+V2nez1jLNApz1On/JuD5oibyl31YMyRNZDbjp8MFEkzug P80+1mLul6V3pV7xQBVXSP3fLxTBT2h6O42sQ1HIaq4rQlJ89RzCUrNIVU05pdtLhLeR rUusWeKSw2v6IahO8ZAZgXM7dJ1B+In/b822NdmbtiKj/GuQVbX/bql00oLa3Uj9mGtA 64PiI8UUIPM+S2h3CytwEjrPC19lpyBMwSryJu1rMmrn8QgVvPjl8r8Hgw6yzbD4lE23 jYdsYiygrMxEVf1i52N34W2OCeyCN6ZZgScOdAFlgBX1vIiUzjNIMdNVxAGVIrl5oxTE IRfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a170902c40b00b001a677821130si12091463plk.13.2023.07.25.04.43.53; Tue, 25 Jul 2023 04:44:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233666AbjGYLEF (ORCPT + 99 others); Tue, 25 Jul 2023 07:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbjGYLDt (ORCPT ); Tue, 25 Jul 2023 07:03:49 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C3235FCA; Tue, 25 Jul 2023 04:00:57 -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 424F215BF; Tue, 25 Jul 2023 04:01:19 -0700 (PDT) Received: from [10.57.2.54] (unknown [10.57.2.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 48F503F67D; Tue, 25 Jul 2023 04:00:34 -0700 (PDT) Message-ID: <09ce295f-f8c9-8663-4a7c-cf4a0c43a3ec@arm.com> Date: Tue, 25 Jul 2023 12:00:32 +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> <6c99392f-6189-1835-3090-d5c7f95edaf9@arm.com> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/07/2023 11:33, Miguel Ojeda wrote: > On Tue, Jul 25, 2023 at 10:55 AM James Clark wrote: >> >> 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. > > I think this is https://github.com/rizsotto/Bear/issues/469: bear > preloads a library which was setting it to non-zero. > > Now, even if bear was breaking a guarantee C programs have (`errno` > for the initial thread at program startup is meant to be 0 according > to the C standard), it is still a good idea to set `errno` to zero > here in case something else happens to change `errno` within > `kallsyms` in the future. > > With the repro and the `bear` link issue added: > > Reviewed-by: Miguel Ojeda > > Cheers, > Miguel Oh yeah nice find, that's the issue. I added it and sent a v2. Thanks James