Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2335034rdh; Sun, 26 Nov 2023 02:42:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA3WjCQYFbvnwovQ4tIwV8BquvIADa5jZlEe+6461lAYLWOekpebEc80ZgEz1T1CvjOZ5J X-Received: by 2002:a0d:c7c3:0:b0:5cb:95e8:16ba with SMTP id j186-20020a0dc7c3000000b005cb95e816bamr8467583ywd.46.1700995355347; Sun, 26 Nov 2023 02:42:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700995355; cv=none; d=google.com; s=arc-20160816; b=rmc04CCjOoLSuWvqpNDh/Ikd+SxbzM2csO6F9jECFsEHQWN+EcgfX3MPjoo9IAcsRj BVr76TBYC6otoJgyyq6pJ88QBT4FqPzdZOnFdU8hgWNKJCOj8f2WSmfKVZQ7ZAQDu6v6 ZOGr5uhW7TeVyYuj4fUyUSSKWLXxNhtmx6rbw1jgtrCEZeIwQsctoGMZs0AMBZTeyzoh TlNTY3JU7/eOTzIVGgJfUTd8rlq3yoNavzWECENvnBt78nk8zNxc/IEZiorYergU/tDw NzfQwbSICd0zY82eikIeQawchAfB27t5Zob81DHUQYMuDe9AVQ65jqF4uHDzORU1BxJw VBnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9mRUAaI4Fz2GOrVVfEfEk31a0IyBZQbnf2LBQxExe74=; fh=pTx9fEY7ua+lm7qrJvkJuQzqwoXTh0iZZAyDx4UpkYw=; b=nuK058yroDJMc2cCtpRS/PwEKS6Ndc9aRq3RQlM5ixhw5UnmZojGHm5bB/4iGZjaSg vY4I/m2ERANEv8X/NQ9raSZzTujZCzPwlZCTPE/xuuUtDBLNZyI0HhT/4lN12aP5xAC4 Dj08cDkEXLsLl1UAnj/5sLAlHvN47aJuHN3DQaNlHIBk/KXoe9nd9mb8OUQHQCbVSZyW roF3c+alKV4Z+ppDI2BcbTe/TSKIgCrPl8L3UwWeTqA+kad3DvlHj5suywUCgrHVO+1+ 7ECvWfzJyIV7UIOmUr3NDPqb66raY5CUJnbeuhltFDOkeOB5drhZzudkski2ppBqdYzC H0CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=aBeplL6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id fa27-20020a056a002d1b00b006b4231ba465si7394143pfb.85.2023.11.26.02.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 02:42:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=aBeplL6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A75EC807C6EE; Sun, 26 Nov 2023 02:42:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229449AbjKZKmM (ORCPT + 99 others); Sun, 26 Nov 2023 05:42:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjKZKmL (ORCPT ); Sun, 26 Nov 2023 05:42:11 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0AFF0; Sun, 26 Nov 2023 02:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1700995335; bh=iRTUO3vfIzyLX0GLcSUGSZRdAVle/RaLLeXGHGJpkC8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aBeplL6Lpuuq3AICfV5wIEh9GkhhyNYyIlelnIen7Z3K2zFt77PoP51P4xfUKQGcu xZFEt50E62LaNGbXBF5p7Q6YKSVMe+L1/bp+jM8aUqmgc2AzYXVB5g64Y5MbQwWPTc yeRhW2narcLU9HEbkDR1cbh5/QSaAdhd+a6s6gNM= Date: Sun, 26 Nov 2023 11:42:15 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit Message-ID: <63a86460-23a8-4e5a-a34d-d1825c85b5a0@t-8ch.de> References: <20231123-nolibc-rlimit-v1-0-a428b131de2a@weissschuh.net> <20231123-nolibc-rlimit-v1-2-a428b131de2a@weissschuh.net> <20231126092828.GB7407@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231126092828.GB7407@1wt.eu> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 26 Nov 2023 02:42:32 -0800 (PST) On 2023-11-26 10:28:28+0100, Willy Tarreau wrote: > Hi Thomas, > > > +int test_rlimit(void) > > +{ > > + struct rlimit rlim = { > > + .rlim_cur = 1 << 20, > > + .rlim_max = 1 << 20, > > + }; > > + int ret; > > + > > + ret = setrlimit(RLIMIT_CORE, &rlim); > > + if (ret) > > + return -1; > > + > > + rlim.rlim_cur = 0; > > + rlim.rlim_max = 0; > > + > > + ret = getrlimit(RLIMIT_CORE, &rlim); > > + if (ret) > > + return -1; > > + > > + if (rlim.rlim_cur != 1 << 20) > > + return -1; > > + if (rlim.rlim_max != 1 << 20) > > + return -1; > > I think you should used two different values here for cur and max so > that you can also detect stupid API bugs such as a union being used > instead of a struct, or copy-pastes in the implementation etc. For > example using 1<<20 and 1<<21 should do the trick. Good point, I incorporated the suggestion. > Otherwise Ack-by me for the whole series, of course. Thanks! FYI I retested and pushed the series. Thomas