From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 C2BB0CA9ED0 for ; Thu, 31 Oct 2019 09:39:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E1BC2083E for ; Thu, 31 Oct 2019 09:39:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="WNnsrZjR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E1BC2083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A45706B000C; Thu, 31 Oct 2019 05:39:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F5036B000D; Thu, 31 Oct 2019 05:39:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E4216B000E; Thu, 31 Oct 2019 05:39:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id 5FE2E6B000C for ; Thu, 31 Oct 2019 05:39:26 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id EB58F8249980 for ; Thu, 31 Oct 2019 09:39:25 +0000 (UTC) X-FDA: 76103581890.11.month73_6f6ae5b4b2e0d X-HE-Tag: month73_6f6ae5b4b2e0d X-Filterd-Recvd-Size: 4379 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Thu, 31 Oct 2019 09:39:25 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id x28so766034pfo.6 for ; Thu, 31 Oct 2019 02:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bVXjkvYDDmbnxsC38vuCWt+2DP5YT7XnHdrJpHAvWR8=; b=WNnsrZjRTgHN6z6qKlm3PPgDZ1DUQyGBME1hqttIlhCsP6pp51i+VPTsPipTm3KOvJ GEptraycQIRKuAP1Hj9aeVXUefmzwkWW5fefm1hacJjRHsvlIYfTLhVRVB97p5euRlwi jr0ph8pnjBiRogObdVC2UZwlO/vOSBdYij0G4= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bVXjkvYDDmbnxsC38vuCWt+2DP5YT7XnHdrJpHAvWR8=; b=SzeVrceSP97OPQcNdYZx0nIRH9iAOhPMkrK4KHwyTVE/+I0AvDEoQzKyZ1Gf2qv3/h +Hg7Ahc0sZTPX6dzspjZEn+IWcwZDG0LR9WchAAlSPGNYW6nJjZNXZJg0IQptUy6lDI4 BHZOxh51g0SjTU2wFo8A2kEKy/wPfirL5/LGisETpPmZJR1c/SzjJ/2C5xxCRZKylp2Y Q6uHFNIkO8rXC7pcsQw5zq8lSksMql6Sp8ITLKBBDmmsD/xrsmYN1MJlbAq5P1NBwMgl FURgnR/YJLgx0ZinnVOjjaJ8LUvAANn3KHaNHFrEK/Ww5j8ODy+va0kalqyugUNa2zQr txUg== X-Gm-Message-State: APjAAAXbhHcWi2YwAecQzOpefHE/q/fgfTM5YAM4x9W9WOycHnx3b6jI LzodhOfQq54iLXfY8M9zXgk58Q== X-Google-Smtp-Source: APXvYqzVRXl1zQigZoY89DcUqTx/QAdcydg/VNoN51Ltb+z4DjNulE5WAl6UPNAKeADCABZ+amSUTQ== X-Received: by 2002:a17:90a:1f4b:: with SMTP id y11mr5863515pjy.123.1572514764668; Thu, 31 Oct 2019 02:39:24 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-783a-2bb9-f7cb-7c3c.static.ipv6.internode.on.net. [2001:44b8:1113:6700:783a:2bb9:f7cb:7c3c]) by smtp.gmail.com with ESMTPSA id n15sm2785042pfq.146.2019.10.31.02.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 02:39:23 -0700 (PDT) From: Daniel Axtens To: kasan-dev@googlegroups.com, linux-mm@kvack.org, x86@kernel.org, aryabinin@virtuozzo.com, glider@google.com, luto@kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, dvyukov@google.com, christophe.leroy@c-s.fr Cc: linuxppc-dev@lists.ozlabs.org, gor@linux.ibm.com, Daniel Axtens Subject: [PATCH v11 2/4] kasan: add test for vmalloc Date: Thu, 31 Oct 2019 20:39:07 +1100 Message-Id: <20191031093909.9228-3-dja@axtens.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191031093909.9228-1-dja@axtens.net> References: <20191031093909.9228-1-dja@axtens.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Test kasan vmalloc support by adding a new test to the module. Reviewed-by: Andrey Ryabinin Signed-off-by: Daniel Axtens -- v5: split out per Christophe Leroy --- lib/test_kasan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 49cc4d570a40..328d33beae36 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include =20 @@ -748,6 +749,30 @@ static noinline void __init kmalloc_double_kzfree(vo= id) kzfree(ptr); } =20 +#ifdef CONFIG_KASAN_VMALLOC +static noinline void __init vmalloc_oob(void) +{ + void *area; + + pr_info("vmalloc out-of-bounds\n"); + + /* + * We have to be careful not to hit the guard page. + * The MMU will catch that and crash us. + */ + area =3D vmalloc(3000); + if (!area) { + pr_err("Allocation failed\n"); + return; + } + + ((volatile char *)area)[3100]; + vfree(area); +} +#else +static void __init vmalloc_oob(void) {} +#endif + static int __init kmalloc_tests_init(void) { /* @@ -793,6 +818,7 @@ static int __init kmalloc_tests_init(void) kasan_strings(); kasan_bitops(); kmalloc_double_kzfree(); + vmalloc_oob(); =20 kasan_restore_multi_shot(multishot); =20 --=20 2.20.1