From patchwork Thu Jan 14 19:36:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12020801 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 42DABC433E0 for ; Thu, 14 Jan 2021 20:12:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E99C62310F for ; Thu, 14 Jan 2021 20:12:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E99C62310F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4s3NDDBnehKcv1R1oDdsgNHDMqIDt6ikTwbV9wed5W8=; b=258d11dW2mZYU74cgsYAYcfAh 93MUqodTF7OuMnnQ0ZidrNW7nSlVUUhQaUDUKfjUgvH/zO6+SST8etPGfERznpmfLfTkx+fOtqA2/ BZAi0uMNPwaEgAHRhMNqJ/z3RKpU/bY5+zEhWQm8BrEQ39+Z3G6MKP3RInfD0ttgOluNfwkKl0/q0 tBnT3/biJwPNlY1N2agGL3Cqdl/yW7unG6rfcjBVQHNXi8tfPQVQAf7cfEn/AXL7Mhrj2+gpuhW3H VkNqmW1h2DCNZAaktVECn1BQKfhCASf1kISxpg67vQetw8QGC0j0bZkkC4IsuFYrHiPiypi5b3Wae s+mwblVuw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08T3-0005KQ-4g; Thu, 14 Jan 2021 19:39:37 +0000 Received: from mail-ej1-x64a.google.com ([2a00:1450:4864:20::64a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l08Qj-0004NI-Cp for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2021 19:37:22 +0000 Received: by mail-ej1-x64a.google.com with SMTP id u15so2639391ejg.17 for ; Thu, 14 Jan 2021 11:37:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=zyyZOaAWvcuFygSPGgq4+eSGOnhBneBdiwht0viZDwY=; b=SxaVUGgJljdEYW2KnDIY5Z36fvF1kQ+Jd9n/RLgZ6Va4SRdJaBUgCybkyqNvuMHz0n a0eTmwREx91flHtnmJPxNH7YOcYtiPyvYyp7wcbqHyBJ8cmnTVt86JUzISdWmrtY/czM lXf9klmNGXOF/XpQd/y7icwO08Whw399GWpnc4xm0ya9eM+OorqEMiDM0SSXknJmf+F/ KuG/yXiY3PNIVQ/R80qCoAfZRIbq5xXqCRbvW46XdFxhhgj2y0aBHKfWSV07fz5DjwQG qtaY33hkeoDI2s4HZ+2rB4I4CYy3AArPXBB7uUfvsDyMjiob2X7TE6BRib6DZvFhQeRH cgMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zyyZOaAWvcuFygSPGgq4+eSGOnhBneBdiwht0viZDwY=; b=Whl+1jYGr+sk/uz2NukXugtKoySTAK9CJaxKfH3PWxl/mYzhgdnRQSwD54k05Jwgqw AD4tPX3+eB3ug8ay2NvoA3Zs4G1oLseHuBieH3nn6jz2+UNeJYiNv5NNyYhR0CYIqU2p ekuYutUsnp3SpiOZtBbeqrN0zR3jdlmp/txasru5ZcjSncQOMQMCvceRxTetHgfymcwW 1NLbjHhguTIUxpkE5qF8yu3gGg0grOGhOmJkoC/2v8jNSxSlZdPNxMSnxqYbBvwhOFL1 vqRn3A8zYsGf0PYwtsr8/SQgF5UfLnzwobNl5wcyf0TLouIerAku2l0tErGmWbOEFeOx OBnw== X-Gm-Message-State: AOAM533kSIxZR3MAHhtdvXTvR/7yDUYROrOQq2r0SlHdZ8wVdx5svdSq 513le2+B8jCIx92ogRs0adPOYQ8pSMxQg7HF X-Google-Smtp-Source: ABdhPJxy0qo3tzsnOX2RQoUCqx3Ms5p03cdSH3Wd2WdiGlkWhtJGIwz4DTMckIiPWn2La2MX6XpdaVtQSHzjEUTS X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:6402:379:: with SMTP id s25mr7276006edw.367.1610653029351; Thu, 14 Jan 2021 11:37:09 -0800 (PST) Date: Thu, 14 Jan 2021 20:36:31 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v3 15/15] kasan: don't run tests when KASAN is not enabled From: Andrey Konovalov To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210114_143713_550683_43B2B065 X-CRM114-Status: GOOD ( 11.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Branislav Rankov , Andrey Konovalov , Kevin Brodsky , Will Deacon , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Don't run KASAN tests when it's disabled with kasan.mode=off to avoid corrupting kernel memory. Link: https://linux-review.googlesource.com/id/I6447af436a69a94bfc35477f6bf4e2122948355e Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- lib/test_kasan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index a96376aa7293..6238b56127f8 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -47,6 +47,11 @@ static bool multishot; */ static int kasan_test_init(struct kunit *test) { + if (!kasan_enabled()) { + kunit_err(test, "can't run KASAN tests with KASAN disabled"); + return -1; + } + multishot = kasan_save_enable_multi_shot(); hw_set_tagging_report_once(false); return 0;