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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39123C433EF for ; Mon, 6 Dec 2021 21:12:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7B3B6B0089; Mon, 6 Dec 2021 16:12:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C2A166B008A; Mon, 6 Dec 2021 16:12:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACBD26B0092; Mon, 6 Dec 2021 16:12:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id 9DEB76B0089 for ; Mon, 6 Dec 2021 16:12:43 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6975D88488 for ; Mon, 6 Dec 2021 21:12:33 +0000 (UTC) X-FDA: 78888618186.24.0C83AFA Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) by imf01.hostedemail.com (Postfix) with ESMTP id 1344040005 for ; Mon, 6 Dec 2021 21:12:32 +0000 (UTC) Received: by mail-il1-f170.google.com with SMTP id j21so11639358ila.5 for ; Mon, 06 Dec 2021 13:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bvN4dyZ6ySRUU6I+5//n6rteuxKcOj9JtT0P4yYGfLg=; b=Jpv/phoH5Hdjr+tLNCKVnN8DIDBAOmr4or1p/skuZcLtwYXc4wMW/RadgxOnEG3UVA SM92rTQ2j2sV3DvHGgq9q0yjgDRnQ0XSTUZtWUVWIym8/M4221HNzNtdb+0jBi5OliqC IqnZ57jvNQLTejnVGw89M8vOPv3YBLJKcvyvl/vDGTuZwtE+eykAoCMnsLu6KynQ63Lq jmobxWqkNE1HxnVYrRWJS212lxVWBnVTkO8oJbQkKnQe3erfyPRFaZba4iq2SrkTu7Tq MNgDqw5Y9irzMTnfPdpIL6EYLavdyS5W2z/P57RwDp6jUpjZn7CjglXGfoebQGRA6wgS gavw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bvN4dyZ6ySRUU6I+5//n6rteuxKcOj9JtT0P4yYGfLg=; b=aqIF8xqMbVobII6Xd3YOqgiqLg2CjWV4EJEICHVAartyFedIsEYoyFSD5DbqWqwhz/ 4+yNl8Ol6e5+a0rFiJWS7VJP1D8ECTQslVkrKivS5wqSISPGKVxVnjr8u/QYnEQEwdee nLnJ9YjMxaKJzEJWn/KrQEEL3sUzrcw5bN9s9mV8lh9f4o40jELlF55G603i1smEJ1Wf QWLqR5LkYjbFnTG61n6T7Spa7XB3ZDwTwqsB07xUrme62yd7GMtQZZthjodGTXIMRe+l NEjbaFmIXCBcjMrzLlxW5fbANVJmWXBrWXSWBmg7rxgwSTcEJg12lyThYbeqOyKkq1jd rLPA== X-Gm-Message-State: AOAM53367NJ0jlwErzg2ha4TMXIg1xk4ImtMEw6XlWRtjZ3F8bZO7Bjz M0rL4JXrndkDZpxodlD4K3H8LeVmlq3lByE8rHI= X-Google-Smtp-Source: ABdhPJxGY+MbJ3JeKHuLeQpeIc+xVzMr6o8nqUAwkzsAkOu1dMKRMrs38r9nWPxq9NOg7D8njm/XkpgW/0CdJ+Ql9Xw= X-Received: by 2002:a92:ca4f:: with SMTP id q15mr35096921ilo.235.1638825152535; Mon, 06 Dec 2021 13:12:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Mon, 6 Dec 2021 22:12:21 +0100 Message-ID: Subject: Re: [PATCH 27/31] kasan, vmalloc: add vmalloc support to HW_TAGS To: Marco Elver Cc: andrey.konovalov@linux.dev, Alexander Potapenko , Catalin Marinas , Peter Collingbourne , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Andrew Morton , Linux Memory Management List , Will Deacon , Linux ARM , Evgenii Stepanov , LKML , Andrey Konovalov , Vincenzo Frascino Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1344040005 X-Stat-Signature: 4c15gdendhnhc3786788pfyrhb96cpay Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Jpv/phoH"; spf=pass (imf01.hostedemail.com: domain of andreyknvl@gmail.com designates 209.85.166.170 as permitted sender) smtp.mailfrom=andreyknvl@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638825152-13333 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 Fri, Dec 3, 2021 at 1:41 PM Marco Elver wrote: > > On Tue, Nov 30, 2021 at 11:08PM +0100, andrey.konovalov@linux.dev wrote: > > From: Andrey Konovalov > > > > This patch adds vmalloc tagging support to HW_TAGS KASAN. > > > > The key difference between HW_TAGS and the other two KASAN modes > > when it comes to vmalloc: HW_TAGS KASAN can only assign tags to > > physical memory. The other two modes have shadow memory covering > > every mapped virtual memory region. > > > > This patch makes __kasan_unpoison_vmalloc() for HW_TAGS KASAN: > > > > - Skip non-VM_ALLOC mappings as HW_TAGS KASAN can only tag a single > > mapping of normal physical memory; see the comment in the function. > > - Generate a random tag, tag the returned pointer and the allocation. > > - Propagate the tag into the page stucts to allow accesses through > > page_address(vmalloc_to_page()). > > > > The rest of vmalloc-related KASAN hooks are not needed: > > > > - The shadow-related ones are fully skipped. > > - __kasan_poison_vmalloc() is kept as a no-op with a comment. > > > > Poisoning of physical pages that are backing vmalloc() allocations > > is skipped via __GFP_SKIP_KASAN_UNPOISON: __kasan_unpoison_vmalloc() > > poisons them instead. > > > > Signed-off-by: Andrey Konovalov > > Co-developed-by: Vincenzo Frascino > > This is missing a Signed-off-by from Vincenzo. I didn't add it myself as the patch is significantly modified from its original version. I'll ask Vincenzo to review when I send v2. Thanks!