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=-0.8 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 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 5A0B1ECE58C for ; Tue, 15 Oct 2019 06:29:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1621421835 for ; Tue, 15 Oct 2019 06:29:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="fvMKJxrK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1621421835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A94CC8E0006; Tue, 15 Oct 2019 02:29:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A6A338E0001; Tue, 15 Oct 2019 02:29:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97FBC8E0006; Tue, 15 Oct 2019 02:29:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by kanga.kvack.org (Postfix) with ESMTP id 74FD38E0001 for ; Tue, 15 Oct 2019 02:29:46 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 25B32181AEF2A for ; Tue, 15 Oct 2019 06:29:46 +0000 (UTC) X-FDA: 76045043172.29.sand49_8f6f2e93e0744 X-HE-Tag: sand49_8f6f2e93e0744 X-Filterd-Recvd-Size: 4789 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 06:29:45 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id y22so11797325pfr.3 for ; Mon, 14 Oct 2019 23:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=EVslka8YIIComg0Mb0g4qEN93Z7Bcof6eewif1bv3wA=; b=fvMKJxrKgp9CYweCSx4MbPgFiuWurTltPjobUhlnzb8Cmkn10UhyDvibnvLfhdCaPZ iAcFBr/ToDPczF6SCfKJW4c8wPd2bWUyqCWkL1mx5drZ4hYuVcGff1H76UgQlLjMw/Fk yNZnuw4mvgPV/E9nzi6lE81E6UMI/dcXYr0qA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=EVslka8YIIComg0Mb0g4qEN93Z7Bcof6eewif1bv3wA=; b=d9PY3zfJfsgthUaT2NDZjCNxH+PrwFZKuXMhH+k13M8YUrqOtC1ni6Eb0jkNEhbEKX BkVaZocAVPDXkKyLiwBaWr3QHB7txEZ6NL4Rvj0QYjzzKTNG+ObTpkBcH8yKYczZXzk9 qmLHx5qtXhInzuBjBPNcFMz/RIohFGbfZrKShN4P4fi1P1uGi0YFu73CW5fAISQUa/cV aouiruvdi4xhLseCLitGyHm1XoqgmlsC0WmQCpwMaYfptS1BXPeADA8bhawjvT+r4jRa EoV5AweA9QFRBCgdDUJdCHMxcb4beulgtUtjvrzY3+BDJEGPcQqaM+1lf8n0JIjDFUTD Ccrg== X-Gm-Message-State: APjAAAVXayxkUzpmTcNRyFnTSbV5D/zwsyQdeaTecvElPPdpCLRE27LS z+y78R5hbCnosaV3KpVEEHcmFg== X-Google-Smtp-Source: APXvYqzYXrgvkLqJx+T8uaM5IYuUGK7SLiyvcJPx/6JLaQ1UBHy/P4sYrgAY4hiObjyQROeFg8fEOg== X-Received: by 2002:a17:90a:9201:: with SMTP id m1mr41063558pjo.42.1571120984449; Mon, 14 Oct 2019 23:29:44 -0700 (PDT) Received: from localhost (ppp167-251-205.static.internode.on.net. [59.167.251.205]) by smtp.gmail.com with ESMTPSA id s191sm14125845pgc.94.2019.10.14.23.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 23:29:43 -0700 (PDT) From: Daniel Axtens To: Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, x86@kernel.org, glider@google.com, luto@kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, dvyukov@google.com, christophe.leroy@c-s.fr Cc: linuxppc-dev@lists.ozlabs.org, gor@linux.ibm.com Subject: Re: [PATCH v8 1/5] kasan: support backing vmalloc space with real shadow memory In-Reply-To: <87ftjvtoo7.fsf@dja-thinkpad.axtens.net> References: <20191001065834.8880-1-dja@axtens.net> <20191001065834.8880-2-dja@axtens.net> <352cb4fa-2e57-7e3b-23af-898e113bbe22@virtuozzo.com> <87ftjvtoo7.fsf@dja-thinkpad.axtens.net> Date: Tue, 15 Oct 2019 17:29:40 +1100 Message-ID: <878spmttbf.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain 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: >>> @@ -2497,6 +2533,9 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, >>> if (!addr) >>> return NULL; >>> >>> + if (kasan_populate_vmalloc(real_size, area)) >>> + return NULL; >>> + >> >> KASAN itself uses __vmalloc_node_range() to allocate and map shadow in memory online callback. >> So we should either skip non-vmalloc and non-module addresses here or teach kasan's memory online/offline >> callbacks to not use __vmalloc_node_range() (do something similar to kasan_populate_vmalloc() perhaps?). > > Ah, right you are. I haven't been testing that. > > I am a bit nervous about further restricting kasan_populate_vmalloc: I > seem to remember having problems with code using the vmalloc family of > functions to map memory that doesn't lie within vmalloc space but which > still has instrumented accesses. I was wrong or remembering early implementation bugs. If the memory we're allocating in __vmalloc_node_range falls outside of vmalloc and module space, it shouldn't be getting shadow mapped for it by kasan_populate_vmalloc. For v9, I've guarded the call with is_vmalloc_or_module. It seems to work fine when tested with hotplugged memory. Thanks again. Regards, Daniel > On the other hand, I'm not keen on rewriting any of the memory > on/offline code if I can avoid it! > > I'll have a look and get back you as soon as I can. > > Thanks for catching this. > > Kind regards, > Daniel > >> >> -- >> You received this message because you are subscribed to the Google Groups "kasan-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/352cb4fa-2e57-7e3b-23af-898e113bbe22%40virtuozzo.com.