From patchwork Thu Jan 21 13:19:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12036139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3B8BC433DB for ; Thu, 21 Jan 2021 13:19:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9428023A01 for ; Thu, 21 Jan 2021 13:19:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9428023A01 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 190BE6B0012; Thu, 21 Jan 2021 08:19:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16D816B0022; Thu, 21 Jan 2021 08:19:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0307C6B0023; Thu, 21 Jan 2021 08:19:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id E2E166B0012 for ; Thu, 21 Jan 2021 08:19:25 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A94371DF8 for ; Thu, 21 Jan 2021 13:19:25 +0000 (UTC) X-FDA: 77729838690.22.rail34_2e1292127563 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 787A51803AA65 for ; Thu, 21 Jan 2021 13:19:25 +0000 (UTC) X-HE-Tag: rail34_2e1292127563 X-Filterd-Recvd-Size: 4552 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 13:19:24 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id p80so2180389ybg.10 for ; Thu, 21 Jan 2021 05:19:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=EZM8uwys0tIYTV5rV7IMpiN4Wky1Ucyd+XglcRPDA0k=; b=WFun/2AwoihyT9AoddjjkcKTUjc9aI3jv7IFGHwz+lYgIMz5b4WPNxXTiyzbrd+LJk WO3FxCB1Z/havwsDuvKosLXatsLCtqTnsMN3N5jAgG74u80nWFXEmQ+mBgYjdUB//JjX Q6kAQ+pAl8XYDz2Ei2+nblI2fGGTv+uKtJHtRqlXQfEDBJAQS+jkFBswpyKA8etRcnUH OOs71Y+Fd5/i9qecUzQiepvITmFqkejQn7UN/r27rnGMC+BNYBM5HmdI/y7s1YXWGRBt lfvhUY4CVirmJMHsy+tYXnPwttmMKEyvF9fWE1SPqi/BxiZHoPg/x/SPCfVGkwMJnOka xM9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EZM8uwys0tIYTV5rV7IMpiN4Wky1Ucyd+XglcRPDA0k=; b=hwp9EKA60IORGM3H+i72YPpMOdRQbhVsFWlr69wBo6cMsGTtmc2stdO9tK6C21l3zM tN2kRKiD20TtCrY6SpbnVOtTob4MqZ7VpMYkV3fM/x/o8HwRiNGcc58v6FcNctXdw6bX WWMtifIP6c67AsysZEz4bwSFTyNJKom1Gm4SrorGCqavU9VbjvCY9YFVO5HvM52Uhlqb vano3q9BgiP5JBHqO42DJqj7mQQpVlxAl/ilFR6I0rVwerj9Iv4lBZQ39tFBRrmADHj9 74wEdONKHSYV4EzjW4bmgAE/RBvtddULT+C8o5OOMA8bf0DgJ82+1GnLeOXOkEGiPh2G CErg== X-Gm-Message-State: AOAM530i6ZewsGE+64FdUJE683mRq9Ob+YKi/b4CHi8MF7z0LWakcSlb zxaKBXHpbp/4wurRwZCSsNLH3ej6qz8= X-Google-Smtp-Source: ABdhPJwtDkTgRZRk3yc/3yCU/TR+GnrcNDSCBz+LT6IxxpACRB4tZzjHkAxKgNiuzuLPqOyxu2xUmBX1mnc= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:f693:9fff:fef4:9ff]) (user=glider job=sendgmr) by 2002:a25:3bc5:: with SMTP id i188mr20415374yba.332.1611235164118; Thu, 21 Jan 2021 05:19:24 -0800 (PST) Date: Thu, 21 Jan 2021 14:19:14 +0100 In-Reply-To: <20210121131915.1331302-1-glider@google.com> Message-Id: <20210121131915.1331302-3-glider@google.com> Mime-Version: 1.0 References: <20210121131915.1331302-1-glider@google.com> X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-goog Subject: [PATCH 2/3] kfence: use error_report_end tracepoint From: Alexander Potapenko To: akpm@linux-foundation.org, glider@google.com Cc: elver@google.com, andreyknvl@google.com, dvyukov@google.com, mingo@redhat.com, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, linux-mm@kvack.org, linux-api@vger.kernel.org, vbabka@suse.cz, gregkh@linuxfoundation.org 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: Make it possible to trace KFENCE error reporting. A good usecase is watching for trace events from the userspace to detect and process memory corruption reports from the kernel. Suggested-by: Marco Elver Cc: Andrew Morton Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Ingo Molnar Cc: Marco Elver Cc: Petr Mladek Cc: Steven Rostedt Cc: Sergey Senozhatsky Cc: linux-mm@kvack.org Signed-off-by: Alexander Potapenko --- v3: - dropped error_report_start v2: - change error_report_start and error_report_end prototypes to accept enum error_detector instead of char* (as suggested by Steven Rostedt) --- mm/kfence/report.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/kfence/report.c b/mm/kfence/report.c index 901bd7ee83d8..f9fc93b2fe2e 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -246,6 +247,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r show_regs(regs); else dump_stack_print_info(KERN_ERR); + trace_error_report_end(ERROR_DETECTOR_KFENCE, address); pr_err("==================================================================\n"); lockdep_on();