Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp868529imm; Fri, 29 Jun 2018 07:42:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKId+smO0C24FdHn7DlO8BGu4v55vjVEvAOodHDEgYe/K896Dm6YgCcLn+KPdtn5x+UdYBQC X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr15198684pld.118.1530283343239; Fri, 29 Jun 2018 07:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530283343; cv=none; d=google.com; s=arc-20160816; b=witlSSb0PvJRGwRwqaDgQpqZjpwCMrZZNAjziRcw0IjFPflREpbogFc1inL6GB12S4 zMSROIxkr5d/ebKzUnM2EPrmxZhTAgy1nYl75Bwnblwtj2XPKa5MHIRZncXI4PJzmM/9 PyIbBQCB1IbULckeOZwUGVHKniKxCz1cxhhNtc+joZqb9vxSnhp3Cj1yXbJ/u02jhlEF +v4wHAiTqEKwdtks7KVRi6C5OKMDd6v11jY8R2dZ2B8A9/awuGvQ2VABDOKWJU6p/NJD qLSM8NKY4Miw6V3q3X1r8NvLggQtqGBBQ6ESgl4SQgZUWt0QK+nQc9PfTyzL9e5Os17S 17dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=q6EyTGd2x9sRvsPPcqRYANFsVkUOYj+D/qstNYmA4GU=; b=w8JJoyNHwqB2P0Fmgg5vtGR6R1avzh8OiV0qfR2MV47XPtQg9hl5/apXX0x6CubIvt 0L6Uta82NH0XbH+ViIyYFfZD25U0s84b1VIeXkGjBKSk/lYfhHJW9M8qBK7QVD9yIvS/ 2rv4eH4FwH9Uooncb9DbwY9+/ruJc3+TjZ8siRCuPb33L7GkeJgMvyewTKXlum20Ju7J cDw63P0EU8YuI3tkskPIFI/lHUfjFVCRsFgn6sY1tQKKnK0uXkc2pBNOhT6zP4LfYxeQ 6TmItEn2jaaRsvbDNQ01y1elTkFxaykTQs5MYKmMHVKjLlWV92Eq165yXx7mLzIIjOE3 4g9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nfg9fmC5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2-v6si8358192pge.633.2018.06.29.07.42.08; Fri, 29 Jun 2018 07:42:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nfg9fmC5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932480AbeF2Ok0 (ORCPT + 99 others); Fri, 29 Jun 2018 10:40:26 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:39003 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933674AbeF2OkW (ORCPT ); Fri, 29 Jun 2018 10:40:22 -0400 Received: by mail-it0-f68.google.com with SMTP id p185-v6so3171474itp.4 for ; Fri, 29 Jun 2018 07:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=q6EyTGd2x9sRvsPPcqRYANFsVkUOYj+D/qstNYmA4GU=; b=Nfg9fmC5Oc3STiqhNLuCPCsCEV8+sk42j51g0jVJgX43VIf1koqzKghuvb0+CNMR1q yKWoxTDVShV6NQmQ26wU5BwZKCfTH6+h2VCBkUqF7ZCNICFneEHA31+UiQyo/DKbiIdu iTRMQJvkPjzQnpIOD5mQ2vPcg+9+fQYNJzp7AoahMNDInPKzLzoqdlYRvLOh7dUh00dx dtgPPEkhTP4JhDYsAx4OxWXf7lntECdl2KU1U3TYvLTZUKZH04G8vtKmRBwaRmGWop7b 9fJP+HAuRHamt1GFufJ9J8Oo2SOL2urTTE6hIk63C+4VKSwlq6TZjMwIv+WVJ2HhX6h0 qA7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=q6EyTGd2x9sRvsPPcqRYANFsVkUOYj+D/qstNYmA4GU=; b=SGTPsryEoN7mGF47/+HLIK8u4bhLiAG2hPezzopzrWrRdRSindqkTvNvu7x+JNHZRL QWw9cxuWQbvEvoZo6/OX0o/sfJjaxGdbf/gvLOmwMadaEVTgOL4ak6r8iFEKd8Z4v581 l09vFxACDxZzAnN1y8DGh4r+jQPrgZzm4uBmoCdD1O9JTeWl4ubkU0fw1plQ6HVK2UvH TFjXQYOqyIH7qHRqj20dYNLSf/jE9CZJutm5diP3mxTUQmz6GtMS4hgZ7kr/krvp+lqG ZZ8MSqw046NM4FiNmpjh1xIS6FrHjz8DgzOYkbKU7UAFil9BP4F6cKDKG8N2h8aAr4vW 2cdA== X-Gm-Message-State: APt69E1uD/Els82AIVsgdtJe1f4p95zMr1XP7wlnTz2pR5fAun8Cry3W 4BE+wiufW3fGmxyujINBXaKqxUhzr+YeZ3nW0pUBfQ== X-Received: by 2002:a24:b046:: with SMTP id b6-v6mr2142957itj.48.1530283221194; Fri, 29 Jun 2018 07:40:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:9082:0:0:0:0:0 with HTTP; Fri, 29 Jun 2018 07:40:20 -0700 (PDT) In-Reply-To: <20180629130155.e7ztz5ikxfl352ff@lakrids.cambridge.arm.com> References: <20180627160800.3dc7f9ee41c0badbf7342520@linux-foundation.org> <20180628124039.8a42ab5e2994fb2876ff4f75@linux-foundation.org> <20180629130155.e7ztz5ikxfl352ff@lakrids.cambridge.arm.com> From: Andrey Konovalov Date: Fri, 29 Jun 2018 16:40:20 +0200 Message-ID: Subject: Re: [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer To: Mark Rutland Cc: Andrew Morton , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 29, 2018 at 3:01 PM, Mark Rutland wrote: > On Fri, Jun 29, 2018 at 02:45:08PM +0200, Andrey Konovalov wrote: >> So with clean kernel after boot we get 40 kb memory usage. With KASAN >> it is ~120 kb, which is 200% overhead. With KHWASAN it's 50 kb, which >> is 25% overhead. This should approximately scale to any amounts of >> used slab memory. For example with 100 mb memory usage we would get >> +200 mb for KASAN and +25 mb with KHWASAN. (And KASAN also requires >> quarantine for better use-after-free detection). I can explicitly >> mention the overhead in %s in the changelog. > > Could you elaborate on where that SLAB overhead comes from? > > IIUC that's not for the shadow itself (since it's allocated up-front and > not accounted to SLAB), and that doesn't take into account the > quarantine, so what's eating that space? Redzones. KHWASAN doesn't need them since the next slab object is marked with a different tag (with a high probability) and acts as a redzone.