Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp895109ybx; Wed, 30 Oct 2019 06:52:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfml7seeozF6JT9SXgjNyrsghpUcqtzVuV7OCe8hL51jVKqqW6z7/iKKOrr49Yx+wflB24 X-Received: by 2002:a17:906:7d2:: with SMTP id m18mr8846120ejc.94.1572443537434; Wed, 30 Oct 2019 06:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572443537; cv=none; d=google.com; s=arc-20160816; b=gXu5hrIBIDzMhkpCO14g57bz3vrDbWufYB0fe/9kD1fX+B2VeMV+2Jviu/eDGL+Vcl 3GtrobDTDG0dPlSVtqj+lDi62LkGxaQ1jiNCBRG90VA96bCimMSNAemt+qNgYB3uVJNT In07vit3auxaN6wnkfLqK7eEx/7OHx/ypwcBgbESuzIOajTS778AYsPfZbU5gmm1RvrI GcGKjzfBBinrqSpFKyhA3Cflj+F9eYqZfueFueI+3lI2H2p7EcSKAW8XiEZMmt8arqQe 6yPj6PehItLb8ehn+hDXV2SGPhLGkYI64PcslD1enz+sPAtyH0rr8r3oY6lQUA0WTM7Y MKdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=pb0XrKghyFZgq2oeDgc1vRiv8K2ZCa6MKROaXA8DqHQ=; b=iAytZVl14Heh/rxH2ikJSAo/N/o+EQfRFyXMmD25NY0/+bungNFv8SduQjQ2HuYY8p PqLWB9yhdJjBbyrZGAxBxSFvP+6Ptd9DU2Uo7v6JDZLUMEaf3KCAxPJgepV2u+E4Ipiq CjpqOmTH0Degb9/tAvqKRcR3DBT9qmnluZFuKZprD4l4yVjLHEeOBTLqSz49dmAwhh/g TPSA5AYQyN+1lxhBq6MJMwf1EDkFebY4BVW/zx9o6Fp6OudRAEAxl1TVasUPPAD3nFkL BAoQEPwPMAB3692yLnpzH+cW8qx/oiAZgCpBPreeYpzKcMsMDYVzzOrR9YqE6UXTXDyT Ze5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=NTwARt8G; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ly18si1437794ejb.374.2019.10.30.06.51.53; Wed, 30 Oct 2019 06:52:17 -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=@axtens.net header.s=google header.b=NTwARt8G; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfJ3NuK (ORCPT + 99 others); Wed, 30 Oct 2019 09:50:10 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35819 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbfJ3NuK (ORCPT ); Wed, 30 Oct 2019 09:50:10 -0400 Received: by mail-pl1-f195.google.com with SMTP id x6so1029853pln.2 for ; Wed, 30 Oct 2019 06:50:10 -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=pb0XrKghyFZgq2oeDgc1vRiv8K2ZCa6MKROaXA8DqHQ=; b=NTwARt8GUFCdG5TLJcI8i9cPiC/uXK1HfVAmkF/Gi70bnHnieGDcLcKhO+TpHqC1fD x4C83BpfmUyDj8Rjo5KmeHlhXkrHNK0d01ZempNxNYWBY4EvFCzdf8V7F/HDhoG9uk2i sSv0amtdfi01NJeawZo9HWDVM2mJxLKzuZIuA= 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=pb0XrKghyFZgq2oeDgc1vRiv8K2ZCa6MKROaXA8DqHQ=; b=mROqbA94ZvsWkosErhqkPAQoEklDTuRYRjAwVwNPB+F8c8JltqfpnIrLoHO+GsVI5L hrg/dpmH77gdIXAnvQAsfIDtZyZv9e6Nof78aP1T3c+jst08ttZFmHJUNqKEvaRfgYSU IXtUqKox9faaq5PsWrfsp2qJOcgdxI0i24MrXtFfs0Gu6SYMcySmh/lwVbvH0c6956D3 2s8F7/2/yGwJ+lxuBdxTDyNu7l2nXL78HK708A8sqybX8xTcO7A+mCgKNc3HbJ1buVs4 hrD8p1+fve3hTDh9yUWzo/uVypSJMLbw518lcaCHlxJNW+x/N5As0t/xO8B52KicNemz SzeA== X-Gm-Message-State: APjAAAW+eNek24o5+/37S7wCzCVVhAchFLeX0j1mU+S/4Ahc2E01TC6q jE3QlO61hCa5j0esKKWG6tNBqA== X-Received: by 2002:a17:902:760c:: with SMTP id k12mr102582pll.256.1572443409483; Wed, 30 Oct 2019 06:50:09 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-783a-2bb9-f7cb-7c3c.static.ipv6.internode.on.net. [2001:44b8:1113:6700:783a:2bb9:f7cb:7c3c]) by smtp.gmail.com with ESMTPSA id e198sm35049pfh.83.2019.10.30.06.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 06:50:08 -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, Andrew Morton Subject: Re: [PATCH v10 4/5] x86/kasan: support KASAN_VMALLOC In-Reply-To: References: <20191029042059.28541-1-dja@axtens.net> <20191029042059.28541-5-dja@axtens.net> Date: Thu, 31 Oct 2019 00:50:05 +1100 Message-ID: <87sgnamjg2.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrey Ryabinin writes: > On 10/29/19 7:20 AM, Daniel Axtens wrote: >> In the case where KASAN directly allocates memory to back vmalloc >> space, don't map the early shadow page over it. >> >> We prepopulate pgds/p4ds for the range that would otherwise be empty. >> This is required to get it synced to hardware on boot, allowing the >> lower levels of the page tables to be filled dynamically. >> >> Acked-by: Dmitry Vyukov >> Signed-off-by: Daniel Axtens >> >> --- > >> +static void __init kasan_shallow_populate_pgds(void *start, void *end) >> +{ >> + unsigned long addr, next; >> + pgd_t *pgd; >> + void *p; >> + int nid = early_pfn_to_nid((unsigned long)start); > > This doesn't make sense. start is not even a pfn. With linear mapping > we try to identify nid to have the shadow on the same node as memory. But > in this case we don't have memory or the corresponding shadow (yet), > we only install pgd/p4d. > I guess we could just use NUMA_NO_NODE. Ah wow, that's quite the clanger on my part. There are a couple of other invocations of early_pfn_to_nid in that file that use an address directly, but at least they reference actual memory. I'll send a separate patch to fix those up. > The rest looks ok, so with that fixed: > > Reviewed-by: Andrey Ryabinin Thanks heaps! I've fixed up the nit you identifed in the first patch, and I agree that the last patch probably isn't needed. I'll respin the series shortly. Regards, Daniel