Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1343179ybb; Wed, 8 Apr 2020 23:30:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLWCovtDAvQbInFGNC6cS+9GsY3CFJhmlCzQMuAcjYqLSxZk1Du2YpEEnf0M9MCntLme/uX X-Received: by 2002:a05:6830:1356:: with SMTP id r22mr2863752otq.209.1586413840537; Wed, 08 Apr 2020 23:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586413840; cv=none; d=google.com; s=arc-20160816; b=Q7w1FEaHiGjmJ6dfe0/iCXCbZO/MQOVf2hTfrLvnC1OOY37P5Z8V8I+wqMcq+GIzTr /TrGjg9ZRuzZVhjvREDjGNYZ452izMo3EFdORhg+EgE9DRTwfKnBnV7PKfrD04KHb6lX +Q2V2J5yCbayGz6ty82kgZs/M7uHgyUMLDevwZAU0Sw4spxz7B3XimpRYam4NF1KbLfH T0ObT/yueIxagrbH5k2lkmOStK+rLAFEZ/YqBPOYEC734g9uwGzxIY/5ijzQbqOUmj1u 528l35iGm5UKN+xUJkTIM+mzTiEJeOb8vt5R1UPJ2InGlbPMPHkAv7DK9HHPtJ7PAbcx tRHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Grm86vreVjyXAquqlbQvZFBa/TkelVHJfq7HxYo2C00=; b=sPqssW28oFWewxF2SoP8feLRBZ9HL+2LiecoGvhNNnh0a/ix5jzFVPqVhMKcmHd+NT 0e1k3k1DlZcWxQzSLQ/L3rxHXj85FH3c0PrGbw3BlLZC2b2eXqTIZhF/mcPAfJqyB8Ho x4BZvTUV/oYM/+iolpfHjB5j+nmchdzP7vBxxJl9VjBI7HYkbGV5vCLNia/eM6rSec7k avBbFBchBE3FVRg0RozYB7EPOr2padWYP/2I5ICT+N59QVgNhf7Pm/LdhhFNtpRnuVwk wf+QkpbKuzcL3kf64bKr3M9lXzyFpWdoDpKaCimKt13cU+/OOmUKrDbEJZuE3zOgDUef YdTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si3337423oim.26.2020.04.08.23.30.24; Wed, 08 Apr 2020 23:30:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbgDIG2P (ORCPT + 99 others); Thu, 9 Apr 2020 02:28:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37188 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgDIG2O (ORCPT ); Thu, 9 Apr 2020 02:28:14 -0400 Received: from mail-wr1-f72.google.com ([209.85.221.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jMQfd-0006SW-17 for linux-kernel@vger.kernel.org; Thu, 09 Apr 2020 06:28:13 +0000 Received: by mail-wr1-f72.google.com with SMTP id m15so5884333wrb.0 for ; Wed, 08 Apr 2020 23:28:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Grm86vreVjyXAquqlbQvZFBa/TkelVHJfq7HxYo2C00=; b=jPCTrm4Qo0NzvrQCClp1wgloLWD9UT37XR1kqrsMXnWkDrY8Poa0LOFBlVcKpLDydw 1DJ68guoZCe/28bUWrZsMDlHB4DHXtTrM47otHBM78RpWm9AlhbuKP8eUMKERLTZw2P7 9z7WhNktQVeVVu3xi9fvhIqtCQ3W1a48AT+dlnx4fT5wYzoN/DS14uC/IiJTjatJN96j 02RrhotBC5VjOlChYsfM+xJhNxKr9yt/whUW0xDwFmy+IEnEdHANqwPTePN6DTwy6RPD Mb4ykwbf6DB5X2iPkfZfloUg4xWwE0167a4uXyEeRFpYl85I/IyZCv/g8U0Ekp0qv+Mj lnWw== X-Gm-Message-State: AGi0PuYuyVvWaKGRJ9BilgY/kC9nYRrR6y0ltj5g1r7u/TivTt+hyzYu vB8i6/suMOXkieZ0lc2HQwtKTGh/0PJCiH6tW0QJtsBuXXdf+If0SHl3sTQtSU/bBrjVH+5XzJy tWHgyznck4ixLPPSXMma1oNJZ04myEkQe3ILibAjykA== X-Received: by 2002:adf:f5cb:: with SMTP id k11mr11853748wrp.387.1586413692688; Wed, 08 Apr 2020 23:28:12 -0700 (PDT) X-Received: by 2002:adf:f5cb:: with SMTP id k11mr11853722wrp.387.1586413692360; Wed, 08 Apr 2020 23:28:12 -0700 (PDT) Received: from localhost (host123-127-dynamic.36-79-r.retail.telecomitalia.it. [79.36.127.123]) by smtp.gmail.com with ESMTPSA id l15sm2442959wmi.48.2020.04.08.23.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 23:28:11 -0700 (PDT) Date: Thu, 9 Apr 2020 08:28:10 +0200 From: Andrea Righi To: Kees Cook Cc: Shuah Khan , Thadeu Lima de Souza Cascardo , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kselftest/runner: avoid using timeout when timeout is disabled Message-ID: <20200409062810.GB49260@xps-13> References: <20200327093620.GB1223497@xps-13> <202003271208.0D9A3A48CC@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202003271208.0D9A3A48CC@keescook> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 12:28:05PM -0700, Kees Cook wrote: > On Fri, Mar 27, 2020 at 10:36:20AM +0100, Andrea Righi wrote: > > Avoid using /usr/bin/timeout unnecessarily if timeout is set to 0 > > (disabled) in the "settings" file for a specific test. > > That seems to be a reasonable optimization, sure. > > > NOTE: without this change (and adding timeout=0 in the corresponding > > settings file - tools/testing/selftests/seccomp/settings) the > > seccomp_bpf selftest is always failing with a timeout event during the > > syscall_restart step. > > This, however, is worrisome. I think there is something else wrong here. > I will investigate why the output of seccomp_bpf is weird when running > under the runner scripts. Hmmm. The output looks corrupted... > > -Kees Hi Kees, a quick update on this. After further investigation Cascardo (added in cc) found that the culprit of this issue was the usage of nanosleep() vs clock_nanosleep() in glibc. He already sent a fix for this: https://lkml.org/lkml/2020/4/8/968 Without this we are getting the following error: seccomp_bpf.c:2839:global.syscall_restart:Expected true (1) == WIFSTOPPED(status) (0) # global.syscall_restart: Test terminated by assertion I still think my timeout optimization patch can be useful, but for this particular problem we should definitely apply Cascardo's fix. Thanks, -Andrea > > > Signed-off-by: Andrea Righi > > --- > > tools/testing/selftests/kselftest/runner.sh | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh > > index e84d901f8567..2cd3c8def0f6 100644 > > --- a/tools/testing/selftests/kselftest/runner.sh > > +++ b/tools/testing/selftests/kselftest/runner.sh > > @@ -32,7 +32,7 @@ tap_prefix() > > tap_timeout() > > { > > # Make sure tests will time out if utility is available. > > - if [ -x /usr/bin/timeout ] ; then > > + if [ -x /usr/bin/timeout ] && [ $kselftest_timeout -gt 0 ] ; then > > /usr/bin/timeout "$kselftest_timeout" "$1" > > else > > "$1" > > -- > > 2.25.1 > > > > -- > Kees Cook