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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no 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 13A8CCA9EC3 for ; Tue, 29 Oct 2019 14:56:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C6A3D20874 for ; Tue, 29 Oct 2019 14:56:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="FxXowz98" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6A3D20874 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 652C66B0005; Tue, 29 Oct 2019 10:56:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 603D16B0006; Tue, 29 Oct 2019 10:56:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519336B0007; Tue, 29 Oct 2019 10:56:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 31B216B0005 for ; Tue, 29 Oct 2019 10:56:42 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id C044D180AD82F for ; Tue, 29 Oct 2019 14:56:41 +0000 (UTC) X-FDA: 76097123802.07.fact22_3411b29581e X-HE-Tag: fact22_3411b29581e X-Filterd-Recvd-Size: 4963 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Oct 2019 14:56:41 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id l3so10085927qtp.2 for ; Tue, 29 Oct 2019 07:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=u2wc5nbwT1EQU94Fzz7CdF6MBYDoJbSmKYux+i47FW0=; b=FxXowz98t+x3H6ngJt8/OH9C7CGKE+OKdsG21O3sKSPO9+5nXh9KnNKwGdDNEkEGKM IHKc351ejPMXaBgiFENbvc8/3C88MoPhPu35KKznSuOArpkSCrihRlI/uMgL/AmQGHHq o61QlxW43BJxIpK7SM6IIodbr47hkl+luabCv4IO4QZwVTtXkmfa9dhcK9nMrGydg3OG k28bZXoZAV2dKXlnARP0HQ2hAU2Kgp0/IDBg2XuDJLgeAatkawSl94LNe9ZHxrOd88MH f8W37hxP0Z+nYr0GMxDl3TkkWNVtKMbR8BMCKOcYctNHrkYWev2KDF5kAK8mKZO6Zydi WB9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=u2wc5nbwT1EQU94Fzz7CdF6MBYDoJbSmKYux+i47FW0=; b=iTSYTqfafIhCnTFEs9fvTun/6+58iEA4bpyJ6ny0p61GWt3B6FHBtaYY38tUwsjbKQ BPR1ViprFJ18MdD7lFfxJeIHJDMsSDT5cKpJ4a0Js2oKeNYJBn4KHt4g8l7RzXghsb8y sTfryKJkv7tXJiq37V86/H/OAMA9Y+St/NulBqbNoYNt39Q50+nvr9GpZ6Q3AAaWmEOh TidrtShKwrOJPcsoKn0rt33y5H/sSfoqgSMu2WSndVYJ/UGKHU2/VzPUSnGREKLalP/s BSz/LV87kcoPUC8AlJno3isdk9lv1zY1+YEhX+PPC0xZID8nXEE7eWP3UuS9jbw1xb2W upfw== X-Gm-Message-State: APjAAAVsgH2QaIg1VZ8IF35LicaEkxdtGdDLUcEqdswXewfwDz4uwRse Pba4baCKrFOe8kGcBu0cXtyj9A== X-Google-Smtp-Source: APXvYqykp2XBHJrb6HTgM7E8JFAncIc/REGaZsrlAiOC5j82EVJDJ/GcVfeavBr12OOLL5aNLQ9fww== X-Received: by 2002:ad4:5429:: with SMTP id g9mr15430939qvt.27.1572361000486; Tue, 29 Oct 2019 07:56:40 -0700 (PDT) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id a19sm10567628qtk.56.2019.10.29.07.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2019 07:56:39 -0700 (PDT) Message-ID: <1572360997.5937.91.camel@lca.pw> Subject: Re: [PATCH RFC v1 19/26] kmsan: call KMSAN hooks where needed From: Qian Cai To: Alexander Potapenko Cc: Andrew Morton , Greg Kroah-Hartman , Eric Dumazet , Wolfram Sang , Petr Mladek , Vegard Nossum , Dmitry Vyukov , Linux Memory Management List Date: Tue, 29 Oct 2019 10:56:37 -0400 In-Reply-To: References: <20191018094304.37056-1-glider@google.com> <20191018094304.37056-20-glider@google.com> <1571410932.5937.78.camel@lca.pw> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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 Tue, 2019-10-29 at 15:09 +0100, Alexander Potapenko wrote: > On Fri, Oct 18, 2019 at 5:02 PM Qian Cai wrote: > > > > On Fri, 2019-10-18 at 11:42 +0200, glider@google.com wrote: > > > Insert KMSAN hooks that check for potential memory errors and/or make > > > necessary bookkeeping changes: > > > - allocate/split/deallocate metadata pages in > > > alloc_pages()/split_page()/free_page(); > > > > This also seems unnecessary where there are options like page_poison and > > debug_pagealloc should be able detect uninitialized memory access in the page > > allocator as well. Even KASAN has some of the functionality. > > I still believe there's some misunderstanding between us because I > didn't CC you on KMSAN runtime or the documentation. > I'll do this and will be happy to answer questions if you still have them. > Without these hooks, KMSAN will be virtually unusable, because it > won't know about heap allocations. > > When a buffer is allocated on heap, KMSAN updates the metadata for > that region of memory, writing 0xFF (meaning uninitialized) to every > shadow byte and a stack ID to every 4 region bytes. > Note that shadow and origin bytes are stored separately and are > generally incompatible with what debug pagealloc/page poison do. That makes more sense to me now. I was a bit worry about some of those options could stub one's toe with KMSAN, but I had shared with you the MM debug config in another email before, so you could try it out, so I don't need to spam you later once this hit the linux-next.