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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30C82C433EF for ; Tue, 7 Dec 2021 19:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236516AbhLGTuH (ORCPT ); Tue, 7 Dec 2021 14:50:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbhLGTuF (ORCPT ); Tue, 7 Dec 2021 14:50:05 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFC8C061574 for ; Tue, 7 Dec 2021 11:46:35 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id 15so116660ilq.2 for ; Tue, 07 Dec 2021 11:46:35 -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=UOHRGFoWJlaN8tZPy553Y82VWtjgN1BlER86UYqi7dc=; b=kbeI/w+qD4yKPDBLOU9Vb8XSOkuHvE3MWoFQK7gF82IjYoJnN7SeYJIwRVeZb9tODX wA71cTAgvLDHvNDwE45gipdH7SvuxJkdZnYLALmDjeeXtx7K/4A9Yf2qJ+KUw17gZQui os6iVP3dMXnU9ptd5TPR+HS3ApligrIj97yro5p6mKnD+NQ72HXFRB5SH+LpZRdR58ak c7aI953UpGxgWvHAcvuBqNkcw7C42RWArYGhU5I6ffNyc7juzDJRfRhe+DLoV4IQRzWN HGot5OlvIrvje74IKDd+bfVHkXteXbtDcxjDxroXNZzzLx3LZjx7Z6kL8knfN4URx3Lr Uq+w== 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=UOHRGFoWJlaN8tZPy553Y82VWtjgN1BlER86UYqi7dc=; b=YKyNwookvDelWW1mU9jwwh/LEpud584cU/bX3o2kwYf604NZ9laFiE0i6kmuJDVdpa LpqCUO+U07HS7opDyulWQ+nOrMf/D+NLaD1at1KAWOLdUY9bjPtpZ3QDN7GAlVA9RtBN ap6zRNtmVnZXDmXjGfpoIGek+NQPUK43jze01/jMOCOuiKh6hCbAVBYTSa14eRK377hS QdkhysSY5iNOR2csqM42xjXaDIiSOCX1UZGa91bNqVBZPb9e+Oi7Bzp19AWhJxRTtMN7 XVTrzfqS/ffS7cehXJoJjaMSnI96jH7LSD6nwwbh8AyDBHbuqXo7hihrGLCfLdxKabhc XvMQ== X-Gm-Message-State: AOAM5305bDJeqdbo/H1g6u1otm9nXdLfEynI6WXh147khlJBfqdoSC9A bU61O1iUHg+vOAgz2CUdvNTG1Y3lxAOlhG/RAuo= X-Google-Smtp-Source: ABdhPJxJJ/EuqkW4k0dLfegGojobOFNuQzz7lDAXMVGAZuN0AYbIsAoyzIAuef6gWMajyQlp1Dj1+WZjraixA7hWvbg= X-Received: by 2002:a05:6e02:1605:: with SMTP id t5mr1720750ilu.233.1638906394679; Tue, 07 Dec 2021 11:46:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Tue, 7 Dec 2021 20:46:24 +0100 Message-ID: Subject: Re: [PATCH v2 00/34] kasan, vmalloc, arm64: add vmalloc tagging support for SW/HW_TAGS To: andrey.konovalov@linux.dev Cc: Marco Elver , Alexander Potapenko , Vincenzo Frascino , Catalin Marinas , Peter Collingbourne , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Andrew Morton , Linux Memory Management List , Will Deacon , Mark Rutland , Linux ARM , Evgenii Stepanov , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 6, 2021 at 10:22 PM wrote: > > From: Andrey Konovalov > > Hi, > > This patchset adds vmalloc tagging support for SW_TAGS and HW_TAGS > KASAN modes. > > The tree with patches is available here: > > https://github.com/xairy/linux/tree/up-kasan-vmalloc-tags-v2 > > About half of patches are cleanups I went for along the way. None of > them seem to be important enough to go through stable, so I decided > not to split them out into separate patches/series. > > I'll keep the patchset based on the mainline for now. Once the > high-level issues are resolved, I'll rebase onto mm - there might be > a few conflicts right now. > > The patchset is partially based on an early version of the HW_TAGS > patchset by Vincenzo that had vmalloc support. Thus, I added a > Co-developed-by tag into a few patches. > > SW_TAGS vmalloc tagging support is straightforward. It reuses all of > the generic KASAN machinery, but uses shadow memory to store tags > instead of magic values. Naturally, vmalloc tagging requires adding > a few kasan_reset_tag() annotations to the vmalloc code. > > HW_TAGS vmalloc tagging support stands out. HW_TAGS KASAN is based on > Arm MTE, which can only assigns tags to physical memory. As a result, > HW_TAGS KASAN only tags vmalloc() allocations, which are backed by > page_alloc memory. It ignores vmap() and others. > > Changes in v1->v2: > - Move memory init for vmalloc() into vmalloc code for HW_TAGS KASAN. > - Minor fixes and code reshuffling, see patches for lists of changes. > > Thanks! FTR, I found a few issues with a tag propagating to PC (in BPF JIT and a few other places). Will address them in v3. 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 474A2C433F5 for ; Tue, 7 Dec 2021 19:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ivsqf7hWRzvmYP0fcputojhSNPGlBU6M3F3WU1ODRao=; b=Gz5O4Uvx4S2tEd hxQUmD/J80FjHnQqZz+hs/XdTa15i6ddAiBfZryuhK9HTevX4ND/XZng4gblWslFX0z7PQ8oFVj7A /n1l2ys/63fK0Pv50F1lN0rnlPvMVZEN7YVDtc8NvkxGrOw1FMymrw7QCXZ+1REwPV/flOudep1fU YHP6S9iAW0Rp6JPk8A9i83Wtsmzp6/QJFDVo11dsVOWrjNZfZ4YBlqFRbGfA/BeeYVz8clIex8SVJ RD5hZnS2TIWGxp7tzublekjBS6DUggJVJ/AyyVGogieDv8A8eK+/ldiLivB6tczPtBFQjrUPf+hFy LrNDRlls5ug3RP+5BVbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mugQB-009vT8-Ea; Tue, 07 Dec 2021 19:46:39 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mugQ7-009vSA-Ra for linux-arm-kernel@lists.infradead.org; Tue, 07 Dec 2021 19:46:37 +0000 Received: by mail-il1-x134.google.com with SMTP id m5so65073ilh.11 for ; Tue, 07 Dec 2021 11:46:35 -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=UOHRGFoWJlaN8tZPy553Y82VWtjgN1BlER86UYqi7dc=; b=kbeI/w+qD4yKPDBLOU9Vb8XSOkuHvE3MWoFQK7gF82IjYoJnN7SeYJIwRVeZb9tODX wA71cTAgvLDHvNDwE45gipdH7SvuxJkdZnYLALmDjeeXtx7K/4A9Yf2qJ+KUw17gZQui os6iVP3dMXnU9ptd5TPR+HS3ApligrIj97yro5p6mKnD+NQ72HXFRB5SH+LpZRdR58ak c7aI953UpGxgWvHAcvuBqNkcw7C42RWArYGhU5I6ffNyc7juzDJRfRhe+DLoV4IQRzWN HGot5OlvIrvje74IKDd+bfVHkXteXbtDcxjDxroXNZzzLx3LZjx7Z6kL8knfN4URx3Lr Uq+w== 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=UOHRGFoWJlaN8tZPy553Y82VWtjgN1BlER86UYqi7dc=; b=C7iPsye2uTxxlu55yogbWw7zwaqpQUEnPEqMUqDVZjfMJPLWIGaIG9s1dvo/ZMY/90 quojN3xR3tiiR2jelh7vP2iUpZs7ki/j9SZoigugA23A7aMeh6SCKc1bEh+c7MSYGyu4 Z/1gJrHPAWfKy/M3H7h8KEWgeQwFD64deP6D75AOqykT3WWKIzAFmP6YDp+egskXyY2O +oAIW0YG+iZeBvD32sAj3TIgHmJtl9BZLzmNpkEmE+Yb+EeTkL1HU0tyP8u6zde43N8u bGz5JjIPYwsAqUiGoZsfKrjVSKfUpU6WpyIecRvFDhXJh9E83iUzGYiHHOsk94uG1x5o b9Xg== X-Gm-Message-State: AOAM531lMED+thWangI0Eq+lPH8rE57fL7HSTZWun2+AANL/diIaQ2TP 54vQf8ApgHSsnbZvFv4PLhufOmcloRfgEO5TMUU= X-Google-Smtp-Source: ABdhPJxJJ/EuqkW4k0dLfegGojobOFNuQzz7lDAXMVGAZuN0AYbIsAoyzIAuef6gWMajyQlp1Dj1+WZjraixA7hWvbg= X-Received: by 2002:a05:6e02:1605:: with SMTP id t5mr1720750ilu.233.1638906394679; Tue, 07 Dec 2021 11:46:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Tue, 7 Dec 2021 20:46:24 +0100 Message-ID: Subject: Re: [PATCH v2 00/34] kasan, vmalloc, arm64: add vmalloc tagging support for SW/HW_TAGS To: andrey.konovalov@linux.dev Cc: Marco Elver , Alexander Potapenko , Vincenzo Frascino , Catalin Marinas , Peter Collingbourne , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Andrew Morton , Linux Memory Management List , Will Deacon , Mark Rutland , Linux ARM , Evgenii Stepanov , LKML , Andrey Konovalov X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211207_114635_912269_E5AD5BC4 X-CRM114-Status: GOOD ( 22.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 6, 2021 at 10:22 PM wrote: > > From: Andrey Konovalov > > Hi, > > This patchset adds vmalloc tagging support for SW_TAGS and HW_TAGS > KASAN modes. > > The tree with patches is available here: > > https://github.com/xairy/linux/tree/up-kasan-vmalloc-tags-v2 > > About half of patches are cleanups I went for along the way. None of > them seem to be important enough to go through stable, so I decided > not to split them out into separate patches/series. > > I'll keep the patchset based on the mainline for now. Once the > high-level issues are resolved, I'll rebase onto mm - there might be > a few conflicts right now. > > The patchset is partially based on an early version of the HW_TAGS > patchset by Vincenzo that had vmalloc support. Thus, I added a > Co-developed-by tag into a few patches. > > SW_TAGS vmalloc tagging support is straightforward. It reuses all of > the generic KASAN machinery, but uses shadow memory to store tags > instead of magic values. Naturally, vmalloc tagging requires adding > a few kasan_reset_tag() annotations to the vmalloc code. > > HW_TAGS vmalloc tagging support stands out. HW_TAGS KASAN is based on > Arm MTE, which can only assigns tags to physical memory. As a result, > HW_TAGS KASAN only tags vmalloc() allocations, which are backed by > page_alloc memory. It ignores vmap() and others. > > Changes in v1->v2: > - Move memory init for vmalloc() into vmalloc code for HW_TAGS KASAN. > - Minor fixes and code reshuffling, see patches for lists of changes. > > Thanks! FTR, I found a few issues with a tag propagating to PC (in BPF JIT and a few other places). Will address them in v3. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel