Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1303403imp; Fri, 22 Feb 2019 00:27:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IZKFCAQOuuAZew2bWSCFadMNE24JmWJNZvY4eEG2e8/AZcGE9+5942cUtj+xw8OFSqRW3dw X-Received: by 2002:a63:c64f:: with SMTP id x15mr2843255pgg.16.1550824057106; Fri, 22 Feb 2019 00:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550824057; cv=none; d=google.com; s=arc-20160816; b=xf8/jKvaF4R7Tk5y6dA1U/thXcvzSyZ4R+UfTV30LgpXW0remvSwt29y2IXs8MqZq3 RIQszghFLr62fXnJet7Ldntb+cYhETuiEjUGqrL7xj4hA4Gz1xx1NFQbJQ4OzntzmY8T YwHDSEvavLYx+i3dEr8Ef/O3CKcGN8qG1JMwfkg6xz+TGg6Ev8hNS4/Y1rTkcj/kKD9J 1ruMZxPY0F8KqYYG4oTBTkgUtTSRPZZYjS/BiqfygFB8rWukm31Ch7T9/vXfewEeI3SN NlmWbGQO+RrZxrLlLqKoMbK5fvbfoPOimeId28ID4Kg4kaoVkfjursh3MDyKXyz/59fg AN6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Juvo6YoafK7P9NBv3OsbnNSCijGL+nyK5BSklUU99wo=; b=fU/SbXRB5r7pUmDMQypGaXYu7p0uwTiCfQDkQPHp2yNY++Az0hfZdULTvBnt4OXosT 9FhJfCHNdRK/38irkcd4a+LOpfgwTJyPvPKU0PDe3hi7jirC/2XaVVVDglsohgvFlP8D bJCBygYAN/gewOVn2d60cBGBJJ/Gk5uiyY9zUs2jrzOwZFRgs0QnWRo1yD+uDe/hQ9MR 24vtXXajeKnz2roaVMxOnmdxpjALhOBZJD/D/QINpYxqQLGHOxMD3Ydne38Lh6vrzG8A I4dZzaTDpt3YfM+wPJ+MCXzEoPtNAJSZSssZheprEkXC1w8Vukp8+9V3BUkiIoFF2R6Z +pKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsTCGuPj; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a143si918604pfd.24.2019.02.22.00.27.21; Fri, 22 Feb 2019 00:27:37 -0800 (PST) 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=@linaro.org header.s=google header.b=zsTCGuPj; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbfBVIZp (ORCPT + 99 others); Fri, 22 Feb 2019 03:25:45 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:40395 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbfBVIZo (ORCPT ); Fri, 22 Feb 2019 03:25:44 -0500 Received: by mail-yb1-f194.google.com with SMTP id k2so537138ybk.7 for ; Fri, 22 Feb 2019 00:25:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Juvo6YoafK7P9NBv3OsbnNSCijGL+nyK5BSklUU99wo=; b=zsTCGuPj/YYjFDZrJrd0kzmOkMzLVn+tD02CZ4Xq0ROvNkjS86YLq0nYXkPjrSWbrW r6/EUjIJ4Ci5AZHKC0+UoqJnRUeGmYYg8V3QsNmppbZiI3FdH5Gy17ak2wxtI72VOKJh 810uMhhXb8I1DleqvpqkIidOMuLinvYXeg2w7wNyRFXAewZIYFLJ4I4aKuj/NB1tdcrn ByOQpmd+Yvw7TKj+q8AAQZhWgYNcdnSdeCH0eR9RvatGxAMjbfLQ3Z66Y8tsseNftoRW ona2P2HeZTDFqT4MteAHsnczj11/y5Cd4Z9Spe5WbzFUcyiocfCo/tilYCXuQpP7ATdm 5OwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Juvo6YoafK7P9NBv3OsbnNSCijGL+nyK5BSklUU99wo=; b=HaY2jqoYQOAapBoXhCqyMDNKJdRT+glZNnwpG1N9qd5fpdjNjsK/VOgOK0OVYbxTxR IfWRvCGf3HECkItnXCKRX4aiGOoDqZbrxjt8huuUoLbHfVCEgmYvnKfplNrUX3Y354e2 LIXIIK3CN8Y30NNAVvsiJJvbOF31Bu3O+oDDaqX0Kucg1jCEZ8mE8K8DrRPpadRLu+AP w1SOoarjlHsuwYezRq/9M+Gb0MN1aR1lFE8Uh3y9GDvywHVRxXPVcqNrBO9lZvnniyWE MzXx5xWGXAlx2WIo6PoODqNXOa3NiUjI11pB4Be9MeISE0N6Zlkdh3lIX80NcMg2JaZA 0hFw== X-Gm-Message-State: AHQUAubPZjqzLRSFjyQxar1PxXOTz2FJxMpnzXS9UiC7jWPuiVKGNa7C dEjbB4VITqbzBkd3tlFVHUFjV3YXKa7bEN5bAOYwHg== X-Received: by 2002:a25:d94:: with SMTP id 142mr2319596ybn.256.1550823943784; Fri, 22 Feb 2019 00:25:43 -0800 (PST) MIME-Version: 1.0 References: <20190221084425.9574-1-anders.roxell@linaro.org> In-Reply-To: From: Anders Roxell Date: Fri, 22 Feb 2019 09:25:32 +0100 Message-ID: Subject: Re: [PATCH] bpf: test_bpf: turn of preemption in function __run_once To: Daniel Borkmann Cc: Alexei Starovoitov , Networking , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Feb 2019 at 16:38, Daniel Borkmann wrote: > > On 02/21/2019 09:44 AM, Anders Roxell wrote: > > When running test seccomp_bpf the following splat occurs: > > > > [ RUN ] global.secseccomp_bpf.c:2136:global.detect_seccomp_filter_flags:Expected 22 (22) == (*__errno_location ()) (14) > > seccomp_bpf.c:2138:global.detect_seccomp_filter_flags:Failed to detect that an unknown > > filter flag (0x8) is unsupported! Does a new flag need to be added to this test? > > [ 2155.677841] BUG: assuming atomic context at kernel/seccomp.c:271 > > [ 2155.689351] in_atomic(): 0, irqs_disabled(): 0, pid: 28540, name: seccomp_bpf > > [ 2155.696597] INFO: lockdep is turned off. > > [ 2155.700605] CPU: 5 PID: 28540 Comm: seccomp_bpf Tainted: G W 5.0.0-rc7-next-20190220 #1 > > [ 2155.709972] Hardware name: HiKey Development Board (DT) > > [ 2155.715232] Call trace: > > [ 2155.717710] dump_backtrace+0x0/0x160 > > [ 2155.721399] show_stack+0x24/0x30 > > [ 2155.724742] dump_stack+0xc8/0x114 > > [ 2155.728172] __cant_sleep+0xf0/0x108 > > [ 2155.731777] __seccomp_filter+0x8c/0x5c8 > > [ 2155.735727] __secure_computing+0x4c/0xe8 > > [ 2155.739767] syscall_trace_enter+0xf8/0x2b8 > > [ 2155.743982] el0_svc_common+0xf0/0x130 > > [ 2155.747758] el0_svc_handler+0x38/0x78 > > [ 2155.751534] el0_svc+0x8/0xc > > > > Rework so that preemption is disabled when we loop over function > > 'BPF_PROG_RUN(...)'. > > Commit 568f196756ad ("bpf: check that BPF programs run with preemption disabled") > > highlighted the issue. > > > > Suggested-by: Arnd Bergmann > > Signed-off-by: Anders Roxell > > Hmm, wrong commit description? urgh, you are correct. I'm sorry. Sending a v2 shortly. > Below code is not related to seccomp > but rather BPF test suite. Could you fix it up and resubmit? Rest > looks okay to me. > > > --- > > lib/test_bpf.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/lib/test_bpf.c b/lib/test_bpf.c > > index f3e570722a7e..0845f635f404 100644 > > --- a/lib/test_bpf.c > > +++ b/lib/test_bpf.c > > @@ -6668,12 +6668,14 @@ static int __run_one(const struct bpf_prog *fp, const void *data, > > u64 start, finish; > > int ret = 0, i; > > > > + preempt_disable(); > > start = ktime_get_ns(); > > > > for (i = 0; i < runs; i++) > > ret = BPF_PROG_RUN(fp, data); > > > > finish = ktime_get_ns(); > > + preempt_enable(); > > > > *duration = finish - start; > > do_div(*duration, runs); > > >