Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp604390imp; Thu, 21 Feb 2019 07:38:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IYDvKSEJwts5UC0JNQLEZQBmpo0VPv5+UlCLWIBshLTzjfd0P59bnxQA3BNe5DJNehmHbax X-Received: by 2002:a17:902:29ab:: with SMTP id h40mr43181401plb.238.1550763521223; Thu, 21 Feb 2019 07:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550763521; cv=none; d=google.com; s=arc-20160816; b=Krq61X4w94wvGM0Uj7mrHoGDrOdkKxRrw9PZ70s30tgh/QdRmmjfkH4wf1Oegkjozz BZh2vV8z/dWEDwbhmvFI8w1SjlfQb6KbZTvGLo0UaQ2jXFNAYcNUFNMqgFCXM0N56Ni7 81agsLiwv52Lf2V5tEni0J0ln+RIIxfHEBGEzUeHokbDn9o88J17SKRa11wD5/VW8xSf rX45F12E+jIebmfab2b0PJ//kOOcAKVH5/NNmRNJQbs2+pG4GvTMA5qrgZrWP2JOIZzp gsPzUrhVCyfS/YLzE9LUUhsLZ/MRZwdQsGfjH8EZJniJLjnf9vK2kRE2FUSrduR4xcIu kzFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0rdbB5yxN6/WD38ViyIP5HdeJ7xGuaiVhOsL+Xw/ql4=; b=o01LyVqMVj/zFfUwKgYMi9ZdqUDbk80m6CFNzwmIW5BaVNp8JtpIofs4b3HD09Nogj D53Cqmb0c3eniWiG/Jkpz6QbeysQLP2i+sQONyM79juhlDkLzfR/MZw2scNUTogkl0CT rd7rFFC8DQFwbTZ7/KHogKKq+kbhS5T7GNb/1bRu8eurjUIJ58tUE5903cWzW1VPbHgW f+cV/63RfLMF494QAK+TixUXy95Y+P7LO1fLv+n8AgOtx/BZH/6oEFMJ4mXMHJq7scaZ wKFc+2sTX92rFRWaUF8fp+Cb50wK3DFuybPXlLeM5+y69jyHbvLou51ptjF4Y+scw70F JI+A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si799757pll.437.2019.02.21.07.38.25; Thu, 21 Feb 2019 07:38:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727389AbfBUPiC (ORCPT + 99 others); Thu, 21 Feb 2019 10:38:02 -0500 Received: from www62.your-server.de ([213.133.104.62]:38864 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbfBUPiB (ORCPT ); Thu, 21 Feb 2019 10:38:01 -0500 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gwqQB-0007cS-UB; Thu, 21 Feb 2019 16:37:59 +0100 Received: from [178.197.248.36] (helo=linux.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gwqQB-0003zP-KT; Thu, 21 Feb 2019 16:37:59 +0100 Subject: Re: [PATCH] bpf: test_bpf: turn of preemption in function __run_once To: Anders Roxell , ast@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190221084425.9574-1-anders.roxell@linaro.org> From: Daniel Borkmann Message-ID: Date: Thu, 21 Feb 2019 16:37:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190221084425.9574-1-anders.roxell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.2/25367/Thu Feb 21 14:02:13 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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); >