From patchwork Fri Jan 15 13:03:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12022687 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 6B443C433E0 for ; Fri, 15 Jan 2021 13:03:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EADC1221FA for ; Fri, 15 Jan 2021 13:03:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EADC1221FA 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 4929F8D0164; Fri, 15 Jan 2021 08:03:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4428F8D0162; Fri, 15 Jan 2021 08:03:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 380248D0164; Fri, 15 Jan 2021 08:03:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 217258D0162 for ; Fri, 15 Jan 2021 08:03:42 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D4C57181AEF1A for ; Fri, 15 Jan 2021 13:03:41 +0000 (UTC) X-FDA: 77708026242.07.month13_5610fe42752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 9F48E1803F9AD for ; Fri, 15 Jan 2021 13:03:41 +0000 (UTC) X-HE-Tag: month13_5610fe42752f X-Filterd-Recvd-Size: 4439 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 13:03:41 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id u29so4150941wru.6 for ; Fri, 15 Jan 2021 05:03:40 -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=8pVBeAmHPVH4sqJoIpZrjNUbTTeWSJqiF6QuBFFBEnk=; b=ccJ5Z7VTBZPDX9JXev9i/OkwG95wzB3NCH8osolNVfLSMNex77i24yMeYluWI570PJ Ztx+IYoIByjgjWR1EYhlJ5+vQo8SExAPpe6rwX6eQLSyWesAeMwp+LApKK2ACATBLGEB LKABYbNC7cUSleQvufFz2DxsJ/hFHdd1QHpOh3yH6K4+z+cIpvFi2hGQ0hXOl3kTVzEB QY0yPFKjdDXAAduUGb6gPLUxMBzd671MQSORe2QjgzvbhAiR89bvtcneajK2teINgXyX VxGBs0yr0meKUdterygUTx0hUe4K12rZ/d+YGSR3tiH0jlpxvy/1mTEp6m+A8FJyhv8p 3f2w== 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=8pVBeAmHPVH4sqJoIpZrjNUbTTeWSJqiF6QuBFFBEnk=; b=p+RHrEUpJSH8CmKYa0yheG4WN4fxBkBlCm/QUIp2Zt6cDpZ0U24R2rHMn6NFBoR3TW Kvc8uAnSAs4YJfyrLHzoc6/v4ykLh2H+CTqGyun8X2gESC2mFClussN5YT2FLaQBic4X RKDROt35pdscinICh/xduBt+v8613bXvPyEwnUZS9hsAbgEaOEwwqc0Ag+f99wlQJ2XZ fg7jnBRS4R5LC5kgPz9iM2NARzEn4x5Hw9sdK1XMjihkmW4ONXZ/9G0Mgd9ICCyvVkLv 5dzGqiSfiBoYvYvCM3URzxv2INtLwCB1InDYt8W94iREwK4sELa8KqBaBVb0Sf87HQZ5 +j1A== X-Gm-Message-State: AOAM532dbZ2CVrylh0q5D8/pOYLEto5FYG1MgjImITvZFN4ynWmO2wMX XGvdrvu5ZhVZ8ykQCvEhAKKuVspa35M= X-Google-Smtp-Source: ABdhPJxUvIPL0i29Yl8JtZjMDJ/eXdCqsve6tD+d3QCJyO9+vAeeTKUGu85ayMrOb0A4kaU2HyWSQ25LC2w= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:f693:9fff:fef4:9ff]) (user=glider job=sendgmr) by 2002:adf:fdce:: with SMTP id i14mr13164778wrs.58.1610715819702; Fri, 15 Jan 2021 05:03:39 -0800 (PST) Date: Fri, 15 Jan 2021 14:03:31 +0100 Message-Id: <20210115130336.2520663-1-glider@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v2 0/5] Add sysfs interface to collect reports from debugging tools From: Alexander Potapenko To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: andreyknvl@google.com, dvyukov@google.com, mingo@redhat.com, elver@google.com, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, glider@google.com, linux-mm@kvack.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 library that captures error reports from debugging tools like KASAN or KFENCE and exposes those reports to userspace via sysfs. Report capturing is controlled by two new types of tracepoints: error_report_start and error_report_end, that must be added to the tools that want to use this new feature. 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 (5): tracing: add error_report trace points lib: add error_report_notify to collect debugging tools' reports docs: ABI: add /sys/kernel/error_report/ documentation kfence: use error_report_start and error_report_end tracepoints kasan: use error_report_start and error_report_end tracepoints .../ABI/testing/sysfs-kernel-error_report | 41 +++ include/trace/events/error_report.h | 84 ++++++ kernel/trace/Makefile | 1 + kernel/trace/error_report-traces.c | 11 + lib/Kconfig.debug | 14 + lib/Makefile | 2 + lib/error_report_notify.c | 278 ++++++++++++++++++ mm/kasan/report.c | 15 +- mm/kfence/report.c | 3 + 9 files changed, 443 insertions(+), 6 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-kernel-error_report create mode 100644 include/trace/events/error_report.h create mode 100644 kernel/trace/error_report-traces.c create mode 100644 lib/error_report_notify.c