Message ID | 20220915150417.722975-6-glider@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93D7EC6FA89 for <linux-mm@archiver.kernel.org>; Thu, 15 Sep 2022 15:04:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CD8F8000A; Thu, 15 Sep 2022 11:04:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 27B8480009; Thu, 15 Sep 2022 11:04:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F96C8000A; Thu, 15 Sep 2022 11:04:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 017D480009 for <linux-mm@kvack.org>; Thu, 15 Sep 2022 11:04:52 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D68F2806CB for <linux-mm@kvack.org>; Thu, 15 Sep 2022 15:04:52 +0000 (UTC) X-FDA: 79914642024.16.55BF895 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf26.hostedemail.com (Postfix) with ESMTP id 7B4BC1400D1 for <linux-mm@kvack.org>; Thu, 15 Sep 2022 15:04:52 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id y14-20020a056402440e00b0044301c7ccd9so13177248eda.19 for <linux-mm@kvack.org>; Thu, 15 Sep 2022 08:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=fFq4uMFAQOrpNZLU6ydmQ4L19fVmnSZ8zUbgI7i1GQ4=; b=cYFC7xgwkG3gs04oiPHichqf/b1cFGgnshWpci997Y8A5dmNKzM9GLf1pSniU9D5ku Hu0GNNgLGKOuCAjrWJaXT+n9N89m2OxLOF0aOwdMyJRfQdseBJiGghcUNTQyFs/ZUubo G0Bq2nmYZaMX470D+dLwGf+5tXv+CdH3F2TMy+uDbAiFguTk8zqG98QgRczskOtYOVDt jAjc9/Nvo2lVMh0sB6dJ8QlQ6FSwdkrIQtBbc5j54TAMFUpg1fazPK6geXTDbKZa+hK/ CtUyiXzLrd1aFajhJlu7Z3AG5P4f56KCWQ3N8ixK5cFk+NBX9dXK5inzenk1xXL3SCUs gf6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=fFq4uMFAQOrpNZLU6ydmQ4L19fVmnSZ8zUbgI7i1GQ4=; b=upS4EUQFfjl2VL7j9TxXMXV6l1GLTAtoekBGNQOMbWG2cb2n+k35RMgDm7MnNvdiS8 mvR49chznY6T8xpsUCwoddby59Df24oCrcULouHuAEDTqkYW5rKduOikUUUfhsQGfHcq Ie191CxNF3TcEHnSnk4P0HFqlT8efCmxUAdnyCX7tImhaStfSIYgK2YqHQtoZcx9zAT7 RCaacSdQ0KVOqPRHKx7M43GGQcEPRj1sJaaPJ6FP9M3WucB0h+lAq8WCAEpcNXrq5UXN D5wL7Q52C5b5Gl6pet2Rlx7NtqkrryAFZh5K62+BEYGgf88ACTKlJqzni2+FX0RW6xR8 ctWw== X-Gm-Message-State: ACrzQf29Z5aHJzmyAUBp4ALYOv68j9IWql187L6xRb2RuaWd46FYtbDs JHNw4wTajuDkFwviJxuf2SfsnniufiU= X-Google-Smtp-Source: AMsMyM6nb4U8HQAI/T9hvY7h7118sHc1IkAnGq/cw4fx9f/IsFE0PzlQ/IJC4zd5NEMJksDjOy7tAJB6OCw= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:686d:27b5:495:85b7]) (user=glider job=sendgmr) by 2002:a17:907:272a:b0:77c:d7df:c9da with SMTP id d10-20020a170907272a00b0077cd7dfc9damr318116ejl.332.1663254291795; Thu, 15 Sep 2022 08:04:51 -0700 (PDT) Date: Thu, 15 Sep 2022 17:03:39 +0200 In-Reply-To: <20220915150417.722975-1-glider@google.com> Mime-Version: 1.0 References: <20220915150417.722975-1-glider@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220915150417.722975-6-glider@google.com> Subject: [PATCH v7 05/43] asm-generic: instrument usercopy in cacheflush.h From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Alexei Starovoitov <ast@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Andrey Konovalov <andreyknvl@google.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>, Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Dmitry Vyukov <dvyukov@google.com>, Eric Biggers <ebiggers@kernel.org>, Eric Dumazet <edumazet@google.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Herbert Xu <herbert@gondor.apana.org.au>, Ilya Leoshkevich <iii@linux.ibm.com>, Ingo Molnar <mingo@redhat.com>, Jens Axboe <axboe@kernel.dk>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Kees Cook <keescook@chromium.org>, Marco Elver <elver@google.com>, Mark Rutland <mark.rutland@arm.com>, Matthew Wilcox <willy@infradead.org>, "Michael S. Tsirkin" <mst@redhat.com>, Pekka Enberg <penberg@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Petr Mladek <pmladek@suse.com>, Stephen Rothwell <sfr@canb.auug.org.au>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, Vasily Gorbik <gor@linux.ibm.com>, Vegard Nossum <vegard.nossum@oracle.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663254292; a=rsa-sha256; cv=none; b=AoHTGot1+0Sa3kkm5LV3K7RORI+bFYBBA08kDdzl5ZT2dYhkpaUZbvBgf1GlmC4lj9mdIl eZV/DnQw+CGQrQ8wCG3W2j+Q4Ujwy8HHOSsd87679VniiC8v9eRz8ynuBZQ/nKQhUWjRyE 31Kv+HsK9sfaTW+1OAvo9czDSXxvN2M= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cYFC7xgw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 3Ez8jYwYKCD4lqnijwlttlqj.htrqnsz2-rrp0fhp.twl@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3Ez8jYwYKCD4lqnijwlttlqj.htrqnsz2-rrp0fhp.twl@flex--glider.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663254292; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fFq4uMFAQOrpNZLU6ydmQ4L19fVmnSZ8zUbgI7i1GQ4=; b=VC8q59cdLoGffa0JMVNBLsrIwKVtnog192bxa5EckHNidkfN4MG1pZG2lx+mx+qewWsJtY xWLLw2j9kTtwDmgwg9UQb0gTjScJRm4U6fMoFctISZBji+XOiXuw6mM2y4G9rXqT3V+WGn 1PEPoeSIBpLzd3C8iGSLnh4SoI1SuFM= X-Rspam-User: X-Rspamd-Queue-Id: 7B4BC1400D1 X-Rspamd-Server: rspam05 X-Stat-Signature: iuudkcrp9sfyszrzp7mkpeucnt3zu59e Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cYFC7xgw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 3Ez8jYwYKCD4lqnijwlttlqj.htrqnsz2-rrp0fhp.twl@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3Ez8jYwYKCD4lqnijwlttlqj.htrqnsz2-rrp0fhp.twl@flex--glider.bounces.google.com X-HE-Tag: 1663254292-788998 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/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h index 4f07afacbc239..f46258d1a080f 100644 --- a/include/asm-generic/cacheflush.h +++ b/include/asm-generic/cacheflush.h @@ -2,6 +2,8 @@ #ifndef _ASM_GENERIC_CACHEFLUSH_H #define _ASM_GENERIC_CACHEFLUSH_H +#include <linux/instrumented.h> + struct mm_struct; struct vm_area_struct; struct page; @@ -105,14 +107,22 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end) #ifndef copy_to_user_page #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ do { \ + instrument_copy_to_user((void __user *)dst, src, len); \ memcpy(dst, src, len); \ flush_icache_user_page(vma, page, vaddr, len); \ } while (0) #endif + #ifndef copy_from_user_page -#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + do { \ + instrument_copy_from_user_before(dst, (void __user *)src, \ + len); \ + memcpy(dst, src, len); \ + instrument_copy_from_user_after(dst, (void __user *)src, len, \ + 0); \ + } while (0) #endif #endif /* _ASM_GENERIC_CACHEFLUSH_H */