Message ID | 20220905122452.2258262-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 488CCC6FA83 for <linux-mm@archiver.kernel.org>; Mon, 5 Sep 2022 12:25:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C22538D006C; Mon, 5 Sep 2022 08:25:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD1EB8D0050; Mon, 5 Sep 2022 08:25:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A72D38D006C; Mon, 5 Sep 2022 08:25:12 -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 9537A8D0050 for <linux-mm@kvack.org>; Mon, 5 Sep 2022 08:25:12 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7539DA08BD for <linux-mm@kvack.org>; Mon, 5 Sep 2022 12:25:12 +0000 (UTC) X-FDA: 79877951664.15.9961765 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) by imf05.hostedemail.com (Postfix) with ESMTP id 0D788100078 for <linux-mm@kvack.org>; Mon, 5 Sep 2022 12:25:11 +0000 (UTC) Received: by mail-ej1-f73.google.com with SMTP id ho13-20020a1709070e8d00b00730a655e173so2264968ejc.8 for <linux-mm@kvack.org>; Mon, 05 Sep 2022 05:25:11 -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=cCxag6KhRzMmnFVgfur/MISL9l4M5Ts+EjiLMP524JfvXCm4VLcLN7LzmXBjiZcaXb tlmiubyC93h17zTr+LO/dsylFcdxii7RwDPGn7qVnv6xTfjMkw0Cmoc7esbeBQP5TY9I YMNzkKVgI5RiZP85BOt8+Kx6fVfZgqQPOft+QNgQuRzLtUpRoXrN0PbcsG9nX9970XBG IBzqQiigJF2SIPyYv8PSiIFJrlq4x8iKcxDedH268UB7rpLHat8Rs+Z89FEg2QhX2aCA UNpAZdA9qSiszdY2MHTipaEnHXo6YveoRZNUVH6fz9F+WSwEd/H/4G01oo+H2EC8PkLV j68A== 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=YbWRYE/DCm6ZXdBz/X3jB44nduua14GORHKs/ApClo8KIByxCQwlAmwOCfrwrgN09Y 1AOw4B5P1809xTwjmHmVae6Q0u4gXo2H34VrViIHkExQa5Y677gTj2HCjRNYEQtUL8kk Cw5iuGyXuVCryehpZqYdVWCodi8JnjcUlvc+JdVdcZUb14HUi26woRpEgYFou+Y46gzG rgz61ZCYKdmzAMtZ4VwhopAkLWCVisp6b6r9Wqqq3UpCjsMBv/Tc9JQwYyy3KE3s2KZ6 KkjIiKXKsSX+yU/c3F+3qZXY/rBYJdfoUuLfXi51YvQ9fwA1lh53OPsaY3+h67wASwW1 Mjgg== X-Gm-Message-State: ACgBeo2cvRA36iQIN3OKaHUSmw8qgWU+VMVfkpKWm6klJ0fFDcfyDpUE qiQOA0YwFf9O9oQBVkMFFyBSbywAB7s= X-Google-Smtp-Source: AA6agR6U2run9tld0JOCd4AYP6RzPopWiBDxZtk42V7MPQ3Pjs2lgYt8aiDTWOU8Ssa/Mvqp6YaAqq5ka0Y= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:b808:8d07:ab4a:554c]) (user=glider job=sendgmr) by 2002:a17:907:2c5b:b0:741:6b8f:d3ab with SMTP id hf27-20020a1709072c5b00b007416b8fd3abmr26797162ejc.447.1662380710753; Mon, 05 Sep 2022 05:25:10 -0700 (PDT) Date: Mon, 5 Sep 2022 14:24:13 +0200 In-Reply-To: <20220905122452.2258262-1-glider@google.com> Mime-Version: 1.0 References: <20220905122452.2258262-1-glider@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220905122452.2258262-6-glider@google.com> Subject: [PATCH v6 05/44] 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 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>, 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=1662380712; a=rsa-sha256; cv=none; b=YQ9hhppPP3c3fnRduOLtCI2Eh3ZUcwlX/zqbBFoCUu2EBolqhJwJuO+ep/BONcdgrfBnzv lOobpV17oO6RTz1KRHnrkEWGBvJBUq8KlhZ1J88vaFj16ltmC5T7EyCRbsn8rjuBtyUa7t ldFPDp309kV54ulwL/Er+DDoVN3wWQ0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cCxag6Kh; spf=pass (imf05.hostedemail.com: domain of 3puoVYwYKCPEZebWXkZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3puoVYwYKCPEZebWXkZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662380712; 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=8RMOj+Gytui3rL58uEfKzzDEQT/fEDPBra1gSqbkm5DyRJXXpFrLpxL3mDlISy4etgxxXS v1YjSoe8I36dEo4EXmkbGzlGeqH92iW8Ucvre9xJ0tFi9GaNVofWAR4bCH0obgMHMIYCEz EVYVS5d9vMwx+Yz6YlWHbgmOs8Vrgb0= X-Rspam-User: X-Stat-Signature: 9q8pafwupocuf3f8radw6iwoyc9j8rdb X-Rspamd-Queue-Id: 0D788100078 X-Rspamd-Server: rspam10 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cCxag6Kh; spf=pass (imf05.hostedemail.com: domain of 3puoVYwYKCPEZebWXkZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3puoVYwYKCPEZebWXkZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1662380711-693356 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 */