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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,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 218B8FA3728 for ; Thu, 17 Oct 2019 01:25:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA2CB21928 for ; Thu, 17 Oct 2019 01:25:25 +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="m1ApeOEB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA2CB21928 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 8F9AB8E0008; Wed, 16 Oct 2019 21:25:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AC6D8E0001; Wed, 16 Oct 2019 21:25:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7993E8E0008; Wed, 16 Oct 2019 21:25:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id 54F5F8E0001 for ; Wed, 16 Oct 2019 21:25:25 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id DECF6180ACEFC for ; Thu, 17 Oct 2019 01:25:24 +0000 (UTC) X-FDA: 76051533768.16.verse87_4c5451f7e1050 X-HE-Tag: verse87_4c5451f7e1050 X-Filterd-Recvd-Size: 4259 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Oct 2019 01:25:24 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id q24so270608plr.13 for ; Wed, 16 Oct 2019 18:25:24 -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=whmCcgz4VjZeRv6SREyqmZaNFMJpz8TJQeqtX9KJOOU=; b=m1ApeOEBceEitnwnVhSqb3qb8hNwH66tjcLagM1+mI6PFnNgrn5Dqs68VEyged3ZLe H/uKj71qyeGCmqzt29SEJYhu5OVDWqcQKVYk4MRoeokuQpyzBpo+zlze/ugO7ZWt0PW/ 0BZ4YdnuvAP9ZUNSyjzYEvtHn3WSIILR8Lnf4= 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=whmCcgz4VjZeRv6SREyqmZaNFMJpz8TJQeqtX9KJOOU=; b=rGXxyM/pHS1V5QCJERY9T4PbCMi0+svWSmD32KKj74eIsIludiMK1uNvatbO+2PvAi yX2+iDJ4PBhcN37H/dFalOwJ3YZTbJRs0+SCKb/zlAUgm55zyRPhkVIKc7ibx86Hcbs8 JwdeyjOH1Upo7UI89POsoKD4ILr5CGmCukH9C5z5OErRPHNLAIxd+rrGj+8fbyYo3zy7 tBsOU7F7+NWmI64fDLCqez7pg0bDdYm6SCc2Ytfq4fTiX9MGLdKQzx+ofgStaO+sYE1I KvfV/y1dabx2sN49d3dcHNhQ5UFyfw4JwhYbp2pqf3bCowiDUqUM/x//lcDIeEzKr+ac RMwg== X-Gm-Message-State: APjAAAUNi5APAfZHKUsHsabFJ52QvJFW/gNNomfXO4gtRHz/raIDuZSP C4vmMN0CSZmulERB5kbi9nS7qQ== X-Google-Smtp-Source: APXvYqwsR4962cnxMoM3dLvmhRD0TpVziHNmalYqRChEROjKsnzFNViD40UQgLnKTQ4n4Gd/NeT1qg== X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr1250860plp.129.1571275523512; Wed, 16 Oct 2019 18:25:23 -0700 (PDT) Received: from localhost (ppp167-251-205.static.internode.on.net. [59.167.251.205]) by smtp.gmail.com with ESMTPSA id 14sm340879pfn.21.2019.10.16.18.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 18:25:22 -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 v9 2/5] kasan: add test for vmalloc Date: Thu, 17 Oct 2019 12:25:03 +1100 Message-Id: <20191017012506.28503-3-dja@axtens.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017012506.28503-1-dja@axtens.net> References: <20191017012506.28503-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. Signed-off-by: Daniel Axtens -- v5: split out per Christophe Leroy --- lib/test_kasan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git lib/test_kasan.c lib/test_kasan.c index 49cc4d570a40..328d33beae36 100644 --- lib/test_kasan.c +++ 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