From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E6E1B3858430 for ; Mon, 10 Oct 2022 00:51:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6E1B3858430 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665363105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pbWm0Ck/PnOl06MUTv2B+SX3UB9LEY4IwyUdKBlwj1k=; b=UbHrTTPO3Xtzs6L/OqNpzc/JO+rMD2Ybc8d4quZBWoJMb9Bi1P8lwWw2ulTgmj8pmcHx2p ZXjt2EaqzSXyAcG0YljT6DIvxYev6DJ7aQZtbJXQ+dDBhviCqFHfvTvbbZzYRudaMKame+ bL185Imext21QgsqLddGVfxedlDqCFE= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-262-kNTnmBJkPjWdYBlfULAIaw-1; Sun, 09 Oct 2022 20:51:44 -0400 X-MC-Unique: kNTnmBJkPjWdYBlfULAIaw-1 Received: by mail-io1-f71.google.com with SMTP id t15-20020a5d81cf000000b006bc1ca3ae00so900730iol.10 for ; Sun, 09 Oct 2022 17:51:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pbWm0Ck/PnOl06MUTv2B+SX3UB9LEY4IwyUdKBlwj1k=; b=IRk7HO1+fyOIicfgTIDVaJVozUJH8TtApyIfx9J6XckOGMi2bSc0a73bdXUvoBtHi2 IlfxZ9VwXmI0Ui4ukVMkc8lppLfFAYFAp9KpaQKCQxaB0a5AbsjYqA+66uyRmpanNXZn uIvn+cbW9B3Yv0kxUl9EOKURy6qTdKp5EXa1ec3vsNJG2PtZB/fqHY0JK9EKRw3GR3WX ULEQPZ1qWmRVoTZdjDGbFfFv1Z1VZ5g6bEPwvSPjEp8TWHE+sEKge0/dU4VzfkH5n1Kw mU1RnZ6RFrFyQOAwxcE5EykLqo8Ghwr65Jol1PSr10vsa1mkGzkeQDd0JkAZ6Y/3g/tp hbCA== X-Gm-Message-State: ACrzQf2elsTqEWB0v/Y2jGzjYoDro4bICyF971hqnm8aqCXp6NJk69zg bXQRF5l9ZQvOtxLv7cVNb/98/6P42TgbCPOr309ldI6dIWG7LC7LH3MCeIjc657rkbnJDJEoooE irtc0mexHR40lCOH6ifRL X-Received: by 2002:a05:6638:3f08:b0:363:a039:a51a with SMTP id ck8-20020a0566383f0800b00363a039a51amr5675740jab.161.1665363103651; Sun, 09 Oct 2022 17:51:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Od33IxCQqszETTKYll6neoZFXg4OwPa5JKwP9RFaJ3m+1bPpuq/5B/VSUC96kh8knf+0/9g== X-Received: by 2002:a05:6638:3f08:b0:363:a039:a51a with SMTP id ck8-20020a0566383f0800b00363a039a51amr5675728jab.161.1665363103363; Sun, 09 Oct 2022 17:51:43 -0700 (PDT) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id t4-20020a02b184000000b00363a4fcd3a8sm2059160jah.5.2022.10.09.17.51.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Oct 2022 17:51:42 -0700 (PDT) Message-ID: <1e7ae13a-e5dd-2e0e-60ff-637284d3f8a9@redhat.com> Date: Sun, 9 Oct 2022 20:51:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] alpha: correct handling of negative *rlimit() args besides -1 To: Matt Turner , libc-alpha@sourceware.org Cc: Aurelien Jarno References: <20221008024522.523048-1-mattst88@gmail.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20221008024522.523048-1-mattst88@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/7/22 22:45, Matt Turner via Libc-alpha wrote: > The generic version of RLIM_INFINITY in Linux is equal to (rlim_t)-1, > which is equal to ULLONG_MAX. On alpha however it is instead defined as > 0x7ffffffffffffffful. This was special-cased in 0d0bc78 [BZ #22648] but > it specifically used an equality check. > > There is a cpython test case test_prlimit_refcount which calls > setrlimit() with { -2, -2 } as arguments rather than the usual -1, it > therefore fails the equality test and is treated as a large arbitrary > positive value past the maximum of RLIM_INFINITY and fails with EPERM. > This patch changes the behavior of the *rlimit() calls to treat all > integers between 0x7ffffffffffffffful and (rlim_t)-1 as (rlim_t)-1, > i.e., RLIM_INFINITY. > --- > sysdeps/unix/sysv/linux/alpha/getrlimit64.c | 4 ++-- > sysdeps/unix/sysv/linux/alpha/setrlimit64.c | 4 ++-- Is MIPS affected by the same problem? > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c > index c195f5b55c..40f3e6bdff 100644 > --- a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c > +++ b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c > @@ -38,11 +38,11 @@ __old_getrlimit64 (enum __rlimit_resource resource, > if (__getrlimit64 (resource, &krlimits) < 0) > return -1; > > - if (krlimits.rlim_cur == RLIM64_INFINITY) > + if (krlimits.rlim_cur >= OLD_RLIM64_INFINITY) > rlimits->rlim_cur = OLD_RLIM64_INFINITY; > else > rlimits->rlim_cur = krlimits.rlim_cur; > - if (krlimits.rlim_max == RLIM64_INFINITY) > + if (krlimits.rlim_max >= OLD_RLIM64_INFINITY) > rlimits->rlim_max = OLD_RLIM64_INFINITY; > else > rlimits->rlim_max = krlimits.rlim_max; > diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c > index 421616ed20..4e88540a48 100644 > --- a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c > +++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c > @@ -35,11 +35,11 @@ __old_setrlimit64 (enum __rlimit_resource resource, > { > struct rlimit64 krlimits; > > - if (rlimits->rlim_cur == OLD_RLIM64_INFINITY) > + if (rlimits->rlim_cur >= OLD_RLIM64_INFINITY) > krlimits.rlim_cur = RLIM64_INFINITY; > else > krlimits.rlim_cur = rlimits->rlim_cur; > - if (rlimits->rlim_max == OLD_RLIM64_INFINITY) > + if (rlimits->rlim_max >= OLD_RLIM64_INFINITY) > krlimits.rlim_max = RLIM64_INFINITY; > else > krlimits.rlim_max = rlimits->rlim_max; -- Cheers, Carlos.