From patchwork Wed Sep 8 02:56:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12479913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 378C9C433F5 for ; Wed, 8 Sep 2021 02:56:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF89161100 for ; Wed, 8 Sep 2021 02:56:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DF89161100 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8A8A6940012; Tue, 7 Sep 2021 22:56:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 831CC900003; Tue, 7 Sep 2021 22:56:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74838940012; Tue, 7 Sep 2021 22:56:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id 5FBC1900003 for ; Tue, 7 Sep 2021 22:56:26 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 265E218037D2D for ; Wed, 8 Sep 2021 02:56:26 +0000 (UTC) X-FDA: 78562892772.34.584FD99 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP id DACD1F000090 for ; Wed, 8 Sep 2021 02:56:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EA04460E52; Wed, 8 Sep 2021 02:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1631069785; bh=LMVrL4u1pgI7/dU2FOoPOkpT2G7rhs/QDIntrBaSiks=; h=Date:From:To:Subject:In-Reply-To:From; b=s4wwewtSVduP6Un55xSzUfmyE39TTBL0VKCEgqG43Gufbdu4rG//33DxLarMjLVUb IMXl9RCPvn0tuc0awG0BvoS+rSYoDMpXKZIh+4QeutLvfBv1YVYSP+qyU1popkPoRX uyTrccxd3/m7t7dSFemabsl8vBmHRnihy9YPlDrM= Date: Tue, 07 Sep 2021 19:56:24 -0700 From: Andrew Morton To: akpm@linux-foundation.org, dvyukov@google.com, elver@google.com, glider@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, wangkefeng.wang@huawei.com Subject: [patch 062/147] kfence: test: fail fast if disabled at boot Message-ID: <20210908025624.GleAmQ9nK%akpm@linux-foundation.org> In-Reply-To: <20210907195226.14b1d22a07c085b22968b933@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: DACD1F000090 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=s4wwewtS; dmarc=none; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam01 X-Stat-Signature: rws7gccj463cjrroi3jhb9xgfqmr8jo6 X-HE-Tag: 1631069785-687499 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Marco Elver Subject: kfence: test: fail fast if disabled at boot Fail kfence_test fast if KFENCE was disabled at boot, instead of each test case trying several seconds to allocate from KFENCE and failing. KUnit will fail all test cases if kunit_suite::init returns an error. Even if KFENCE was disabled, we still want the test to fail, so that CI systems that parse KUnit output will alert on KFENCE being disabled (accidentally or otherwise). Link: https://lkml.kernel.org/r/20210825105533.1247922-1-elver@google.com Signed-off-by: Marco Elver Reported-by: Kefeng Wang Tested-by: Kefeng Wang Acked-by: Alexander Potapenko Cc: Dmitry Vyukov Signed-off-by: Andrew Morton --- mm/kfence/kfence_test.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/kfence/kfence_test.c~kfence-test-fail-fast-if-disabled-at-boot +++ a/mm/kfence/kfence_test.c @@ -789,6 +789,9 @@ static int test_init(struct kunit *test) unsigned long flags; int i; + if (!__kfence_pool) + return -EINVAL; + spin_lock_irqsave(&observed.lock, flags); for (i = 0; i < ARRAY_SIZE(observed.lines); i++) observed.lines[i][0] = '\0';