From patchwork Wed Aug 25 10:55:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12457257 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=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 D67CCC4320A for ; Wed, 25 Aug 2021 10:55:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6833B610F8 for ; Wed, 25 Aug 2021 10:55:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6833B610F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1736E6B0072; Wed, 25 Aug 2021 06:55:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1239B8D0001; Wed, 25 Aug 2021 06:55:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 039856B0074; Wed, 25 Aug 2021 06:55:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id E2F846B0072 for ; Wed, 25 Aug 2021 06:55:39 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8CD5C8249980 for ; Wed, 25 Aug 2021 10:55:39 +0000 (UTC) X-FDA: 78513297198.18.EBD43D4 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf21.hostedemail.com (Postfix) with ESMTP id 4EBDAD017843 for ; Wed, 25 Aug 2021 10:55:39 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id y188-20020a1c7dc5000000b002e80e0b2f87so2693758wmc.1 for ; Wed, 25 Aug 2021 03:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=FT34ZQ0Ankpx01UihRk2kfWuKXz7jz0lwTbW9XPKkoM=; b=EmPROQ7nz/pu/qgiO2t2bijHUR+Q/OThafpTk4NCpu0jFMJ48jvwy6gtN3TTIXusXw l9EH2nSd1lWvOMCxUUBHxv4CpdCYj2eeyuiNTQ2pFAYJ08MRI0qBCZ49rpsDbgkoUa7A MiKttpVTrZ7dDTnjOy5rdtXyBvgNdFH0MOsy0o+gEIjDFqLT6afw3oOBi3ppF+acGutW 0hVcSzySLhRochEnevooivVK6jsOjAKPzQS87uM0qEidjlELbKPAGMrks//Tr+hLkOmJ Zh67h+99c9wpR84EWUBwCCTxOuNZiQDwzvAg+v30WraHBzN2w9sgw+ZhUKAXUhZtqQ4F hHPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=FT34ZQ0Ankpx01UihRk2kfWuKXz7jz0lwTbW9XPKkoM=; b=MkDJndb2sYff4ketFQb+l9UXFMCkwJZJ7BbAJPJadKoMhboCiDQ47qPXWw+eCXQ8QV eKau1OuY/tcQjyUcwb2M5Kzpc8M/5LFgvAe33xMeTOIuwp1qYRXr5EprUASXciox4Ta3 bVrUVSLzAtdirb66OCZEoGslEuLsk4/LlicrkrWaQ5gYWxq3wjY9/UfoEIbKEhFqU6Xx Y8Wna1/kYRivtDJTKhPMuubPIOb6NIT6I9ejV2u1w+4bgh4UVphAfO1HYn4lx1OJ5rak 4eIeYYpQguDBekrd2cy56d2eZgLSfwb3jGRKFz3aqT7moShrfoJw4sMOHXOwGY2kxY3o avdw== X-Gm-Message-State: AOAM531t9ZF9mPLwGPE0mFSNpB6uJeoWL5XBKcF/qa8n7xGT0jFPhP+p SjJFYQNxljY1XkN1wQO+AyS6w9LaMQ== X-Google-Smtp-Source: ABdhPJwjv+hvsAexdUgXkmtXRGs+/Rg39W3ggk80Z2T4h/fTl7Zd2bQJnR16Dpt76+ox6JnqCUof/Y/31Q== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:2fcd:1452:4b71:155d]) (user=elver job=sendgmr) by 2002:a05:600c:3b0d:: with SMTP id m13mr74661wms.1.1629888937741; Wed, 25 Aug 2021 03:55:37 -0700 (PDT) Date: Wed, 25 Aug 2021 12:55:33 +0200 Message-Id: <20210825105533.1247922-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.rc2.250.ged5fa647cd-goog Subject: [PATCH] kfence: test: fail fast if disabled at boot From: Marco Elver To: elver@google.com, akpm@linux-foundation.org Cc: glider@google.com, dvyukov@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, Kefeng Wang Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=EmPROQ7n; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of 3qSEmYQUKCJQ29J2F4CC492.0CA96BIL-AA8Jy08.CF4@flex--elver.bounces.google.com designates 209.85.128.74 as permitted sender) smtp.mailfrom=3qSEmYQUKCJQ29J2F4CC492.0CA96BIL-AA8Jy08.CF4@flex--elver.bounces.google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4EBDAD017843 X-Stat-Signature: 3pwzd439z4nbzsh5z8pb1ozstn74qrqb X-HE-Tag: 1629888939-65902 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: 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). Reported-by: Kefeng Wang Signed-off-by: Marco Elver Acked-by: Alexander Potapenko --- mm/kfence/kfence_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c index eb6307c199ea..f1690cf54199 100644 --- a/mm/kfence/kfence_test.c +++ b/mm/kfence/kfence_test.c @@ -800,6 +800,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';