Message ID | 20191122112621.204798-15-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=DNi/=ZO=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 359C11871 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 22 Nov 2019 11:27:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02CC320672 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 22 Nov 2019 11:27:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JI0SUR5R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02CC320672 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD2506B04DB; Fri, 22 Nov 2019 06:27:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C82656B04DC; Fri, 22 Nov 2019 06:27:11 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B49396B04DD; Fri, 22 Nov 2019 06:27:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 98DE06B04DB for <linux-mm@kvack.org>; Fri, 22 Nov 2019 06:27:11 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 65ABD8249980 for <linux-mm@kvack.org>; Fri, 22 Nov 2019 11:27:11 +0000 (UTC) X-FDA: 76183687062.30.screw12_48194a89991b X-Spam-Summary: 2,0,0,db58ad892e847435,d41d8cd98f00b204,3dsbxxqykco0vaxstgvddvat.rdbaxcjm-bbzkprz.dgv@flex--glider.bounces.google.com,:mingo@elte.hu:vegard.nossum@oracle.com:dvyukov@google.com::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@infradead.org:hch@lst.de:darrick.wong@oracle.com:davem@davemloft.net:dmitry.torokhov@gmail.com:ebiggers@google.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:iii@linux.ibm.com:jasowang@redhat.com:axboe@kernel.dk:m.szyprowski@samsung.com:elver@google.com:mark.rutland@arm.com:martin.petersen@oracle.com:schwidefsky@de.ibm.com:willy@infradead.org:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:cai@lca.pw:rdunlap@infradead.org:robin.murphy@arm.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu :tglx@li X-HE-Tag: screw12_48194a89991b X-Filterd-Recvd-Size: 5317 Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by imf31.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Fri, 22 Nov 2019 11:27:10 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id n6so2728918vke.22 for <linux-mm@kvack.org>; Fri, 22 Nov 2019 03:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=2X7D2mjhS7ZkNKLohL9CLIfcSKD0zH1T9AvQWwuPJGk=; b=JI0SUR5R/lYGZ1TrosRHRyynfZ3zZltCDxGg5e7IUbXiCt/46BID//80C6+QRYiTEi N0n5/K7tQaOcr2et9EMaKOsCSbCnpCPpHCkYxvxgnXWXD2+L8/nNpkacDIgg+fO1KFnm Q7DIKWB84r2Lqpyhn3LxTF9qwN8uM6dKxoLX/Qq4LnqMYm9fwM1KvK2mrsLfCtQr5mXR 9RnIrkAEvI8M2CCMbx/hOjzx2dRRDXqfDsr1KSWwqDdk9cTkF/q4vF7Wyf56HQmQgY/q U78PHlkHpNlFyjsRcA82objHl+GHsQx5uRtsCnZbUoj5fYaS3F5bs5FbmPUc8wDq0SFZ tz+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=2X7D2mjhS7ZkNKLohL9CLIfcSKD0zH1T9AvQWwuPJGk=; b=BUQ9vVx07FA0uaV+bYV5nRg6PJKQRDPCzj+fMeHe6DPTx26QumwSFz7qCtR0LhaTvl GDbIdLgfuUoqHI2fn/YTbpf0mE38osrhunY23O8/yRD2xaMrb1ZSZraTKv4wAWxlKF/s uKzWwtGUP7QUCTQSxGRPlcYYEgMnkCdl9XH4H8DKcn4DzaztvuQLEmadB7xi80xqaVlp QtDnES8Q4BTz8KRiF3WauHRmgirzUwKAf6bbnzfuWnNimMnGMBCwjjz0YYAWMPaD1OUb Mi7GEyvuDgFwK80r65s/wSpoj1/ExKYCGsJPa7uzmx9zspOTXJK8AYd3Embzw1AyOZbS HP5g== X-Gm-Message-State: APjAAAXUUJTOr4kZozMs5klapD0rcqAANjkDhG9HEKFkZZJI6t1En1h9 XHU2KepQE/fAHDktloU67YViKYtf7sI= X-Google-Smtp-Source: APXvYqxbF2y9MzX84Wr+YP+5uo9V9nr0wLXvzg9VmIEijZbE0E5cyidX/kz8iKDyDeJlVe18heVv71Z7AEw= X-Received: by 2002:a67:fdd4:: with SMTP id l20mr9830114vsq.227.1574422030194; Fri, 22 Nov 2019 03:27:10 -0800 (PST) Date: Fri, 22 Nov 2019 12:25:59 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-15-glider@google.com> Mime-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog Subject: [PATCH RFC v3 14/36] kmsan: x86: sync metadata pages on page fault From: glider@google.com To: Ingo Molnar <mingo@elte.hu>, Vegard Nossum <vegard.nossum@oracle.com>, Dmitry Vyukov <dvyukov@google.com>, linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, hch@lst.de, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, ebiggers@google.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, iii@linux.ibm.com, jasowang@redhat.com, axboe@kernel.dk, m.szyprowski@samsung.com, elver@google.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de Content-Type: text/plain; charset="UTF-8" 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: <linux-mm.kvack.org> |
Series |
Add KernelMemorySanitizer infrastructure
|
expand
|
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 9ceacd1156db..d582337ba45d 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -320,7 +320,17 @@ static void dump_pagetable(unsigned long address) void vmalloc_sync_all(void) { +#ifdef CONFIG_KMSAN + /* + * For KMSAN, make sure metadata pages for vmalloc area and modules are + * also synced. + */ + sync_global_pgds(VMALLOC_START & PGDIR_MASK, VMALLOC_META_END); + sync_global_pgds(MODULES_SHADOW_START & PGDIR_MASK, + MODULES_ORIGIN_END); +#else sync_global_pgds(VMALLOC_START & PGDIR_MASK, VMALLOC_END); +#endif } /* @@ -337,7 +347,17 @@ static noinline int vmalloc_fault(unsigned long address) pte_t *pte; /* Make sure we are in vmalloc area: */ +#ifdef CONFIG_KMSAN + /* + * For KMSAN, make sure metadata pages for vmalloc area and modules are + * also synced. + */ + if (!(address >= VMALLOC_START && address < VMALLOC_META_END) && + !(address >= MODULES_SHADOW_START && + address < MODULES_ORIGIN_END)) +#else if (!(address >= VMALLOC_START && address < VMALLOC_END)) +#endif return -1; /*
KMSAN assumes shadow and origin pages for every allocated page are accessible. For pages in vmalloc region those metadata pages reside in [VMALLOC_END, VMALLOC_META_END), therefore we must sync a bigger memory region. Signed-off-by: Alexander Potapenko <glider@google.com> To: Alexander Potapenko <glider@google.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: linux-mm@kvack.org --- Change-Id: I0d54855489870ef1180b37fe2120b601da464bf7 --- arch/x86/mm/fault.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)