Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp950303ybb; Fri, 10 Apr 2020 13:34:29 -0700 (PDT) X-Google-Smtp-Source: APiQypIw1hkJO/LUbdDSQWwx+P1jH1iPLXcb2LMVUUloAF27duu9cNeA/XqMyaCe4T3huboLMEYP X-Received: by 2002:a37:a353:: with SMTP id m80mr5812753qke.398.1586550869208; Fri, 10 Apr 2020 13:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586550869; cv=none; d=google.com; s=arc-20160816; b=Q9ymgFnN68mpIgz/LOjrDg+vvK9MRpARWBzcf8N3K59Tnt+pgYR29EMTHwsjVHd9+6 sncRVN2BYBPHVtB68fHuq8vWnMOF/LZyssnxm1sluyVrQR3pxuqACp4dZzq6AlM+VPGz 9OOQD8M3JmlViHI89SorgBX5mkf0ofdDV6EDNvU5nGi3dLwFygsSQcTf7TucI059M/SZ StRI9RrKD5WD3xFAN2K9xotolimCK1ogWZTrZ3G9AIgOoFf8qdR+0uzlmRDXL9x1jJhg nd/QDPLnzwhqkq5vbCT0cNrXW5tnoLptSLehgXgpgetcB0aW2G1hKyyC5zaYmzGUtf2h w9WA== 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 :dkim-signature; bh=3VeSa8pV4LRZev++4MmnF0GN7JR51rFLh2o6ZJifmAs=; b=UAXMxQ0vC87IxNt1MtYTc+xpspoodYIhdMKczJPisH1zK8MUCH595YVG2OlbIyys1C h/pwpG/m0E9adKl6ccJeohter6M60M+9t0gMULekCZaBpkK4IHPjlYhlwixHaqLTMe7D 0E0wdhJcK9b3ChZ0GI7Et8A2JYmAdW9S4KwmYIl5F6pJ6hfsa9ODJXqwXyvtwWeKU7O+ zYrQ9vfiDqPjXlYgwTxrnL41yfC7HmO4jFygalmfFnHXMWrll1FKy8jwbQprrtA7+aKQ nis5bceV5SlNSSrPOMckImw1Ae4efGyNKkb9Xc0DQKVB88IyhmQ7iXT4f6efBXfBc6Es eMsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jrzlTQ4z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si1695609qtp.275.2020.04.10.13.34.13; Fri, 10 Apr 2020 13:34:29 -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; dkim=pass header.i=@chromium.org header.s=google header.b=jrzlTQ4z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbgDJUdW (ORCPT + 99 others); Fri, 10 Apr 2020 16:33:22 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36766 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbgDJUdW (ORCPT ); Fri, 10 Apr 2020 16:33:22 -0400 Received: by mail-pf1-f196.google.com with SMTP id n10so1499145pff.3 for ; Fri, 10 Apr 2020 13:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3VeSa8pV4LRZev++4MmnF0GN7JR51rFLh2o6ZJifmAs=; b=jrzlTQ4zdnZt7yMEIDuwDMWO3hz3GVEpyJPo5quceb4/5aZLT5RQmyhbVKwifjEEUG hURrfWz3QIOt/M/ZYhkHMhC6hKM11ZkN4eNEJM+OnVnsoZKW6aWbFSXinKOjgS1VdfLc XzE74MI0cKHp4GYbHA/Z7kI+HejX/8cS+hYqo= 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=3VeSa8pV4LRZev++4MmnF0GN7JR51rFLh2o6ZJifmAs=; b=XzdtOiOTdtawZdH3Cj8XOKn02Z62IG2rBBPk0P93yQcSUDQgU6qUpvvaGlYyo0jto+ x1UGJVXf5OgXGGsLFkLKpHMYbYJYZ/reUYJ1/LuiDI+oZA3AkGJ2MLPVXzCJgZ06ENbt DttdI1vXiLPtB1kmcnym62z/Q6ydaPPudUwRgqhlyiMi7TkXwh1EfHW/c2U/Rx1lbl4y 8ojHDhxy6U2bVEXnPOpCML2YRdQeFnGwYh7MZjKO3pkp6NIo66xNLVs0GCXZDRZ0NCQw yCTR6uP/I4S0kAEZAbhgI7PYgLPzHMtBpPT2OIqVlXz8GGtiOqiiigtoL4HdYRwmHdHg QBmw== X-Gm-Message-State: AGi0PubEBXRiMfLnedy3GYVwVx/uV3xGQa6a92Erqs6ZTuj4y8vn+yuT Hqv4tCrdslZmRw9PhLBqIlU5bQ== X-Received: by 2002:a63:cd03:: with SMTP id i3mr5827120pgg.395.1586550801789; Fri, 10 Apr 2020 13:33:21 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c15sm2214815pgk.66.2020.04.10.13.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 13:33:20 -0700 (PDT) Date: Fri, 10 Apr 2020 13:33:19 -0700 From: Kees Cook To: Andrea Righi Cc: Shuah Khan , Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kselftest/runner: allow to properly deliver signals to tests Message-ID: <202004101330.1E1963B5C2@keescook> References: <20200410100259.GA457752@xps-13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200410100259.GA457752@xps-13> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 10, 2020 at 12:02:59PM +0200, Andrea Righi wrote: > While running seccomp_bpf, kill_after_ptrace() gets stuck if we run it > via /usr/bin/timeout (that is the default), until the timeout expires. > > This is because /usr/bin/timeout is preventing to properly deliver > signals to ptrace'd children (SIGSYS in this case). > > This problem can be easily reproduced by running: > > $ sudo make TARGETS=seccomp kselftest > ... > > # [ RUN ] TRACE_syscall.skip_a# > not ok 1 selftests: seccomp: seccomp_bpf # TIMEOUT > > The test is hanging at this point until the timeout expires and then it > reports the timeout error. > > Prevent this problem by passing --foreground to /usr/bin/timeout, > allowing to properly deliver signals to children processes. Interesting! This seems a poor behavior on "timeout"'s part. Is it setting a signal mask? Hmpf. Thanks for tracking this down! This seems like the best solution now, so: Acked-by: Kees Cook -Kees > > 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..676b3a8b114d 100644 > --- a/tools/testing/selftests/kselftest/runner.sh > +++ b/tools/testing/selftests/kselftest/runner.sh > @@ -33,7 +33,7 @@ tap_timeout() > { > # Make sure tests will time out if utility is available. > if [ -x /usr/bin/timeout ] ; then > - /usr/bin/timeout "$kselftest_timeout" "$1" > + /usr/bin/timeout --foreground "$kselftest_timeout" "$1" > else > "$1" > fi > -- > 2.25.1 > -- Kees Cook