From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17AF1D2A555 for ; Wed, 16 Oct 2024 19:58:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 702076B007B; Wed, 16 Oct 2024 15:58:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B21A6B0082; Wed, 16 Oct 2024 15:58:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5528B6B0083; Wed, 16 Oct 2024 15:58:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 36EAC6B007B for ; Wed, 16 Oct 2024 15:58:24 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3359E140B66 for ; Wed, 16 Oct 2024 19:58:13 +0000 (UTC) X-FDA: 82680527118.04.162C87D Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by imf19.hostedemail.com (Postfix) with ESMTP id 947191A0005 for ; Wed, 16 Oct 2024 19:58:10 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b="W4o/cXvJ"; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf19.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.166.52 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729108668; a=rsa-sha256; cv=none; b=2ZOhRRWUA6Uui+A9HlSEuvc4OcWLwCwPG+Jp6fI9qzEN7Z0iZ13DK4gQoQeh+nt8UXIkIw HutKljSekoL2WPXJSdvnAenUUXELuAcXzBStu6NXPbuXNMMVUDATWawdZ/AWzwPtQie7Z7 AxvjZ81fAf0JjPSZX+Rk34lZh4d5h3U= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b="W4o/cXvJ"; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf19.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.166.52 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729108668; h=from:from:sender: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:dkim-signature; bh=oykqBF27Cg1WsEM8oIdtzCYaI3LOXySa66d+3hjTzRI=; b=G2NbbPTx/iSndWeMRMGR++7GinuWtbMPyN7ow++7Nm7DIBfCb9GBMvR2ajSl5C3xXMIVZe oLGK9x+9g9W1wRKYR5Unu+FiedUT0wIVOXlS/ULqoPWluXbHnomEKiqcZw+RicKNNFaawq a72xylvPWYgecPDMNfehM3jfZryfnJQ= Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-83a9b3d8145so6891639f.2 for ; Wed, 16 Oct 2024 12:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1729108701; x=1729713501; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oykqBF27Cg1WsEM8oIdtzCYaI3LOXySa66d+3hjTzRI=; b=W4o/cXvJiB7/Vvj1Tcqf4TUpiAdDbOb8m35fOsVlPaJrdQATT8KxdFbXssyjByxSjF +1GjXalZm7F+uo2BhN9VNR0UMstGjLZ8iGlaAJNCjVIw/yPcmzKt3G/4NCEFutuePjvQ JzUWqa6njR9Ex/jNEb7zWfg+cMXD2TemiAjAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729108701; x=1729713501; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oykqBF27Cg1WsEM8oIdtzCYaI3LOXySa66d+3hjTzRI=; b=pRHQ7bKMkykxway59jazBbeG4XK2CLf04b2vm2xveb8991kDwYZ680Q449IpqAHotV MXmzQWKq6P9Li3xwiE9zdt16n0B4FonuOPtvrGBwuAZqZicfKEiUNzVXhTzeOgV2AsPS KxTdKr2VYADQ4Gt2PjtE+teDtgCHqJzDa95SpR5qH5rFn5VXIcAGMpoXEzYr9mxhFdwr cWH7igYf08cXoY2EVHrJeg8vCea5IKU1BRZeAQkGbmu/oXU0WPL6kJYFFC2nx1/K3ycB i+MTFRmakF0RKR0c+7Rj/YC8V6aPhc5y4AycZoTSIeZh0Xs3Iqik0mSONiMA3IuJiEJt SMmw== X-Forwarded-Encrypted: i=1; AJvYcCWj3CWm7rLqoZ+df9+b6JwF3JyQ/Nn/DyFKsZtNCLb4rNHsTNqGYUi2DvChVqoTrEePCYCSSyBaUw==@kvack.org X-Gm-Message-State: AOJu0YwRGQFITgOtA/j7zD09NP5PhKVDQcTfb9B92dF2JSSPaTupet7v ijvYCK+CR8MTF3s/QfS1ociFgzuQybB+Yxel/+yDFK3E89ykHZ1Zpgb2OVrNbqc= X-Google-Smtp-Source: AGHT+IEG26gug8dxXfFJbY1LkWfuk3I0y+Nj1NQSbSr3D53poIG/+n2Fi6ldVX/RxyOyB2qrKiHZTw== X-Received: by 2002:a05:6602:2dd3:b0:82a:23b4:4c90 with SMTP id ca18e2360f4ac-83792703cd8mr2282797339f.1.1729108700563; Wed, 16 Oct 2024 12:58:20 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4dbecb3993esm976476173.94.2024.10.16.12.58.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Oct 2024 12:58:19 -0700 (PDT) Message-ID: Date: Wed, 16 Oct 2024 13:58:18 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF_* To: Lorenzo Stoakes Cc: Christian Brauner , Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <8917d809e1509c4e0bce02436a493db29e2115b3.1728578231.git.lorenzo.stoakes@oracle.com> <1d1190be-f74f-45ab-ac6c-2251d0bec1bc@linuxfoundation.org> <71221c84-7721-42b7-add4-269a1f25c478@lucifer.local> Content-Language: en-US From: Shuah Khan In-Reply-To: <71221c84-7721-42b7-add4-269a1f25c478@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: g7o3c1og8tz8mrzsizuirfjdiudowtse X-Rspamd-Queue-Id: 947191A0005 X-Rspamd-Server: rspam02 X-HE-Tag: 1729108690-919741 X-HE-Meta: U2FsdGVkX1+FlbwUA8ikQBnyonnMxtoU4r8Ohh/q4Bzd6ipzdQIAb4IiZbmVuUT3XrdT07uERMtvHfRdrL3gsEX58uW7TjjOGAPuYQqSmE/Jtw1bE2Piy/RqSs9AUASNY0EdAWtYMBe0C2h7RKrr96mqfLYWvFiZULiRl5ZktxwnhC6WiLXIQ0F4bl0SsllW/XPeBGEeJSVCVrw2VWi/zeKCee7ggjsxnndJ++BfshoWFk1trbVGUNRRWR5uIktojKCW5pFtV4o7k34cVRKOx+Sgx0g2q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5bq/fXWC9HTEwzW/ls2SDNNq5rUFkpXJZcf5XgzlGGcJNzTyzwQpMJSdMP+2vzbV3ln+5wFMycGv0vA+lkHrNfsBYaSOax5wJawIywAwbeukXSivAtC9zz5ncYD048w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 10/11/24 02:20, Lorenzo Stoakes wrote: > On Thu, Oct 10, 2024 at 05:16:22PM -0600, Shuah Khan wrote: >> On 10/10/24 12:15, Lorenzo Stoakes wrote: >>> Add tests to assert that PIDFD_SELF_* correctly refers to the current >>> thread and process. >>> >>> This is only practically meaningful to pidfd_send_signal() and >>> pidfd_getfd(), but also explicitly test that we disallow this feature for >>> setns() where it would make no sense. >>> >>> We cannot reasonably wait on ourself using waitid(P_PIDFD, ...) so while in >>> theory PIDFD_SELF_* would work here, we'd be left blocked if we tried it. >>> >>> We defer testing of mm-specific functionality which uses pidfd, namely >>> process_madvise() and process_mrelease() to mm testing (though note the >>> latter can not be sensibly tested as it would require the testing process >>> to be dying). >>> >>> Signed-off-by: Lorenzo Stoakes >>> --- >>> tools/testing/selftests/pidfd/pidfd.h | 8 ++ >>> .../selftests/pidfd/pidfd_getfd_test.c | 136 ++++++++++++++++++ >>> .../selftests/pidfd/pidfd_setns_test.c | 11 ++ >>> tools/testing/selftests/pidfd/pidfd_test.c | 67 +++++++-- >>> 4 files changed, 213 insertions(+), 9 deletions(-) >>> >>> diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h >>> index 88d6830ee004..1640b711889b 100644 >>> --- a/tools/testing/selftests/pidfd/pidfd.h >>> +++ b/tools/testing/selftests/pidfd/pidfd.h >>> @@ -50,6 +50,14 @@ >>> #define PIDFD_NONBLOCK O_NONBLOCK >>> #endif >>> +/* System header file may not have this available. */ >>> +#ifndef PIDFD_SELF_THREAD >>> +#define PIDFD_SELF_THREAD -100 >>> +#endif >>> +#ifndef PIDFD_SELF_THREAD_GROUP >>> +#define PIDFD_SELF_THREAD_GROUP -200 >>> +#endif >>> + >> >> Can't we pick these up from linux/pidfd.h - patch 2/3 adds >> them. > > We're running this file in userland and it's not obvious we can correctly > import this header, it'd be some "../../" thing out of the testing root > directory and might not interact well with all scenarios in which this file > is built. > > Also the existing tests do not seem to try to import that header, so it > seemed the safest way of doing this. > kselftest has dependency on "make headers" and tests include headers from linux/ directory These local make it difficult to maintain these tests in the longer term. Somebody has to go clean these up later. The import will be fine and you can control that with -I flag in the makefile. Remove these and try to get including linux/pidfd.h working. I see your v2 and v3. Please revise this patch to include the header file and remove these local defines. thanks, -- Shuah