Message ID | 20191030142237.249532-12-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=AzKR=YX=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 8F6DE112B for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 30 Oct 2019 14:23:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5BF1720656 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 30 Oct 2019 14:23:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kDMiVf15" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BF1720656 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 BAB726B026C; Wed, 30 Oct 2019 10:23:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B38266B026D; Wed, 30 Oct 2019 10:23:19 -0400 (EDT) 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 963276B026E; Wed, 30 Oct 2019 10:23:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 6A0E56B026C for <linux-mm@kvack.org>; Wed, 30 Oct 2019 10:23:19 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 192306D9B for <linux-mm@kvack.org>; Wed, 30 Oct 2019 14:23:19 +0000 (UTC) X-FDA: 76100668518.07.fact52_3a050dafbb842 X-Spam-Summary: 2,0,0,a9d8c2354d4df402,d41d8cd98f00b204,31zy5xqykcogqvsnobqyyqvo.mywvsxeh-wwufkmu.ybq@flex--glider.bounces.google.com,:mingo@elte.hu:vegard.nossum@oracle.com:dvyukov@google.com::viro@zeniv.linux.org.uk:akpm@linux-foundation.org:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@lst.de:dmitry.torokhov@gmail.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:axboe@kernel.dk:martin.petersen@oracle.com:schwidefsky@de.ibm.com:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu:tglx@linutronix.de:wsa@the-dreams.de:gor@linux.ibm.com:iii@linux.ibm.com:mark.rutland@arm.com:willy@infradead.org:rdunlap@infradead.org:andreyknvl@google.com:elver@google.com:glider@google.com,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1541:1593:1594:1711:1730:1747 :1777:17 X-HE-Tag: fact52_3a050dafbb842 X-Filterd-Recvd-Size: 5142 Received: from mail-vs1-f73.google.com (mail-vs1-f73.google.com [209.85.217.73]) by imf30.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Wed, 30 Oct 2019 14:23:18 +0000 (UTC) Received: by mail-vs1-f73.google.com with SMTP id b3so287187vsh.0 for <linux-mm@kvack.org>; Wed, 30 Oct 2019 07:23:18 -0700 (PDT) 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=DxGu6whVYQ2z6BOovYk+cqzdGAM1gRpyILsCGDV4umw=; b=kDMiVf15bd1LThcGiH2zcYr7aozapZf2Bp0hagBRakdbX5s8GxktNyedFlakJdLfA1 gmV83OXEjOPVP9dG0Mayg7o7vWpvG19FfuCsh7//uGg9RF7esqYJabivqeX8fIETpIZa rTLNE3Qyal3at6XDvHKRDYU1hzz0nyU/QBtFgSqMenk2qsYWDXfxjv3Nvskm5Eh4N5Ul MVl83mTIYtTTf107HhPJMWurbd6dcMu9PqZBdHRrU0nBierJjUkt8U1b6VeiUo7KFlEL le6P79D35xn+2FIJA1eB8WYoENCPckNHXNCRbXgNhQ1Y7g0YyH0zBTKz1IK5oChiqrE5 AfpQ== 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=DxGu6whVYQ2z6BOovYk+cqzdGAM1gRpyILsCGDV4umw=; b=LWn2FuutlzWkRec1EGJpIMC8tSrSy0Wu4yLn4d4d5rerQwrOzDrR5Mo+e+1YIq6kow dWY0Zi7i8ZL1ZNRPQlKctTWemJ6Yb4GIL7Nav3S6J74Z7BO0jDCbqfRMcYa8HJNqfZHT ke77wU8A4l0xHM2h2ecy0pCzMLh0aXXZ/J64CiI9forqK+ih6YEnTbxQuq/Nm9uvgSxC iWjY+R10kEpODJoaN+SmoNHCIpb6q3m/LMSp2rQxGWWqlPNpqC6fytGBxBaywvVZm/w/ v7kWyObxiqB4AIUsIsR0YCiMlPoC7ZK7rsPZpSPcVSfae+EXnLpezF5Fei213CWsoN61 YG0A== X-Gm-Message-State: APjAAAXjTaORqbdzl0oy1qwjH70/yEUFC9wQrYD5DF9gcgonygnRkiH0 HlCNgaMJML6a5MQ6TMZYlfBsKAIlzMk= X-Google-Smtp-Source: APXvYqxsSbb0WCtWoYis7OjMA5IHFW+O7xo5waLBGlFQD3ygjOHDew+ijgj8fsjzYgHAnCQ08j9QWupbKnQ= X-Received: by 2002:a1f:3a15:: with SMTP id h21mr14986807vka.17.1572445397665; Wed, 30 Oct 2019 07:23:17 -0700 (PDT) Date: Wed, 30 Oct 2019 15:22:23 +0100 In-Reply-To: <20191030142237.249532-1-glider@google.com> Message-Id: <20191030142237.249532-12-glider@google.com> Mime-Version: 1.0 References: <20191030142237.249532-1-glider@google.com> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH RFC v2 11/25] 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: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@lst.de, dmitry.torokhov@gmail.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, axboe@kernel.dk, martin.petersen@oracle.com, schwidefsky@de.ibm.com, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, wsa@the-dreams.de, gor@linux.ibm.com, iii@linux.ibm.com, mark.rutland@arm.com, willy@infradead.org, rdunlap@infradead.org, andreyknvl@google.com, elver@google.com, Alexander Potapenko <glider@google.com> 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(+)