From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 8F7273858C2C for ; Thu, 24 Mar 2022 11:29:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F7273858C2C Received: by mail-ot1-x336.google.com with SMTP id z9-20020a05683020c900b005b22bf41872so3050168otq.13 for ; Thu, 24 Mar 2022 04:29:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=Eh1W7VR3x9mMLi2Jm5QZprVKu575viS13XLtw+z05Gg=; b=CTu9t5il4K7cS8rzcQeRRW7BnmwH326wz2GbgYGf5DyR1zW/UQgPevciygtcV2zq7y B5/wcV4QZ8CYSf1Q/b1zJrmJmp1GBZwJhNJXDh1gqgv3x0gPyjx8xRjaIZtFcARzU/MB Q2EZVE5XAyFtEvobPRVNq7pjENvwM2tk58r92k7pjuTCyvs+9grxSA1weRXBGo+NqQps Q9t5WE1QAEQJX1DQMG3WHGo6hdoZGoCS7YM6jXIkOIdxJQ/mW/1gA4hMEWhrrmhCrlNv C5Dq2wc8r4NiHXM+n36omg00eL4pQPcp6rYShtF2eyhy+MFZhxeUpEIWpu/XHI3CRdlV cQ4w== X-Gm-Message-State: AOAM532SnC8sfgx/Hg6QnXbO/zX2Lp/IvOBcSjElq3IYet9V4xkrYKev sb3uZX75sMaZsqtNXAOqzhnVhMlyFMg8nA== X-Google-Smtp-Source: ABdhPJytVwTgOVY8fb31MlqU0zER22CTYOQAHP9H0u0Gyhlg5SwXNE5bIsd1aVmUs6ppL45hYn8kGQ== X-Received: by 2002:a05:6830:542:b0:5b2:5f92:977b with SMTP id l2-20020a056830054200b005b25f92977bmr1807348otb.225.1648121367625; Thu, 24 Mar 2022 04:29:27 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:2d55:f4a6:3bdd:d081:25d0? ([2804:431:c7ca:2d55:f4a6:3bdd:d081:25d0]) by smtp.gmail.com with ESMTPSA id n23-20020a056870559700b000d47e9dabf0sm1351102oao.0.2022.03.24.04.29.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Mar 2022 04:29:26 -0700 (PDT) Message-ID: <2a6ee621-1d00-7657-0248-0c3eb988aa9c@linaro.org> Date: Thu, 24 Mar 2022 08:29:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2] linux: Fix __closefrom_fallback iterates until max int (BZ#28993) Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha References: <20220324110907.169470-1-adhemerval.zanella@linaro.org> <87v8w3r3si.fsf@mid.deneb.enyo.de> From: Adhemerval Zanella In-Reply-To: <87v8w3r3si.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2022 11:29:31 -0000 On 24/03/2022 08:25, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> The __closefrom_fallback tries to get a available file descriptor >> if the initial open ("/proc/self/fd/", ...) fails. It assumes the >> failure would be only if procfs is not mount (ENOENT), however if >> the the proc file is not accessible (due some other kernel filtering >> such apparmor) it will iterate over a potentially large file set >> issuing close calls. >> >> It should only try the close fallback if open returns EMFILE. > > I disagree. If there are performance issues due to the current code, > people should fix their container hosts. For closefrom it will trigger a __foritfy_fail and for posix_spawn_file_actions_addclosefrom_np it will make posix_spawn fail. I think on both cases it is better to fail early.