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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 D3DB1C2B9F4 for ; Thu, 17 Jun 2021 08:44:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CDE2610A3 for ; Thu, 17 Jun 2021 08:44:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CDE2610A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CFE686B0074; Thu, 17 Jun 2021 04:44:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CAD4D6B0075; Thu, 17 Jun 2021 04:44:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B76156B0078; Thu, 17 Jun 2021 04:44:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 84C146B0074 for ; Thu, 17 Jun 2021 04:44:02 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0D2168118520 for ; Thu, 17 Jun 2021 08:44:02 +0000 (UTC) X-FDA: 78262578324.22.4D33763 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by imf20.hostedemail.com (Postfix) with ESMTP id B161C546 for ; Thu, 17 Jun 2021 08:43:47 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id e22so2186821wrc.1 for ; Thu, 17 Jun 2021 01:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qse5cGxpg1Wx1K/bFNdJr9abCnEgN9q8mxTJmYsQZpY=; b=RKz7GWfEoYX/wB//GhA2SxpmZrhOz/Is37pPWrWzXguZKd7CXPjsZ4s7jqc9DhCjVH +D744kyllXPUmwoT2MsQ1Wj46SMJZ+NQ4JsKzo/HBgBdTMV0qBdEudSLO2zpoOxb217l z+yUfieKJm0Xvay4hafzUsmwM9iQKJpGuDLp487db7eF6QohcJHROgfKg9qAYYOHlroC EO/+QVAm5vWbDwGQadcJvKlmRZtM/PojwHH/yYy0J3vZF0sJkmSNIdVM2qWorDab1OJE STTJ1VcgXNk1smE+f1jijBz6UjPZ3TfL8fbRiolK5o5ufKhH/OO1OiXSQOePhcBBu0J+ mgZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qse5cGxpg1Wx1K/bFNdJr9abCnEgN9q8mxTJmYsQZpY=; b=t/XLWoIY3ZQ3t+a+A11kd4hPLyI3KOdVUcRDD2hXeHFTPFQaopyZ4Vmk8gJaiXBBK/ 2VuBcn2yP/53aFGxqRCJ0cAa/p5VLfjBtVcAZV9oYraOrTQ4xwlsGe/LCFgrYdoz+g04 0mm5YMH4krlMKFPxxDf2hmTQi6MJm9M0e+q8CEWo3DmGAnedSeAMa78ANaTdq+rjMw8W KNvOoIlMJVdFEoxOXOmbpzl7bQzDzDiCRzMvYaEbJyFJZMSRdyn2Ci4abd6Qj3PMxMEr TYwWlbT5Ff81T7h1XqclFp+iYJDsj3cHbTZGkcOA02zCTPz2sC5Pz4TFs3TUtm34zxw7 Tv9A== X-Gm-Message-State: AOAM5307ko6T6xvXCv40AFxP3eNufRb2utT2sFkftXtqtLmA7mSUzPTx KPSbKX3nka5jrYthwW8XiMBy7vlNewrlc4kFwZNdCg== X-Google-Smtp-Source: ABdhPJxOBpMutGoMuzup8QLNPLn8QcJqEWEo5782gvYAl8dZNlSDV39AzkhvczUy3q4r3U76ISw1EGO0x+5bYVo/XJo= X-Received: by 2002:a5d:5151:: with SMTP id u17mr4339152wrt.302.1623919440466; Thu, 17 Jun 2021 01:44:00 -0700 (PDT) MIME-Version: 1.0 References: <20210617081330.98629-1-dja@axtens.net> In-Reply-To: <20210617081330.98629-1-dja@axtens.net> From: David Gow Date: Thu, 17 Jun 2021 16:43:49 +0800 Message-ID: Subject: Re: [PATCH] mm/vmalloc: unbreak kasan vmalloc support To: Daniel Axtens Cc: Linux Kernel Mailing List , Linux Memory Management List , kasan-dev , Andrew Morton , Nicholas Piggin , Dmitry Vyukov , Andrey Konovalov , Uladzislau Rezki Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B161C546 X-Stat-Signature: cn11oi98r7hos718taebxsbopapmfjxe Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=RKz7GWfE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of davidgow@google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=davidgow@google.com X-HE-Tag: 1623919427-140884 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: On Thu, Jun 17, 2021 at 4:13 PM Daniel Axtens wrote: > > In commit 121e6f3258fe ("mm/vmalloc: hugepage vmalloc mappings"), > __vmalloc_node_range was changed such that __get_vm_area_node was no > longer called with the requested/real size of the vmalloc allocation, but > rather with a rounded-up size. > > This means that __get_vm_area_node called kasan_unpoision_vmalloc() with > a rounded up size rather than the real size. This led to it allowing > access to too much memory and so missing vmalloc OOBs and failing the > kasan kunit tests. > > Pass the real size and the desired shift into __get_vm_area_node. This > allows it to round up the size for the underlying allocators while > still unpoisioning the correct quantity of shadow memory. > > Adjust the other call-sites to pass in PAGE_SHIFT for the shift value. > > Cc: Nicholas Piggin > Cc: David Gow > Cc: Dmitry Vyukov > Cc: Andrey Konovalov > Cc: Uladzislau Rezki (Sony) > Link: https://bugzilla.kernel.org/show_bug.cgi?id=213335 > Fixes: 121e6f3258fe ("mm/vmalloc: hugepage vmalloc mappings") > Signed-off-by: Daniel Axtens > --- This fixes the KUnit test failure I was seeing on x86_64, thanks! Tested-by: David Gow Cheers, -- David