From patchwork Thu Feb 21 08:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 158876 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp230566jaa; Thu, 21 Feb 2019 00:44:35 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibg1oK159meGd1YBZLnAJYqFv3M7OvPtQz45USNGYePJYh+r/qinTNQ9l0kPZ05vRLhK+cM X-Received: by 2002:a62:6453:: with SMTP id y80mr38871010pfb.203.1550738675884; Thu, 21 Feb 2019 00:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550738675; cv=none; d=google.com; s=arc-20160816; b=qZf/bZjqBxI1tjkMFddbMFzICHLZgehbDSz3nj2XZphjSu2q4Qlfq1XZAQbH1uxgZ0 m4TNcbyIXnJIVLrkSN8zidKby3ZA/EZEn/QQc2t5Orl7XSQ3D4E9+E9jSXzGz6wAPyds fpXkGvZGPAeznDYbeg4yJqTnzssH8vSUAaU4OboSonW/Bi49F/8WnSPLyV5qRpG2IuP7 JjxSmjQMwPvpimhFJgcHbayOQHU8X0wbcLLW0khNXHHeNNo6DeFtSZChBv6k1YUwrsqg 0GgN/++FJrL6X4h/yhMzKNFDSsEObNPh7wstVWdSh+C17+vKqrDF4XApCXS9jkTsAVW3 Q/Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=X1MR8AIWsbNV2CcMMAD/646Fti2Myq2Tmqq34opOOuM=; b=tHeSl15NeezuHL6ZoKXT6dm9oRYUbvurjy0LfKJ5xzOFvYVjSrgx4h7VJBaXu8kXkA /ow0iwHlTmKL8Da8aRDiKzkNJQPT7OgEij/2xONFXPKz6G+LjGhESbLRBLA6dxoxzNan lJ2hHoT9l+kExG4AQdoAM8cBA31jt8647029rrLC4jr3eyETCKBLzuw3Lh1s0cgsiIvT jSABtlpFzxTodEQDpApYgKIRaGhfAiNqyyF6jahiul+9TTSB7GYFqJGbmXBuQWrgh063 QT9V4gYaPT7PW78L/O0Y1kCw7dxUisgMFFWbjnl7v1NeCsYw3I/J/tBcZkc6nlu8na8N wVjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MWAObh/D"; 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 g186si14906851pgc.586.2019.02.21.00.44.34; Thu, 21 Feb 2019 00:44:35 -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="MWAObh/D"; 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 S1727459AbfBUIoc (ORCPT + 32 others); Thu, 21 Feb 2019 03:44:32 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44296 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbfBUIoc (ORCPT ); Thu, 21 Feb 2019 03:44:32 -0500 Received: by mail-lj1-f195.google.com with SMTP id q128so23217844ljb.11 for ; Thu, 21 Feb 2019 00:44:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=X1MR8AIWsbNV2CcMMAD/646Fti2Myq2Tmqq34opOOuM=; b=MWAObh/Dvjbx2/u9wwuhuPlBNktImMkZTbQCxhlZC5jTjXSUgb5WfQ/m882bfHese3 NoSBymAnEybCphLht3iUOjJ8KPq5WhBziF8l1+hBtClQSpwotqvi1c6lBwKhmWcAgEuP aOP//T66Q2uF0c4+pRjf+ilAfKov7EeasYoPZAMiVEh+gL5kPZPnF06pZ/NeidTNKb5C NBcRy0Mf3j7ZM82ITklVa+KBuSIg0O1+xxF3A6bbIQLufZ+tlzJkTXg/uGC7RSUab2lU mIbyd3llwgQ3mAXU8f9j2RmbeX4RFTI+ONL5YdBDqaxBG86NNu44kcN+ktTTiJ2r6trP U+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=X1MR8AIWsbNV2CcMMAD/646Fti2Myq2Tmqq34opOOuM=; b=tiW8g7rXe+ifmhFphimNNEVA6eb+A/VEsb4cVcyWqzGlcK0E2hDkZuY3tHlO1qXJxS DxkGYzA/tzP8gnwkBdNMC83JMnqsFPa/3egjgGjpQBbaOyOOIgUQURWAVKOhWyWKGOd5 eNshRvZtLb929vW1svQ57fZiRLHmyPIJf2zvABUdz8rNzVL7nkpLty5i3xu9wRetZu9P wUbjyw3Ozu8BbQ/apmWmOvCka/SA88IP9jLnGGRxJLaIFyZcw6fYpSeZ+VnFdRQKorem a2ar+9wvFAPdIRneEPckjRsxV95AxzUSdTVEQdwt/82+Ym3JdmpQ0tKfjx2Y9+2RW+RX zVlQ== X-Gm-Message-State: AHQUAuakRnytmn0z1z2ylnCL1IBHagBAQ8pwGm8Wvqi5mk3JqEOsJwOQ HwQ8Oz0Nvs0aexWLxeq6InKHj44NGeI= X-Received: by 2002:a2e:80d6:: with SMTP id r22mr14482869ljg.148.1550738669973; Thu, 21 Feb 2019 00:44:29 -0800 (PST) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id x62sm2826866lfd.51.2019.02.21.00.44.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 00:44:29 -0800 (PST) From: Anders Roxell To: ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH] bpf: test_bpf: turn of preemption in function __run_once Date: Thu, 21 Feb 2019 09:44:25 +0100 Message-Id: <20190221084425.9574-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- lib/test_bpf.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.11.0 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);