Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2000497pxu; Fri, 9 Oct 2020 05:34:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtnxBu3flGtG6Dr36bl/HYu+2tGkM0LUbdBkY4+9GbvM2b0GkGbj447ChAJh7OL7w5YFfV X-Received: by 2002:aa7:dc12:: with SMTP id b18mr14241090edu.295.1602246896092; Fri, 09 Oct 2020 05:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602246896; cv=none; d=google.com; s=arc-20160816; b=hZq55cdztgIb1KpMy7/lulXliGiQWPqa/xf85Eclb+K+g/paTvT41qzPOSZvM485bP 1b2u0eSlC4wqjHWAviCQ/rYq/KMQsse/zVnF3DsS7s7O6M/j7YSS+9bD1a9YVQ5M1Tga B9OgtcdAV9Rm+uw8vF31atsWmfjDmGqpuhu6Pwn2kyT5twYVdqjBfy4SCj/6yG+AQfTh WBBvaTbbFPPlux5K72eTd7RcWWzIZidj7BBdqL5lJf3rDw4qy4AsoanSdUdy3z9jq5+W QMRshwDaRl3m9NKoDauJ5a6tkY7Nyamgb+hdPdtWNpi52nhEpXUCyE9W7FpQ5qrXQDBu /Zyw== 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; bh=fy6/YhIzDjrUq5GHdqkYv4g0/WIdLUkKmDkl1EzF/r4=; b=l4WNCpDuNP6VYThNeY3xg+ba0OULMjpVoxWjONOf6CB42HxvxlhebGvupRUcPeoRC+ ZL79TLJCIklUSsawsVj4Jl2/WXfVhWGcCM9rx5kuIjw7Z6HcPUl9qsqf/oTdFn1/sRfS JV4QucWiOGNRB1HEfzycPOOZHEj5CwEqtZK/Y0QeX2A3wM9s/05kPu1kxn0EK22FTZwt r4sSYbe540g1l19Rms9IpcmP+27cHR5KwQFqInbj6aUFI8y7QVMel0B8zzjXTMv70OHJ GgqRXZ++J0R5EC1ifnZ2fLqu9KZfjsdMwni4oVysCi33HiYpRSaO/LXEuL8iBiV2o1MF B5SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si5903147ejp.429.2020.10.09.05.34.32; Fri, 09 Oct 2020 05:34:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387406AbgJIJ6Q (ORCPT + 99 others); Fri, 9 Oct 2020 05:58:16 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54230 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726357AbgJIJ6Q (ORCPT ); Fri, 9 Oct 2020 05:58:16 -0400 Received: from [81.92.17.135] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kQpAC-00078I-DG; Fri, 09 Oct 2020 09:58:12 +0000 Date: Fri, 9 Oct 2020 11:58:11 +0200 From: Christian Brauner To: Naresh Kamboju Cc: "open list:KERNEL SELFTEST FRAMEWORK" , linux-api@vger.kernel.org, open list , Christian Brauner , Kees Cook , "Peter Zijlstra (Intel)" , Ingo Molnar , Thomas Gleixner , Oleg Nesterov , "Eric W. Biederman" , Sargun Dhillon , Aleksa Sarai , Josh Triplett , Jens Axboe , Shuah Khan , lkft-triage@lists.linaro.org Subject: Re: selftests: pidfd: pidfd_wait hangs on linux next kernel on all devices Message-ID: <20201009095811.inrr6yrnbg2ke5gh@wittgenstein> References: <20200924143317.getruzwu423g3o3e@wittgenstein> <20200924162126.mbthwz32w7rba7oe@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 02, 2020 at 11:01:34PM +0530, Naresh Kamboju wrote: > On Thu, 24 Sep 2020 at 21:51, Christian Brauner > wrote: > > > > On Thu, Sep 24, 2020 at 04:33:17PM +0200, Christian Brauner wrote: > > > On Wed, Sep 23, 2020 at 07:52:05PM +0530, Naresh Kamboju wrote: > > > > selftests: pidfd: pidfd_wait hangs on linux next kernel on x86_64, > > > > i386 and arm64 Juno-r2 > > > > These devices are using NFS mounted rootfs. > > > > I have tested pidfd testcases independently and all test PASS. > > > > > > > > The Hang or exit from test run noticed when run by run_kselftest.sh > > > > > > > > pidfd_wait.c:208:wait_nonblock:Expected sys_waitid(P_PIDFD, pidfd, > > > > &info, WSTOPPED, NULL) (-1) == 0 (0) > > > > wait_nonblock: Test terminated by assertion > > > > > > > > metadata: > > > > git branch: master > > > > git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > > > git commit: e64997027d5f171148687e58b78c8b3c869a6158 > > > > git describe: next-20200922 > > > > make_kernelversion: 5.9.0-rc6 > > > > kernel-config: > > > > http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/intel-core2-32/lkft/linux-next/865/config > > > > > > > > Reported-by: Naresh Kamboju > > > > > > Thanks for reproting this. I'm taking a look now! > > > > Ok, this is a simple race in the selftests, that I overlooked and which > > is more likely to hit when there's a lot of processes running on the > > system. Basically the child process hasn't SIGSTOPed itself yet but the > > parent is already calling waitid() on a O_NONBLOCK pidfd. Since it > > doesn't find a WSTOPPED process it returns -EAGAIN correctly. > > > > The fix for this is to move the line where we're removing the O_NONBLOCK > > property from the fd before the waitid() WSTOPPED call so we hang until > > the child becomes stopped. > > > > So I believe the fix is: > > I have tested this patch and the pidfd_wait test did not hang this time. > > Tested-by: Naresh Kamboju > > test log link > https://lkft.validation.linaro.org/scheduler/job/1813223 Thanks for testing, Naresh. I've applied the patch: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?h=pidfd_o_nonblock&id=01361b665a26ef0c087e53f14cf310d1cfe0cf98 Christian