From patchwork Thu Jan 21 13:19:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12036135 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=-11.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 71EF5C433E0 for ; Thu, 21 Jan 2021 13:19:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D579223A01 for ; Thu, 21 Jan 2021 13:19:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D579223A01 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 400B76B000C; Thu, 21 Jan 2021 08:19:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B2016B000D; Thu, 21 Jan 2021 08:19:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C7C66B000E; Thu, 21 Jan 2021 08:19:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 181486B000C for ; Thu, 21 Jan 2021 08:19:21 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D462A180AD81D for ; Thu, 21 Jan 2021 13:19:20 +0000 (UTC) X-FDA: 77729838480.10.table87_5c0921827563 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id B1ADD16A4C1 for ; Thu, 21 Jan 2021 13:19:20 +0000 (UTC) X-HE-Tag: table87_5c0921827563 X-Filterd-Recvd-Size: 4057 Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 13:19:20 +0000 (UTC) Received: by mail-qk1-f202.google.com with SMTP id d7so1528307qkb.23 for ; Thu, 21 Jan 2021 05:19:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=zruIQedjwNcDhDYNEYrrXFR6YFTuvFQowbaXONNBZzQ=; b=auEArelE69t+FGAy3A0cQlrQNM8iE4wySncCyMEzHElhKgOjhVQN/ZW2PeVmojNZgA uC2vhrlm5XJp5UDg9ky+/Xndsf7D8V2HO0zuIQBwazFcPBwhaRNDbdHGy4miwBHsY/jz R3bLryjDG5pSgjVRpkNBoWI4PxyiLPjXj7Vy7H+RcO0mz3OO5xdti0J8DBXQDwlYMl2X 2kXd4Dg3+Yf4CG+VpM8KKgRInbiqAljQwZv/6O44r3uWBhjaA7cB1rEDB/PSue8fYqRl 4dO6ZmVm0Yg/EvzmkAQQlMIsp29cw2KpfkHZ10Dd66KUZaK6BW2h7zSRN1dQGFfStiYL qczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=zruIQedjwNcDhDYNEYrrXFR6YFTuvFQowbaXONNBZzQ=; b=JHexijeH3wQSOTqK62PxVld85DfmIPd+FA2qNbCVdnbFizq+mv3nWoVPrGXuH+odwy iPnioROst1eSiCJHbQ8mUC8n6DDH4YC3ZY9sgHl6pheXXLga5yPyTiCgfv/uWZwz0yef SzgppLcRR2Hz3LUvAlAtA0QwnG2l8YBX6R78Ot8HlfazK1L9WQ9JGxQFkq0ue93SSdzI 9DN7xPsl8d17T07LUy+xNUe8p+CusQfB3fINucnaFRte/aoKpnMd38UxGox5/2KKb1Un 1iIGMtY8fTbgqKNJsvrQh4k+rCWXVKFxbdC6xYhXxMPUUEfaYN81FtBYxfDIQ8Cc3Y9K awNw== X-Gm-Message-State: AOAM532t7pBeqRfBU4BQ07FppKAB0JpatxC0udSq+IbFG2tByYGX/4yN EtJGZpTfHS0yGRBG9rvNlhxa6cSMIJ4= X-Google-Smtp-Source: ABdhPJzFoRrCNu6UqrEYfSA9a/pnawzMv2aw7MtKk+jQYTz8jXHoLSFgsHYsaeUML4+BBYgjYB7eJpdq+8I= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:f693:9fff:fef4:9ff]) (user=glider job=sendgmr) by 2002:a05:6214:14ae:: with SMTP id bo14mr14422919qvb.16.1611235159490; Thu, 21 Jan 2021 05:19:19 -0800 (PST) Date: Thu, 21 Jan 2021 14:19:12 +0100 Message-Id: <20210121131915.1331302-1-glider@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-goog Subject: [PATCH v3 0/3] Add error_report_end tracepoint to KFENCE and KASAN 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: This patchset adds a tracepoint, error_repor_end, that is to be used by KFENCE, KASAN, and potentially other bug detection tools, when they print an error report. One of the possible use cases is userspace collection of kernel error reports: interested parties can subscribe to the tracing event via tracefs, and get notified when an error report occurs. v3: - dropped the sysfs interface for log collection - dropped error_report_start tracepoint v2: - added ABI documentation for /sys/kernel/error_report/ - changed error_report_start and error_report end tracepoints to take a fixed set of values for the error detector Alexander Potapenko (3): tracing: add error_report_end trace point kfence: use error_report_end tracepoint kasan: use error_report_end tracepoint include/trace/events/error_report.h | 74 +++++++++++++++++++++++++++++ kernel/trace/Makefile | 1 + kernel/trace/error_report-traces.c | 12 +++++ mm/kasan/report.c | 8 ++-- mm/kfence/report.c | 2 + 5 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 include/trace/events/error_report.h create mode 100644 kernel/trace/error_report-traces.c