Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1227899lqb; Thu, 18 Apr 2024 04:09:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2uTwXEgjEWu6J42viNNV/cEmC6Kpo7xUCEx3YEXEcWZHXUJx/hDgprRj80iH1WhI8l5t25Bbhx0FbP6I+F0y0CZXBrr7d2UIENXANKQ== X-Google-Smtp-Source: AGHT+IHu0Ro7qSHHKRP06Y1Jrcn3YrESNWbvuYsy2OdM0YP7PwZhTA/BX4uHsE6gndV3ADiy4FEj X-Received: by 2002:a05:620a:575a:b0:78e:c312:4cba with SMTP id wj26-20020a05620a575a00b0078ec3124cbamr2473091qkn.12.1713438596604; Thu, 18 Apr 2024 04:09:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713438596; cv=pass; d=google.com; s=arc-20160816; b=H4Cp5SoYBaAsPv49cOxPbRr9590D2NPsQiHvfaJWPvSLyLcZD/QRBDhfutSX+zxNQU 0PVbZ6Nfhv+3MG/8J4857DvTuDWcVvsziE8NcLEqEN8kuAnDIjoCtfy65xG26F97WpZH U3BOxR87PLfg7d5+28lDQQl50Lgms2XCFn1hb3h3f3qml31wihk4eosmrprf25FdJUMh jcqXqEG4z5BwIRnkHXtk03tpQ/q8fFA19USmVWeKIEbUWnw6RC0K25R4dRC1iPqGz4bV /+KJWb/n0EmJo+lSEBji6Bz8uiLcddcMH+pJMFECMkPg82Xnomw7uU6NsVyOcrsC6zXO 88NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A44iy4AqqCja05ZmJdmD1JODugt38b1SVYe7frc1l4Y=; fh=3qA2YdxEOfzNToAowpfjY/4LMSUynnAbByN81yVsx0M=; b=sBC47axqrbROrfzvOYcbaRSu8IONPJ0DuzP5e+NbBJurk/XvEIaEyjNDQzKjx+3Qqx 8h6qgGyLhXXHRpI3HJ2iXLX5jk/LzsSe07ZCHU7tDUYnKrqtVflrC/H80H3vtLfAIpy4 l/9s1Nm473RuZTeoiCyduKk22Ke4QcUlNnmhEkPh4XZVH7YxnYqJWQsWPmBRwNE19L49 RsxPxlvZ2KsK6r9pyz37X9iopZQ5DGHB9oDQg5/54869RHhq2nA0bx0mL8reANOxpt7t 7FdopH5XQZUHHG7A+gBxOnTL30SsJVHXKEQGITZutU7lFvF81ebxZLY4BZrHz3LeKPl9 nwZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KKvUkZSx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-149951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wg21-20020a05620a569500b0078d757489f3si1254467qkn.295.2024.04.18.04.09.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 04:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KKvUkZSx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-149951-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56F621C20E87 for ; Thu, 18 Apr 2024 11:09:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9466E15E5AB; Thu, 18 Apr 2024 11:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KKvUkZSx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B93AC15B969; Thu, 18 Apr 2024 11:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713438589; cv=none; b=JW1+7kexRr+H0+yyjtpERL0715HbZ93W+xuhcYmlWehU0Gyru8s4l6Enn1MX9xfz7ePvN6vg/z1jFJglG7iEO9sOxTg7TXN/3VjAvakp/6uQK2WUcm2JzfElov/7tNINnUyP1b+rYXT/NuFCQ1VIwtCzMIBP1pT1xlh3IVZOjIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713438589; c=relaxed/simple; bh=qAVKH5tsIDe303O+jpYWLvoR3uryyXnhLGmBfvK6Sfs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=D14BCp/FzW71zENpypBMcKb4kuB3PMv9EmwhjllrLYvbqIhDh20NqdteBky3r6BJwl7ylPJn0suZqQfM5NqD6M7WDNDcbGSUe5MuXiOsWQhepbOmqKbr5LbLtVbFsMfoAmBabzyA23zU/dNotprm85YC0IL3+7c1+7Lbir7t0oM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KKvUkZSx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1A3FC113CC; Thu, 18 Apr 2024 11:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713438589; bh=qAVKH5tsIDe303O+jpYWLvoR3uryyXnhLGmBfvK6Sfs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KKvUkZSxIQH4UmDHhzSMcuu7UGv7MuzSYjv8V4LgPrSJSIPi57BdvCkFvrTPwkNwU 1+gr4Wd1g1TMksHqWhTgNPRlDrE7MQT/uanqvMquHOxFGDgrntq1dM5HmKjxrSPkja TGDh7fmgpEA6KXK4IqHBX0iolafWMWnP2opwxE99BUrpHI+To42oFoA6SSJbQu7WM/ 82M0ALw9cST/t6z1h/XhcOkYqxxz1hDNbM7WeDbpdtzgDF0W4+MC61cA5cTaQzvVpX i9AothM4dMaXqawcI/+1KrK3/uPAzR3DlejzKaHkSGuuMWM6gnn7QvlUdZVdTV6K/N htRtY+UUGCZRg== Date: Thu, 18 Apr 2024 13:09:45 +0200 From: Christian Brauner To: Nathan Chancellor , Adrian Reber Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: tools/testing/selftests/clone3/clone3_set_tid.c appears to always pass? Message-ID: <20240418-hiebe-bahnt-066312cb324b@brauner> References: <20240417152222.GA1517581@dev-arch.thelio-3990X> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240417152222.GA1517581@dev-arch.thelio-3990X> On Wed, Apr 17, 2024 at 08:22:22AM -0700, Nathan Chancellor wrote: > Hi Christian, > > I am looking at tools/testing/selftests/clone3/clone3_set_tid.c as part > of a patch to clean up the uses of 'return ksft_exit_...();' throughout > the selftests (as they call exit() so they do not return) and I noticed > that it seems to always pass even when there may have been an error? > > if (waitpid(ns_pid, &status, 0) < 0) { > ksft_print_msg("Child returned %s\n", strerror(errno)); > ret = -errno; > goto out; > } > > ... > out: > ret = 0; > > return !ret ? ksft_exit_pass() : ksft_exit_fail(); > } > > Should the ret and out label positions be switched? Alternatively, it > seems like ret and out do not have that many uses, perhaps it would just > be better to call the ksft_exit_...() directly in their respective > paths? I am not going to touch it as part of my patch but I felt it was > worth reporting since it appears to have been there since the > introduction of this test in commit 41585bbeeef9 ("selftests: add tests > for clone3() with *set_tid"). Uh, good point. Let me Cc the original author.